How to Start a Blog and Make Money Online – The Ultimate Beginner’s Guide
September 6, 2022Netflix announces 46 beneficiaries of its Creative Equity Scholarship Fund in East Africa
October 11, 2022Firstly, we have looked at how to integrate MPESA into a custom PHP website, and a Laravel website. Therefore, let’s look at M-Pesa STK Push integration into a WordPress woo commerce website. In this article, we are going to show you how to integrate mpesa in WordPress woocommerce using a plugin.
Step 1: Set up App on Safaricom Daraja Portal
Before we set up woocommerce mpesa plugin on your ecommerce website, we have to set up the mpesa app on the Safaricom daraja platform. The next step is to create a new sandbox app by clicking on the Add a New App button and giving it a name. Ensure you select both Lipa na Mpesa Sandbox and Mpesa Sandbox and hit Create App button. Finally, copy the Consumer Key and Consumer Secret.
In the next steps, let’s go to our woocommerce WordPress website. Woocomemerce is an open-source e-commerce plugin built on WordPress to make it an e-commerce store. Therefore, the first requirement would be to install the woocommerce plugin to your WordPress website. Go to your WordPress admin and follow these steps:
Step 2: Installing Woocommerce
- On the left darks section, go to Plugins then Add New.
- In the search bar, type “WooCommerce”.
- Click Install Now on the plugin by Automattic.
- Click Activate Now.
Step 3: Installing Woocommerce MPESA Payment plugin
With the woocommerce plugin installed, let us now add the WooCommerce MPESA Payment plugin. The mpesa WordPress plugin will enable us to easily add an option of paying for goods using M-PESA. Download the mpesa plugin here. Install the WooCommerce MPESA payment gateway plugin by choosing the upload option.
To set up our mpesa payment gateway, go to Woocommerce > Configure MPESA
Step 4: Fill in your app and business details
Fill in the details below: Environment (Sandbox for testing and Live when active), Identifier type (Till number or paybill), Store number, business shortcode, App Consumer key, App Consumer Secret, Online Pass Key and Account reference.
Step 5: Test the STK Push
Lastly, once you have filled in the mpesa setup details, your store is ready to send stk push to customers to make payments via mpesa.
The checkout should look something like the one below.
When the user enters the phone number, an STK Push is triggered on the phone to complete the order purchase.
That’s how you set up stk push mpesa woocommerce. Thank you.
6 Comments
I am using sandbox mode but I am getting (M-Pesa Error) 404.001.03: Invalid Access Token… What could be the problem…
Hi Fabian, kindly use the updated plugin in the plugin link
This doesn’t work.
Hi Lucy, we have updated the link to the mpesa plugin.
Still not working
(M-Pesa Error) 500.001.1001: Wrong Credentials.