Firstly, 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.
First things first, 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:
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
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.
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.