How to make money blogging in Kenya
Uncategorized Patrick Mahinge  

Mpesa Integration to Website: Learn How to Add Mpesa API to Your Site

I finally started accepting Mpesa Payments via my website! You can now pay for your favorite e-course or a web design project straight from this website. That is what I call a milestone

However, the journey to this point has not been an easy one. The difficulties I faced trying to integrate an Mpesa Payment Gateway on my website left me wondering why we do not have more developers investing in this area. At the least, Safaricom should come up with solutions on this but they seem to have left it to third-party developers.

JamboPay Mpesa Payment Gateway

One of the most popular online Mpesa Payment Gateways. Their downsides is that they charge an arm and a leg to have you use their Mpesa payment gateway. When I enquired about their services, they slapped me with a quotation that almost toppled me over.

Here is a screenshot of the email I received from them

How to Accept Mpesa on your website

To use JamboPay Mpesa gateway, you would need to pay at least Ksh 150,000 for them to setup your account. Clearly, JamboPay’s service are not for the small online trader or a struggling startup. I told them that much and headed back to Google to find a more viable solution.

PesaPal Payment Gateway

If you can forgive them for the lack of information/misinformation on their website, PesaPal are the guys to use for your online Mpesa Payments.

If your eCommerce store is built on WordPress, integrating with the PesaPal Mpesa Payment gateway is quite easy. There are several plugins available for free on the WordPress repository that make it very easy to start accepting Mpesa on your website.

  1. PesaPal Pay

Last updated on November 2014, the PesaPal Pay WordPress Plugins lets you collect payments via all the mobile money transfer services in Kenya. It makes use of forms and shortcodes [pesapal_pay] and [pesapal_donations] to collect payments and donations respectively.

The plugin is not very intuitive to use. Unless you know your way around coding, I would advise you try the other alternative provided below.

2.  WooCommerce PesaPal  Standard Payment Gateway

Last updated in July 2014 and downloaded 330 times, the WooCommerce PesaPal Standard Payment Gateway extends WooCommerce’s functionality and lets you charge for goods via Mpesa and other mobile payment services in Kenya.

I could not get this plugin to work on my website, and I finally gave up trying to use it.

I am not sure why the developer insists that you use demo consumer key and api during installation…

  3.  PesaPal Gateway for WooCommerce

This is the WordPress plugin that I ended up using on my online stores. It is super easy to use when you have WooCommerce installed on your WordPress website.

  • Simply download the plugin from the WordPress repository
  • Unzip it and upload it via FTP to wp-c0ntents/plugins.
  • Activate on your WordPress Dashboard
  • Go to WooCommerce Settings and Click on PesaPal
  • Enter your PesaPal API Key and Consumer Secret and start accepting payments via Mpesa!

I actually tried it with a sample product that I created on my website, and it works like a charm!

Lipa na Mpesa Online

Safaricom actually have an online Payment Gateway where you can Lipa na Mpesa. This came as a surprise to me. However, I cannot understand why I have to call or email them in order for them to share the details of the application with me.

Lipa na Mpesa OnlineThose are the 3 online Mpesa payment gateways that I am currently aware of. PesaPal takes the trophy home. It is super easy to register for a Merchant account on their website and the available free plugins makes it a darling to work with.

With the PesaPal Payment Gateway, there is no reason why you should not be selling your goods online. Contact me today to set up a beautiful online shop for your business.

37 thoughts on “Mpesa Integration to Website: Learn How to Add Mpesa API to Your Site

  1. tev

    how will you know who sends you money via mpesa?

    1. Patrick Kihara

      Hey Tev,

      I have personally set my system such that when you pay via Mpesa, you are registered for the specific course you are paying for or you get a download link for the ebook you are buying.

      PesaPal also sends out an email that contains the details of the person who is paying via Mpesa.

      I can also see a list of all customers who have paid me on the backend. Did you want to make a payment?

      1. njeru cyrus

        hi working on similar project also can but am stack on how to intergrate mpesa api

        1. Francis

          Kindly check how to integrate Mpesa APi on this website: https://www.franktekmicrosystems.com/mpesa-api-documentation-paybill-lipa-na-mpesa.html

  2. benjamin

    HELLO my name is benjamin, am working on the same project and i need your help.
    i have already signed up with pesapal buh the problem i have is integrating it with my website (www.forwardit-charity.org)
    all i need is a donation form but through pesapal. Can anyone help me with the code.

    1. Cop

      Hi maina did you manage to integrate mpesa api

  3. Tim Dost

    Dear Patrick Mahinge,

    Thanks for your interesting blog. I was wondering, do you need a Lipa Na M-Pesa number to use these service and go through the required process with KRA Pin, Business License, or is there a way to circumvent this process? Looking forward to hear from you.

    Kind regards, Tim Dost

  4. antony muthee

    This is a very usefull articla. thank you.

    @benjamin.. did you get help. i think i migh help you….

  5. Jordah

    For people in Uganda, have a look at https://wordpress.org/plugins/woo-mobile-money/ …In 4 easy steps you can get mobile money payments working. You also get access to your money in realtime. Tutorial: https://www.socialpay.co.ug/kb/knowledge-base/wordpress-mobile-money-plugin-mtn-airtel/

  6. Mathenge Maina

    Thanks for sharing the information. Much what i needed to start selling stuff online.

    1. Cop

      Hi maina did you manage to integrate mpesa api

  7. pius

    I would like to know this, i have an e-book and sell online using pesapal…is this also appllicable in tanzania?

    Contact +255754745798

  8. Muya

    There is a new Mpesa Api released by safaricom.co.ke on August 1st 2017. You need to create an account with safaricom through https://developer.safaricom.co.ke.
    Jumuika mobile (website http://jumuika.co.ke) and (Mobipay http://mobipay.co.ke) are working on improving the API.

  9. Kevin

    Hi..your email address..i need mpesa integration or pesapal integration to my acvount.Please assist

  10. SirBrian M. W

    Hi Patrick,

    This is nice post on integrating Mpesa payments on websites.

    However, for those looking for ways to custom integrate Mpesa to their custom websites, the integration on Safaricom website is not very clear.

    This has already been solved by easy plug and play solutions offered at https://www.paymentprocessor-script.com

    Just follow it and see what you can come up with.

  11. Gideon Nyakundi

    HI I need help with integrating mpesa payments on my woocommerce website.
    Any competent developer from kenya please help

    1. SirBrian M. W

      Are you a developer? Or just looking for someone to integrate. I could be of help in integrating Mpesa payments. Please call me on: +254706745202.

      1. Freddie M

        Hello Brian,
        I have a freelancing site, I want to integrate instant Mpesa Online deposit and withdrawal, to work exactly the way it works for BETIN.CO.KE

        Clients should be able to instantly load cash via Mpesa to their account and should also be able to withdraw cash to Mpesa instantly.

        Are you able to do this kind of integration for me?

        [email protected]
        Mobile: 0721519271

  12. Ben

    Gideon Nyakundi

    please visit this website, you might get some help

    https://ipayafrica.com/api/

  13. Eddy

    Is there an woocommerce extension that can support lipa na mpesa transactions? Any leads would be appreciated.

    1. Brian

      Yes. This is woocommerce Mpesa plugin: https://www.paymentprocessor-script.com/integrating-mpesa-with-your-woocommerce-plugin.html

  14. Pete

    Thank you Patrick Kihara for such an informative post. Francis Ndungu, your guide is also very good. I salute you kind gentlemen, and all those contributing to the replies for taking your time to add insight to the pool of knowledge. I will save a lot of money doing this myself. I would also like to copy something akin to what betting sites have, where when a customer pays money into my paybill, or till, it shows the balance on the website, almost instantaneously. They can then let the money lie there, or make a purchase with that balance. Any guide on doing that? Bravo folks

    1. Cop

      Hi Pete did you manage to integrate mpesa

    2. Brian

      Hi Pete,
      We something similar to what you need. When someone pays via Mpesa Paybill, Balance is instant updated.

      When they also decide to use the updated balance, it also works.

      Try checking it on http://www.paymentprocessor-script.com and the source code is also available.

  15. copenju

    hello guyz av tried my best but iget this error
    requestId “25797-1030804-1”
    errorCode “400.003.02”
    errorMessage “Bad Request – Invalid ValidationURL”
    what coulbe the problem am using php and xammp as my server

  16. Carol

    Omg, would people just stop advertising their affiliate sites and actually post helpful content in the comments.

  17. Dennis Obel

    hi COPENJU, did u ever resolve your issue

  18. davie

    Any Plugin for Drupal.Thanks

  19. jazel

    Is the link a one time download link or can someone reuse.

  20. Mbeki

    Hey guys, I am using Angular with Firebase (no PHP stuff), and I’m having a difficult time integrating mpesa to my site. Anyone managed to do it

  21. Oliver

    May i get someone to help me go through all this process and integrate Mpesa to my woocommerce site?
    My name is OLIVER CHANYA and my phone number is 0720083869
    Offcourse for a fee.

  22. evans

    Another alternative for integrating Mpesa to your website is by using an API integrator from Shara Solutions. Here is what they say about their service https://sharasolutions.com/index.php/mpesa-api-integration-service/

  23. Steve

    Another plugin for integrating Mpesa to your website is by using an API integrator from seokenya.com check it here>>

    https://seokenya.com/2019/08/17/mpesa-integration-to-website/

  24. Anto

    Who can help me integrate my mikrotik hotspot wifi to Mpesa API

  25. Edwin Mugendi

    Check our service SapamaCash.com that enables you to get paid and pay in bulk

    Looking to get paid? Watch this Customer to Business – C2B video: https://www.youtube.com/watch?v=VUuGt5kLyH4

    Looking to pay in bulk? Watch this Business to Customer – B2C video: https://www.youtube.com/watch?v=UV_Su_7x8wo

    Guide on how to integrate MPESA Daraja API – https://www.sapamaerp.com/blog/guide-integrating-new-mpesa-api

  26. Soraya M

    Hello I’m from DRCongo and I was wondering if someone has found a way to integrate the mobile money payment methods to my e-commerce website.
    Thank you again

  27. Pancras Mwangi

    Hey. I love this article, keep it up.I would love to network with you. I am blogger and a freelance web developer. If anyone needs Mpesa integrated on your site plus Airtel money and card payments for free reach me via 0111279909

Leave A Comment