M-PESA Integration
Last updated
Last updated
Copyright © OpenG2P. This work is licensed under Creative Common Attribution (CC-BY-4.0) International license unless otherwise noted.
M-Pesa is a virtual banking service that allows users to participate in financial transactions using their SIM cards. Once a SIM card is entered into a mobile phone, SMS messages are used to send and receive money.
M-Pesa was first introduced in Kenya as an alternative to the traditional brick-and-mortar set up. Being a digital tool, it is widely popular in over seven African nations as it speaks to financial inclusivity for marginalized and far-flung groups.
OpenG2P, in it's interoperable and modular approach, is able to easily integrate with M-Pesa to demonstrate the ease of access for its benefit delivery mechanism. The integration is done using an M-Pesa simulator. Here is the link to the simulator https://africastalking.com/
More information on M-Pesa can be found here https://www.investopedia.com/terms/m/mpesa.asp
An M-Pesa simulator is used for demonstration. It is a direct integration that doesn't involve a payment switch like Mojaloop.
How does the integration work? The M-Pesa account is mapped to the person's phone number. When payment is initiated from the OpenG2P system, the individual dials the USSD code from their phone, enters the mobile number to which their M-Pesa account is linked, and then checks their balance to see if they have received any money or pays their dues to a vendor who may also have an M-Pesa account.
This diagram here encapsulates the flow and components for an M-Pesa integration. It is assumed that MOSIP is the ID issuer here, and that the M-Pesa account is created at the time of issuance of ID, and is mapped to the person's phone number instantly.
Instructions to deploy M-Pesa integration:
Download the kube-config file from the rancher of a particular environment
Set kube-config to that particular environment in your local dev environment
Clone this repo into your local environment - https://github.com/OpenG2P/openg2p-deployment/tree/main/kubernetes/mpesa
Edit the config.yaml
file with appropriate database location, username and password
Edit the virtualService.yaml
file with appropriate hostname.
Run the below commands:
Here is a link to the slides which demonstrates payments to the M-Pesa simulator.
Click here to go to the program repository, under which all the M-Pesa functions and code can be found here.