Checking your M-Pesa statement line by line against a list of unpaid invoices is slow, error-prone and does not scale. It also causes real problems for customers: delayed confirmations, wrongly suspended services and disputes over who paid what. This guide explains how reconciliation should work, how to fix it when it does not, and how to approach recurring billing given how M-Pesa works.
The manual way, and why it breaks
At a small scale, many businesses still read M-Pesa SMS messages, look up the customer, find the invoice and mark it paid by hand. It works at five payments a week. At fifty, the problems start:
- A payment arrives with no or the wrong reference and nobody knows which invoice it belongs to.
- Two staff mark the same payment, or neither does.
- Customers wait hours for confirmation, or phone to ask if it was received.
- Month-end reports do not match the bank or M-Pesa statement.
- Services get suspended because a payment was not processed on time.
The automated way
With a proper Daraja integration, each payment triggers an automatic callback to your system that identifies the exact invoice or order it was made for. The record is marked paid within seconds and the M-Pesa receipt number is stored. Our own billing works this way: when a payment is confirmed, the invoice is updated and the confirmation email is sent without anyone touching it.
There are two flows to be aware of:
| Flow | How the payment starts | How it is matched |
|---|---|---|
| STK Push | Your system initiates the prompt for a specific invoice | The callback carries the request ID you stored against the invoice |
| C2B (paybill or till) | The customer pays your shortcode directly | Matched by the account reference the customer typed, or by phone number and amount |
Building a reconciliation process that works
- Give every invoice a unique reference and use it as the M-Pesa account reference.
- Store the identifiers returned when you start a payment, and the receipt number returned by the callback.
- Mark paid only on a confirmed success result, never on "request accepted".
- Handle duplicates: if the same callback arrives twice, process once.
- Query transaction status when a callback does not arrive, instead of leaving the invoice in limbo.
- Keep an exceptions list for unmatched payments, with an owner and a daily review.
- Reconcile daily against your M-Pesa statement, not once a month.
Handling payments that arrive without a match
- Match by amount, phone number and time window and confirm with the customer.
- Ask for the M-Pesa transaction code, then record it against the invoice. In our billing system, support can apply the payment and the confirmation email is issued automatically.
- Do not credit anything on a customer's say-so alone without checking the statement.
- Record the match, who made it and when.
When reconciliation fails: the usual suspects
If payments are not matching invoices automatically, the cause is almost always:
- A callback URL that is wrong, blocked or not reachable over HTTPS.
- A firewall or security plugin blocking Safaricom's requests.
- A script that crashes silently while processing the callback.
- Sandbox credentials left on a live site.
Troubleshooting steps are in common M-Pesa integration problems and fixes.
Recurring billing with M-Pesa
Subscription and renewal businesses face a real constraint: unlike a card, a standard consumer M-Pesa payment cannot be silently charged on a schedule. Every STK Push needs the customer to enter their PIN. There is no equivalent of "save payment method and bill monthly" for ordinary M-Pesa payments.
Businesses handle this in practice by:
- Sending an invoice and a payment prompt on the renewal date. The customer only has to approve with their PIN, not navigate menus.
- Sending reminders a week and a day before, with a one-tap payment link.
- Offering card payment for customers who want zero-touch renewals.
- Offering annual billing, which cuts the number of renewal moments.
- Using a grace period before suspension, so one missed prompt is not an outage. See what happens when hosting expires.
Our own hosting and domain renewals work like this: an invoice and an M-Pesa prompt on the due date, with card payment available as an alternative.
Records you should keep
| Field | Why |
|---|---|
| Invoice or order number | The thing that was paid |
| M-Pesa receipt number | Proof of payment and the key for disputes |
| Phone number | Who paid, for customer service |
| Amount and date/time | Matching to statements |
| Status and callback payload | Debugging and audit |
Frequently asked questions
Can I reconcile if customers pay manually to my paybill?
Yes, with the C2B API, you receive a notification for each payment and can match it by account reference. Without it, you rely on statements.
What if the customer pays the wrong amount?
Decide your policy in advance: apply partial payment, hold the balance as credit, or refund the difference. Record it clearly.
How do refunds work?
Refunds are typically sent out via B2C or a manual transfer from your shortcode, depending on your setup and permissions. Keep the original receipt number with the refund record.
Can you automate this for our business?
Get in touch if you are still reconciling by hand and want it automated.