Early 2017, Sapama launchedSapamaCash.com which is an online MPESA Paybill and Buy Goods Analytics Dashboard that enables merchants to record payments and customer details from MPESA API and analyse these information in an infographic charts and graph that gives them actionable insights into your customer payment patterns. It’s something like Safaricom M-Ledger but for Lipa Na Mpesa Merchants. Initially, they were using the old API and inmid 2017 migrated to the new API.
In the spirit of giving back to the community and assistother developers, Sapama decided to document and share the process they undertook inintegrating to theMPESAAPI:
Step 1: Creating an account on MPESA G2 Portal
The MPESA G2 portal is an online platform where merchants access paybill or till number transactions. The purpose of this step is to create a user who will be sent a One Time Password (OTP) before going live. Although online, you need to install a certificate in your Windows Internet Explorer. Below is the procedure:
Step 2: Creating an app on MPESA Developer Portal
MPESA Developer Portal enables a developer to create an app and use that app to access the MPESA API's. The purpose of this step is to be able to create an app. There is the test app and live app. The test app is used for development and after going live, a live app will be automatically created.This involves the following steps:
Step 3: Writing to C2B, B2C or B2C code
You need to write the code to handle C2B request or to send B2C and B2C request. The code can be written in the programming language of your choice.Kindly check this MPESA API wrapper that you can use to write the codeSapama Pay Github
The library will enable you to register endpoint urls and test the API's. During this step you'll use the Consumer Key's and Consumer Secret of the test app created in Step 2. The URLyou register needs to be SSL or https. You can get a certificate from MPESAand install it on your server or useLets Encrpt
Step 4: Going live
After making sure that your code is working correctly, you'll need to go live that is a foursub step processes that enables you to verify you are the actual owner of the API by sending a one time password to the phone number of the user you created in Step 1.
Maybe, we might have missed something butit's our hope that thesefoursteps will serve as a bridge. That they'llmake your Mpesa integration journey a little biteasier and help you connect the dots.
Well, well,you can always reach out to Edwin via email@example.com,he is open to assist where we can.