M-Pesa Integration

M-Pesa Integration

Purpose

M-Pesa is a mobile banking service launched by Safaricom in Kenya in 2007, allowing users to store and transfer money through their mobile phones. This service has become a widely adopted solution for convenient and accessible financial transactions. GoFrugal now provides complete M-Pesa integration within its billing system, making transactions seamless and efficient for users.


Pre-Requisites  

  1. M-Pesa Custom License: Ensure the M-Pesa license is activated in GoFrugal RPOS.

  2. Short Code & Till Number: Create a Short Code and Till number in the M-Pesa Organization Portal.

  3. Daraja Production App: Create a production app in the Daraja portal and obtain a Business Short Code.

  4. Credentials Configuration: Configure the Production App credentials (Consumer Key, Secret, and Passkey) with the corresponding Short Code in the GoFrugal Integration Portal.

  5. GoFrugal Version Compatibility: Ensure the GoFrugal product version is compatible with M-Pesa integration.



Limitations

1. For the server-Clients sytems ,the configruation is same,only the till id is different.
2. For the outlets,the configuration will eb different for the outlets.
3. webhook urls will be registered with MPesa and it is an one time process
4. The bill amount should be a whole value if you are initiating STK push. Else you will receive 'Invalid Bill Amount' error message if you initiate STK push with bill amount having decimal value.
5. The payment should be reconciled within 3 minutes. Else you will receive "Payment Timeout! Cannot be reconciled" message. Then you have to manually verify the transaction and proceed further.

 

Available M-Pesa Payment Flows  

  1. Pay Bills Online (C2B)

    • Customers initiate payments through their mobile or M-Pesa app using a provided Till Number. The payment is then processed directly to the GoFrugal system.

  1. Buy Goods Online (STK Push)

    • The POS initiates the payment, and a payment link is sent to the customer’s mobile. Upon completion of payment via the link, the tender closes automatically, and the bill is generated in GoFrugal.

Integration Workflow  

M-Pesa Organization Portal Configuration  

  1. Register & Set Up M-Pesa Account

    • Register for an M-Pesa account on Safaricom’s portal, ensuring you complete KYC requirements and obtain an M-Pesa digital certificate.

    • Video Guide: M-Pesa Account Registration

  1. Access Organization Portal

    • Login to the M-Pesa Organization Portal at https://org.ke.m-pesa.com.

    • Enter your Short Code, Username, and Password as provided by Safaricom.

 

  1. Organization Info Setup

    • Navigate to Organization Info to view details and child Short Codes.

 

    • To add a Child Short Code, select Add under the Children section.

 

  1. Operator Setup

    • Go to Operators, and select the corresponding Short Code to add an operator.

    • Set Access Channel to API and note down the Username for later use in the Daraja Portal.

  1. Assign Roles and KYC Info

    • Assign the Rule Profile and Role for the operator.

    • Complete the KYC Info with member details and save the configuration.

  1. Till Number Identification

    • Log in to the Organization Portal as a Business Operator.

    • Go to Tills in the menu, where you can view the Till Number associated with your Short Code.

Daraja Portal Configuration  

  1. Log In & Go Live

    • Access the Daraja Portal at https://developer.safaricom.co.ke and log in with your username.

    • Navigate to the Go Live page and enter your Short Code, Organization Name, and M-Pesa Username (assigned during operator creation in the Organization Portal).

    • Verify the OTP sent to your registered mobile and select Go Live.

    •  

  1. Production App Creation

    • Go to the My Apps page in the Daraja Portal, where production apps will be listed.

    • Find your organization in the dropdown, and collect the Consumer Key and Secret credentials from the production app configuration.

Troubleshooting & Notes  

  • Credential Errors: Ensure all credentials match the information provided by Safaricom.

  • Failed Payments: Verify internet connection stability and the Till Number configuration.

  • Daraja Access: Keep the digital certificate and credentials secure and ensure periodic updates to maintain account access.



FAQ's

  1. What should I do if I encounter credential errors?

Ans. Double-check that all credentials (Consumer Key, Secret, Passkey) match those provided by Safaricom. Mismatches can prevent successful integration.

  1. What will be reason for the payment failing process?

Ans. This can be due to an unstable internet connection or issues with the Till Number configuration. Ensure that both are correctly set up and active.

  1. Can customers get a refund if they accidentally make a duplicate payment?

Ans. Yes, you can initiate a refund in GoFrugal by reversing the transaction or issuing a credit note. Notify M-Pesa support of the transaction details (transaction ID, date, and amount) if further action is required.

  1. Is it possible to use multiple Till Numbers for different branches?

Ans. Yes, you can assign separate Till Numbers for different locations or branches. Configure each branch’s GoFrugal setup with its specific Till Number and Short Code for independent tracking.

  1. Is there a daily transaction limit for M-Pesa payments on GoFrugal?

Ans. M-Pesa may impose daily transaction limits based on customer account types and transaction amounts. Check with Safaricom or consult the customer’s mobile provider to confirm any applicable limits.