M-PESA Integration with WordPress
M-PESA integration

Mpesa is one of the most popular mobile money services in Kenya. Businesses and individuals can send and receive money, pay bills, top-up airtime, sell goods or services through a virtual store, and a whole lot more using this service. If you run a WordPress blog or website and have users who reside here in Kenya, integrating Mpesa API with WordPress is an excellent idea. This article will explain how the M-PESA integration process works so that you can go ahead with it.

How to accept payments online with your WordPress website

WordPress is a very powerful platform that allows you to build a website or blog from scratch. It is one of the best Content Management Systems (CMS) available on the internet today. It is intuitive, easy to use, and has tons of features that make designing and building a website with it very easy. More importantly, it is free to use.

However, there is one major challenge that most WordPress users face: accepting payments on their websites. You see, WordPress itself doesn’t have any built-in payment processing features. You can’t just plug-and-play a payment gateway like PayPal or Stripe and start taking payments. There is a workaround to this though; you can use a third-party payment gateway plug-in like paytalk, that allows you to accept payments on your WordPress website. This article will discuss how to do this.

Popular WordPress payment gateways

GitHub M-PESA plugin

This M-PESA Plugin for WordPress is the perfect choice for any business that wants to integrate M-pesa payments on their website. At Muriendas Web Solutions, we prefer to use this plugin because it’s open-source and does a much better job than other premium plugins. The developer is not charging for it, but if you need assistance he does charge a small fee of KSH 4,000/=

To use this plugin, it is necessary to:

  • Have WordPress and Woocommerce configured.
  • Create an account on the M-Pesa developer portal.
  • Mpesa Paybil or Till No.


Auto installation

  • Go to Plugins > Add new in your dashboard.
  • Search for PaymentsDS – Mpesa Payment Gateway for WooCommerce.
  • Click Install now on PaymentsDS – Mpesa Payment Gateway for WooCommerce to install the plug-in and then click ativate.

Manual installation

  • First, you need to download the latest version of the plugin from the [releases page]https://github.com/paymentsds/mpesa-wp-plugin/releases).
  • Upload the plugin folder to your WordPress installation’s wp-content/plugins/ directory.
  • Activate the plugin from the Plugins menu within the WordPress admin.


  • After a successfully installation and activation of the plugin, go to Woocommerce > Setting > Payments tab, its supposed to appear the M-pesa payment method listed. Activate it and then click on “Manage”.
  • Fill out the configuration fields with the information found in the M-pesa developer portal.

WooCommerce M-PESA Payment Gateway

Using the Woocommerce plugin, a WordPress site may enable customers to pay for goods using the M-PESA mobile money service, Lipa na M-PESA, or through the pay bill. The plugin adds an option to the checkout phase allowing people to pay using M-PESA. You must obtain a Paybill or Till number to use the plugin. After getting this number, you should create an account on Safaricom’s Daraja Portal and link it to the account.

Mpesa for woocommerce – This is a plug-in that lets you use the M-Pesa payments method on your website.

Using the portal, you will be able to get the following:

  • Passkey
  • Consumer Key
  • Consumer Secret
  • Sandbox/Production for authentication and payment request endpoints.

After you activate the plugin, you must fill in these details, which will then be stored on your website.

The site owner must have the ability to manage the Paybill or Till payment details. In case a customer clicks on the Pay button on the payment page, a payment authentication request will be generated. The customer will then either accept or decline the payment on their cellphone and the portal will provide the customer’s action.

After the customer has accepted or rejected the payment on their mobile phone, the portal will send a callback with the customer’s details. This is how the status of the order is determined. The free version of the plugin only processes callback responses, so to get the Till number, you must purchase the Pro version.

This plugin is simple to use and lightweight, and it works with all modern browsers.


Make sure you have installed and activated the WooCommerce plugin before installing and activating this plugin.
Upload Woocommerce M-PESA Payment Gateway plugin files to WordPressress plugins directory (/wp-content/plugins/), or install the plugin from the WordPress admin plugin screen.
Activate the plugin.
On the WordPress admin, navigate to WooCommerce > Settings > M-PESA > Manage and fill in the fields provided for the plugin to work.


The purpose of this plugin is just to link the WooCommerce plugin with the M-PESA payment method. The plugin does not have any connection to WooCommerce or M-PESA. If the Daraaja endpoint is down or unable to handle requests, the plugin should not be held responsible. There are links to other websites in the plugin description that are not controlled by WooCommerce M-PESA Payment Gateway Plugin. We do not oversee the nature, content, or accessibility of those sites. It does not necessarily imply endorsement or recommendation if any links are included.

Paytalk Lipa Na M-PESA

Paytalk is a service provider that deals with mobile money online payment integration. They have developed a woo-commerce plugin for WordPress users. The major downside with the plugin is that you are required to pay Ksh 7350 for customer-to-business (C2B) M-PESA Integration

Installation Into WordPress
Click on the plugin download link to get the paytalk plugin.


  1. Using File Transfer Protocol

Unzip the downloaded file and upload it to your WordPress plugin directory(wp-content/plugins/). Then, go to your WordPress admin backend, in the plugins section, you will see Paytalk Lipa Na Mpesa.

  1. Upload via WordPress ‘add new’ plugin in your admin backend.


  1. Go to WooCommerce Settings
  2. On the “Settings” page, select “Payment Gateways” tab.
  3. Under “Payment Gateways” you will find all the available gateways, select “PayTalk.co.ke” option
  4. On this page, you will find options to configure the plugin for use with WooCommerce
  5. Enter the API details with the Paybill/Till number registered on your Paytalk developer account.

Kopokopo plugin

KopoKopo plugin gets your online business on a successful course. This plugin is hosted by solution provider paytalk.co.ke and payments are processed on secure servers of paytalk.co.ke

Example eCommerce website using the plugin is zawadi Baby Shop

Pesapal plugin

This is a user-friendly plug-in created by Pesapal, meant to help receive payments online through your website. The plug-in is free and you can access it on your WordPress plugins. The only downside of using this plug-in is that you won’t receive enough information about your website’s payments.

Installation Process

  • login into the website you want to integrate M-PESA
  • Go to WordPress and select plugins for the integration
  • Click the search bar and enter woo-commerce Payment Gateway
  • Click install
  • Follow the prompt to start the M-PESAintegrationn for the website
  • After installing the plugin, click the woocommerce settings
  • Click on the Pesapal icon and continue the M-PESA integration to the website
  • Enter a generated Pesapal key and Consumer Secret
  • After entering the Pesapal key and Consumer Secret, you are done
  • Now you will start receiving money directly to your M-PESA till umber or pay bill via M-PESA API

M-PESA checkout

M-PESA Express check out. How Does it work?

Once a merchant has set themselves up to use M-Pesa Xpress, they can simply push mobile money transaction details to the customer’s phone. In other words, the merchant can initiate the M-Pesa transaction on the customer’s behalf. The customer doesn’t need to enter the merchant’s information or any other transaction details at all.

After the transaction has been initiated, the customer receives a push notification. Then, the customer enters their M-Pesa pin and presses ‘OK’. The transaction is now complete, and a real-time payment confirmation will be sent.

Option 1 – Customer on the payment page

As a merchant, you have the option to send your customer a secure payment link through an email transaction or the DumaPay. Once your customer lands on the payment page, they have the option to pay with any mode of payment, preferably mpesa to enjoy the new push stk technology.

They simply select mobile money

Select M-Pesa option

Enter their phone number and click pay

They’ll receive a push prompt on their phone with all the transaction details, all they have to do is input their pin to complete the payment.

Option 2 – Customer on your website

Your customers can book and pay directly from your website if you have integrated with our payment solution. Once they select what they want to purchase and check out, they’ll land on our secure payment page to make payment.

They simply select mobile money

Select M-Pesa option

Enter their phone number and click pay

They’ll receive a push prompt on their phone with all the transaction details, all they have to do is input their pin to complete the payment.

Option 3 – Charging your customer directly

If you want to charge your customers in person, you can use the Direct Pay virtual terminal or the duma pay app.

connect with us

subscribe to our newsletter