Integrate Mpesa C2B with your WooCommerce very easy.
Woocommerce runs on Wordpress and is said to the future of of ecommerce. We therefore see it good to help you integrate your Woocommerce with Mpesa (For Kenyans). In this article, I will explain how it is easy to take advantage of PayMents now that we support Mpesa deposits and Payments if you are running a woocommerce website.
Requirements to Integrate your woocommerce website with Mpesa:
1. Mpesa PayBill number ==> This is applied at any Safaricom shop in Kenya. It takes 3 to 14 days to be ready. Visit the safaricom shop and you will get forms to fill.
You need a C2B Paybill to get paid by customers.
B2C on the other hand allows you to pay other personal Mpesa numbers/persons.
Be sure to apply what you need.
In this scenario, you will be getting paid for your goods and services on your woocommerce website.
Therefore, you need a C2B Mpesa Paybill.
Recall the admin account on the Mpesa portal. We will need it.
Now, let us dive into the Integration of Woocommerce plugin with Mpesa.
Note: We have made the technical parts very easy for you. Your work is to copy and paste what we tell you to copy and paste where we tell you to.
Step 1: You need a PayMents processor software/script.
This is a ready PHP script which you will need to install in your server.
It is the one which will guide you step by step, in an easy user-friendly way to have your PayBill set up.
Find it on this link: https://www.paymentprocessor-script.com/download/
The advantage of this Script is that, while it offers a quick and easy way to set up Mpesa C2B Paybill integration, it also comes with it more Payment gateways. In short, you are integrating your Woocommerce with multiple other Payment methods and you can activate and deactivate Payment methods on it as you so wish. It is all upon you and depends on the PayMents methods you need; Mpesa included.
Step 2: The above script will require that you provide some Mpesa C2B parameters. Login the admin of the script and locate the Mpesa C2B settings.
a). Register url (prefilled)
b). Confirmation url (prefilled)
c). Validation url (prefilled)
d). Paybill number (Fill this)
c). Mpesa Portal username (Fill this).
Save the above settings.
Step 3. Go To www.developers.safaricom.co.ke and create an account. Also, create a Sandbox/Test App and Move it to production by Click "GO live" and following the instructions there.
Step 4. When this production App is approved by Safaricom (Normally takes 2 to 3 business days), you will now have a Consumer Key and Consumer secret of the production Version of your App.
Step 5. Note the login to the Developer portal.
a). Go back to the PayMents processor and on the administration Block 2,==> C2B Mpesa settings, enter it as the Mpesa security token and save. ).
b). Consumer Key (Fill this as per your App on Safaricom Developer portal).
c). Consumer secret (Fill this as per your App on Safaricom Developer portal).
Step 6. Now, Click the "register urls" button below the above settings.
A success message means everything is okay.
Everything is okay now.
Test with a transaction by sending some money to your Paybill.
You should see a transaction under the administration Block 3 --> Mpesa transactions.
You are done on Mpesa integration and now Mpesa is sending transactions to your Database.
Look at the PayMents balance, it is increasing when you make a Payment.
Step 7. Now, we need to have Mbiki Lipa na Mpesa for WooCommerce as one of the Payment options on your woocommerce website when people order and are paying.
Check this DEMO link for a liveDEMO of Lipa na Mpesa payment using Paybill.
You need to download the Mbiki Lipa na Mpesa for WooCommerce plugin and install it like a Normal Wordpress plugin.
Activate it and set up some needed info found on Woocommerce ===> Settings ===> Payments/Checkout
You are done now.
Anytime someone selects the Lipa na Mpesa option, he or she will be directed to make payments via your Mpesa Paybill and the payments are automatically captured and order processed.