M-Pesa handles more than KES 30 trillion in transactions every year across Kenya. For most Kenyan businesses, M-Pesa is not a payment option — it is the primary payment method. Yet a surprising number of businesses still manage M-Pesa payments manually: checking the Safaricom portal, writing down transaction codes, and reconciling them against sales records at end of day. Proper M-Pesa ERP integration eliminates all of this.
How M-Pesa Daraja API Integration Works
Safaricom's Daraja API is the technical bridge between your business systems and the M-Pesa payment infrastructure. Through Daraja, your ERP can initiate payments (STK Push), receive C2B payments, process B2C disbursements and query transaction status — all programmatically, without logging into a portal.
There are four main Daraja API payment flows that Kenyan businesses use:
STK Push (Lipa Na M-Pesa Online / Express). Your system sends a payment request directly to the customer's phone. The customer confirms by entering their M-Pesa PIN. The payment is instantly confirmed and the ERP records it automatically.
C2B (Customer to Business). The customer initiates the payment from their phone to your Paybill or Till number. Daraja sends a real-time notification to your system the moment the payment arrives. The ERP allocates it to the correct invoice or sale automatically.
B2C (Business to Customer). Your ERP initiates a payment from your business to a customer or supplier — used for refunds, salary advances, and supplier payments.
Account Balance Query. Your ERP can query your M-Pesa business account balance and transaction history programmatically.
The Problem with Manual M-Pesa Reconciliation
When M-Pesa is not integrated with the ERP, a typical day looks like this: cashiers or accounts staff check the Safaricom portal or SMS notifications, manually note down transaction IDs and amounts, match them against sales records, and enter them into the accounting system. The process is time-consuming, error-prone and creates a permanent lag — reconciliation is always historical rather than real-time.
Common errors include: recording M-Pesa payments against the wrong invoice, recording the wrong amount (mobile money fraud occasionally involves manipulated SMS notifications), missing transactions because a notification was missed, or double-recording a payment. Each error requires correction time and creates reconciliation discrepancies.
With Daraja integration, none of these manual steps exist. The moment a customer pays, the ERP knows — and records the transaction correctly against the right document.
M-Pesa Integration with POS Systems
In a retail or restaurant POS environment, M-Pesa integration means the cashier does not need to do anything after initiating the STK push. The customer's phone rings, they confirm, and the POS automatically marks the transaction as paid, prints the receipt and posts the sale. The cashier cannot accidentally record a payment as cash when the customer paid by M-Pesa.
BetaSuite's Retail POS and Restaurant POS both support Daraja API integration natively. The Till number or Paybill is configured once in the system settings. Every payment flows through Daraja and is recorded automatically. The end-of-day M-Pesa total on the Z-report matches the Safaricom statement — because they come from the same API data.
M-Pesa for Collections: Rent, Fees, Loan Repayments
Businesses that collect recurring payments — rental income, school fees, membership subscriptions, loan repayments — benefit enormously from M-Pesa C2B integration. Instead of checking an SMS channel and manually allocating payments, the ERP receives a C2B notification the moment the customer pays and allocates it automatically based on the account reference included in the M-Pesa payment.
BetaSuite's Tenant/Lease module uses this to automatically post rent payments to the correct tenant account the instant payment is made, regardless of whether the office is open. Landlords and property managers can see real-time collection status for every tenant.
M-Pesa and KRA eTIMS Compliance
Every M-Pesa payment that is a taxable sale must generate a KRA eTIMS-compliant receipt. When M-Pesa is integrated with your ERP and your ERP is integrated with KRA eTIMS, this happens automatically. The M-Pesa payment triggers the sale record, which triggers the eTIMS submission, which generates the tax receipt with the KRA fiscal device number — all in seconds.
Without this integration, there is a risk of M-Pesa sales that never get recorded in the eTIMS system. KRA cross-referencing your M-Pesa till total from Safaricom with your eTIMS submissions would reveal the discrepancy.
M-Pesa Reporting in the ERP
With Daraja integration, your ERP can produce M-Pesa reports that your Safaricom portal cannot: M-Pesa revenue by product, by branch, by cashier, by day of week, by hour of day. You can see which of your locations accepts the most M-Pesa, which services customers prefer to pay by mobile money, and how M-Pesa volumes trend over time.
Frequently Asked Questions
Do I need a Safaricom M-Pesa business account to integrate?
Yes. You need an M-Pesa Business account (either a Paybill number or a Till number, or both) registered with Safaricom. The BetaSuite team assists with the Daraja API credentials setup — you need to register as a developer on the Safaricom developer portal and get your Consumer Key, Consumer Secret and shortcode credentials.
What happens if the Safaricom API is down?
BetaSuite handles API failures gracefully. If the STK push request fails, the cashier is notified and can switch the customer to cash or card. If a C2B notification is delayed, the system queries the transaction status automatically and reconciles when the API responds. No transactions are permanently lost.
Can M-Pesa be used for supplier payments (B2C)?
Yes. BetaSuite's accounts payable module can initiate B2C M-Pesa payments to suppliers, casual workers and contractors directly from within the system. The payment posts to the supplier account and the general ledger simultaneously.
Does the system work with multiple Paybill and Till numbers?
Yes. BetaSuite supports multiple M-Pesa shortcodes. Different branches or business units can have different Paybill or Till numbers, each correctly reconciled to the appropriate branch accounts.
Eliminate your daily M-Pesa reconciliation headache for good. Talk to the BetaSuite team about integrating M-Pesa Daraja API with your business systems — we have done it for hundreds of Kenyan businesses across every industry.