M-Pesa reconciliation is not a matching problem. It is a data problem that shows up as a matching problem. The payment arrived; the question is which invoice it belongs to, whether it is complete, and whether the person recording it can prove the answer six months later.
This playbook covers the design that works in Kenyan SMEs: what data to capture, how to match in layers, what to do with the payments that do not fit, and the controls an auditor will ask for. It ends with the build cost and a six-week rollout plan.
Why reconciliation breaks
- Missing or reused references. Customers pay a paybill with "INV" or their own name instead of the invoice number, or the same reference for three invoices.
- Till payments have no invoice reference. Buy Goods payments identify the till, amount, phone and time - not the invoice. Matching has to infer from those, which is why tills are harder than paybills.
- Partial payments. A customer pays half now and half later, or nets off a credit note without telling anyone.
- Charges and net amounts. Depending on the paybill or till configuration, the amount received can differ from the amount the customer sent. The gap has to be explained, not silently absorbed.
- Timing. The customer pays at 11:58 pm; the notification arrives the next morning. Settlement to the bank may land later still. A daily close that assumes same-instant cash will always have a gap.
- Reversals and duplicates. A reversed transaction, a retried webhook and a customer who paid twice all look like valid payments until someone checks.
- Several collection points. Multiple tills, paybills, bank accounts and agents, each with its own statement format.
The minimum data model
Before matching rules, get the entities right. This is the difference between a reconciliation system and a spreadsheet with formulas.
| Entity | What it holds | Why it matters |
|---|---|---|
| Payment event | Transaction code, phone, amount, paid time, account reference, till or paybill, status, raw payload | The immutable record of what arrived, from the API or statement |
| Statement line | Provider statement row, settlement date, amount, charges, balance | Reconciles the event to the money that actually settled |
| Invoice | Invoice number, customer, amount, amount paid, balance, due date | The thing being matched to |
| Match | Payment, invoice, amount applied, method, confidence, who confirmed it | Supports partial and one-to-many matches without losing history |
| Exception | Reason, owner, age, notes, resolution | Turns unmatched money into a queue with an owner, not a mystery |
| Audit event | Actor, action, before and after, timestamp | What an auditor or a fraud review will ask for |
One rule: never edit a payment event. Corrections happen through matches, adjustments and reversals, so the original record survives.
Match in layers, not with one clever rule
Production reconciliation is a hierarchy. Each layer is cheaper and more certain than the next; only the uncertain layers need a human.
- Duplicate check. If the transaction code already exists, stop. This is not a match; it is a retry, a double webhook or a genuine double payment, and it needs its own handling.
- Exact reference and exact amount. One open invoice, matching reference, matching amount. Auto-match. This is the layer to optimise; every payment that lands here is free.
- Exact reference, partial amount. Apply what arrived, keep the balance open, flag the invoice as partially paid. Do not close it.
- No usable reference: phone, amount and date window. Find open invoices for that phone number. Auto-match only if exactly one candidate fits amount and date. If there are two, suggest, do not guess.
- Fuzzy narration or name. Suggest candidates to a human with the evidence. Never auto-match on a name alone.
- Exception queue. Everything else. Assigned, aged and reviewed.
The threshold between "auto" and "suggest" is a business decision, not a technical one. A wrong auto-match is worse than a manual one: it hides the error inside a closed invoice.
What the M-Pesa APIs give you
Daraja exposes the pieces you need, but each covers a different flow:
- C2B for paybill and till payments, with validation and confirmation callbacks. Confirmation is your payment event; treat the callback as at-least-once delivery and deduplicate on the transaction code.
- STK Push (Lipa na M-Pesa Online) when the business initiates a payment request from an invoice, a chat or a checkout. The callback confirms success or failure; timeouts are common and must be resolved with a status query, not by retrying blindly.
- Transaction Status to resolve a payment whose callback never arrived.
- Reversal for correcting a wrong payment, subject to the provider's rules and your approvals.
- Statements as a fallback and as a control: the API tells you what was notified, the statement tells you what settled.
Two engineering rules prevent most incidents. First, every inbound callback is stored raw before processing, so you can replay it. Second, every state change is idempotent on the transaction code, so a retry cannot double-apply a payment.
Settlement, float and the three-way check
A payment notification is not cash in the bank. Paybill and till collections settle according to your arrangement with the provider and your bank; the timing is not the same for every business. Confirm your own settlement schedule rather than assuming next-day.
Reconcile three layers daily:
- Payment events against invoices - the customer-level match.
- Payment events against the M-Pesa statement - did everything we recorded actually happen, and is anything missing?
- M-Pesa float against the bank settlement - did the money reach the bank, net of charges?
Most teams do the first and skip the other two, then discover a gap at month end that takes a week to explain. The three-way check is what makes the numbers trustworthy.
The exception queue is the product
An auto-match rate of 65% sounds poor until you see what the other 35% contains. Design for it:
- Reason codes: no reference, partial, overpayment, duplicate, reversed, unknown payer, amount mismatch, unapplied credit.
- Owner and SLA: each reason has a person and a target - same day for high value, 48 hours for the rest.
- Suggested action: the system proposes the likely invoice and the evidence; the human confirms.
- Aging: anything over seven days escalates. Unreconciled cash should be uncomfortable, not normal.
- Customer contact: a one-click request for the invoice reference, sent on the same channel the customer used.
Controls an auditor will ask for
- Segregation of duties: the person who matches payments should not be the only person who can create or edit invoices.
- Maker-checker on manual matches above a threshold, write-offs and reversals.
- No autonomous write-off. The system can suggest; a human approves.
- Immutable audit trail of who matched what, when, and on what evidence.
- Daily close with a signed-off summary: collected, matched, exceptions, unreconciled value.
- Retention of payment records and audit events according to your auditor and KRA requirements.
- Data protection: phone numbers are personal data under the Kenya Data Protection Act 2019; minimise, restrict access and set retention.
What it costs to build
Reconciliation is an automations and integrations build: workflows plus the connections to M-Pesa and your accounting system.
| Line | Cost |
|---|---|
| Automations & Integrations build | $1,900 |
| Two extra integrations ($650 each) | $1,300 |
| Care plan, 12 months at $250 | $3,000 |
| Year one, excluding software | $6,200 |
| Same, with annual prepay (two months free) | $5,700 |
Software and API usage sit on your accounts at cost. If you also want payment initiation by STK Push, that is part of the same build; if you want a customer-facing WhatsApp flow on top, that is an NLP and voice agent build at $5,200 plus $1,200 for an extra channel.
The payback math
Assume 2,500 payments a month, seven minutes of manual matching each, and a loaded finance cost of KES 600 an hour. That is about 291 hours a month. If the system auto-matches 65% and the rest are faster because they arrive with evidence, assume 190 hours saved - about KES 114,000, or $880 at KES 129 to the dollar.
Net of the $250 care plan, that is roughly $630 a month against a $3,200 build: about five months to pay back. At 1,000 payments a month, the saving barely covers the care plan, and the case has to rest on error reduction and faster closing rather than headcount alone.
Use your own numbers. The formula is: payments × minutes saved ÷ 60 × loaded hourly cost, minus care and software, against the build cost. If it does not clear the care plan, fix the reference discipline first.
Six-week rollout
- Week 1 - data audit. Pull three months of statements and payments. Measure how many have a usable reference, how many are partial, and how long exceptions currently take.
- Week 2 - matching rules. Agree the hierarchy, tolerances, auto-match thresholds and exception reasons with finance, not just IT.
- Weeks 3-4 - build. Callbacks, storage, matching engine, exception queue, audit log, accounting integration.
- Week 5 - parallel run. Run alongside the manual process. Every disagreement is a rule to fix or a data problem to document.
- Week 6 - cutover. Turn on auto-match for the confident layers, keep manual review for the rest, and start the daily close.
Measure these six numbers
- Auto-match rate: the share of payments matched without a human.
- Exceptions per 1,000 payments: the real quality metric.
- Days to close: from month end to signed-off reconciliation.
- Unreconciled value and aging: how much is unmatched, and for how long.
- Duplicate and reversal rate: early warning of process or fraud issues.
- Cost per payment reconciled: finance time plus software, divided by volume.
What automation cannot fix
If customers do not know the invoice reference, if tills are shared across three businesses, or if invoices are raised after payment, no matching engine will be accurate. Fix the reference instruction on the invoice, use a dedicated paybill per entity, and require an invoice before collection. Automation amplifies a clean process and exposes a messy one.
Frequently asked questions
Do we need to change our paybill or till?
Not usually. The build reads callbacks and statements from your existing setup. A dedicated paybill per entity helps matching but is an operational choice, not a technical requirement.
Can it post matches into our accounting system?
Yes, if the accounting system has an API or a supported import. That integration is part of the build and should be tested in the parallel run.
What happens when a customer pays twice?
The duplicate is detected by transaction code and amount, moved to exceptions, and resolved by refund or credit note with approval. The system should never silently apply the second payment to another invoice.
Is the transaction code enough to prevent duplicates?
Yes for the same provider and transaction. Store it as a unique key, and keep the raw callback so a retry can be replayed safely.
How long does it take?
About six weeks for a single paybill or till and one accounting system, assuming the statements and API access are available in week one.
Next step
Bring three months of M-Pesa statements, your invoice list and the name of your accounting system. We will measure your current auto-matchable share before quoting, because that number decides whether the project pays for itself.
See services and pricing for what the build includes, or read what AI automation costs in Kenya for the wider budget.