M-PESA API

The API provides open interfaces over standard protocols through web services. Developers can hook directly to the core M-PESA and get creative with the systems they run.

We have been consolidating the different interfaces our developers have expressed interest in to enable innovation around M-PESA and allow for third party applications to easily plug into M-PESA.

The API provides open interfaces over standard protocols through web services. Developers can hook directly to the core M-PESA and get creative with the systems they run. Let’s look at the payments use cases below:

  1. Automated Payment Receipt Processing: Imagine the different scenarios that require customers to pay and have this processed instantly! Before G2, this was handled purely through Instant Payment Notification (IPN) which has served quite well. As the name indicates, IPN is only for notification processing. The use cases for payment processing are as many as your imagination can get – from utility bills to m/ecommerce, and the future is likely to get even more interesting.

    With the new system, the notifications are taken a notch higher by incorporating an optional payment validation step for Paybill. This allows the payment recipient (merchants) to confirm whether to accept the incoming payment or not. While this may not sound very beneficial at the face of it, think of how many customers send payments to the right Paybill number but enter the wrong account. Money moves from the customer's M-PESA account but their service payment will not be processed and they have to follow up. This has been creating a big problem with the merchants, leading to massive reversal requests. This can now be handled through the validation API which allows the recipient to validate any of the payment parameters, including, account, amount and even sender and only accept the payment if processing can be guaranteed.
  2. Automated Payment Disbursements: Many systems that process receipts will also require outward payments processing. This could range from employees' salary disbursements to paying other merchants that accept M-PESA payments. This feature was only available via web portal for business to customers (B2C) with limitations on capacity that made it unsuitable for large disbursements. With the new platform, developers can have this done via API, which empowers them and cuts off the manual process of generating payments file, putting it in the right format then uploading it via the web portal, after which it has to be approved by a different user. With the B2C API, this is now seamless.
  3. Automated Payments Reversal: Even with an elaborate system, there is always a unique case that calls for a reversal. Imagine a situation where a customer has made a payment for services that the merchant is no longer able to render. The best way to handle this would be to have a reversal process that the merchant can adapt based on their internal processes. G2 supports secure payment reversal automation for such cases. The implementation will fully depend on the service journey and controls required at the recipient's business.

The future we once thought very distant of machine to machine payments is here and now. The only limitation to the adaption is the developer's imagination.

For any feedback or onboarding requests, Kindly contact 

This email address is being protected from spambots. You need JavaScript enabled to view it.

Interested in the M-PESA API? Click here

Was this information helpful? If not tell us how we can improvesafaricom images safaricom images

Manage all your services in one App

Safaricom Neo

This website uses cookies to ensure you get the best experience on our website. Read our Cookie Policy to learn more