Blog β€Ί Operations

M-Pesa Reconciliation: How to Automate Matching Till and Paybill Payments to Invoices (2026)

Automation Updated 2026-10-20 Β· 7 min read
M-PESA and Equity agent shop front in Kenya

Photo: M-PESA mobile money and Equity agent, Nairobi, Kenya by wrcomms, CC BY-SA 2.0. Cropped.

M-Pesa reconciliation is the process of matching every M-Pesa payment you receive on your till or paybill to the right customer, invoice or order, and recording it in your books. Done by hand from statements it takes hours and misses errors. Automated through Safaricom's Daraja API, each payment arrives in your system within seconds, is matched using the account number, phone number and amount, and posts to your accounting software, with only exceptions left for a person to review.

Key takeaways

Why manual M-Pesa reconciliation breaks down

For a small shop with twenty payments a day, scrolling through SMS confirmations works. For a school with 800 families, a distributor with 300 retailers, a SACCO, a property company collecting instalments or an online store, it doesn't. The typical manual process:

  1. Download the M-Pesa statement from the M-Pesa portal (or worse, read SMS messages).
  2. Open the invoice list or student fee register in Excel.
  3. Match each payment by name, phone or account number, often guessing.
  4. Update balances, issue receipts and post entries in the accounting system.
  5. Chase the unidentified payments: "Who paid KES 15,000 from 0722 xxx xxx with account 'fees'?"

It takes hours, errors are common, and customers who've paid still get reminders, which damages trust. Meanwhile management never has an up-to-date view of collections.

How automated M-Pesa reconciliation works

Automation uses Safaricom's Daraja API:

Your system receives each payment, applies matching rules, updates the customer's balance or order, sends a receipt by SMS or WhatsApp, and posts to accounting. All of it happens within seconds.

Matching rules that actually work

Automatic matching is only as good as the rules. A robust setup checks in order:

  1. Exact account reference: paybill account number equals an invoice number, admission number, plot number or customer code. This is the most reliable, so design your references to be unique, short and easy to type.
  2. Known phone number: the paying phone number belongs to a single customer with an open balance.
  3. Fuzzy reference matching: common typos (an extra space, "INV-0123" vs "INV123", letter O vs zero) resolved automatically.
  4. Amount and timing: a payment exactly equal to an open invoice from a likely customer, flagged for one-click confirmation.
  5. Exceptions queue: everything else goes to a person with suggestions, never silently dropped.

With good references, most organisations see the large majority of payments matched automatically. The rest are handled in minutes instead of hours.

Handling the messy cases

CaseHow the system should handle it
Wrong or missing account numberTry phone and amount matching. Otherwise queue for review with suggestions.
Partial paymentApply to the invoice and show the remaining balance. Send a receipt with the balance.
OverpaymentHold as credit on the account or apply to the next invoice, per your policy.
One payment for several invoicesAllocate oldest first, or as the customer instructs.
Someone else paying (parent, employer, relative)Match by account reference. Optionally link the payer's number to the customer.
Duplicate callbacksDeduplicate by M-Pesa receipt number. Never count a transaction twice.
ReversalsRecord the reversal and reopen the invoice balance.
Missed callback (system downtime)Daily statement import or status queries to catch anything missed.

Till or paybill: which is better for reconciliation?

A Buy Goods till is simple for walk-in retail, but customers can't enter an account reference, so matching relies on phone numbers, amounts and timing. A paybill lets customers enter an account number, which makes automatic matching far more reliable. For schools, landlords, property developers, SACCOs, distributors with credit accounts and any business sending invoices, a paybill is usually the right choice. For e-commerce and invoice links, STK Push is best of all: the system knows exactly which order each payment belongs to.

Merchant fees differ by product and agreement, with reported figures ranging roughly from 0.55% to 1.5% for collections and paybill tariffs negotiated with Safaricom, so confirm current charges directly with Safaricom.

Syncing with accounting and KRA requirements

Matched payments should flow into your accounting software (QuickBooks, Xero, Zoho Books, Sage or your ERP) as receipts against the right customer and invoice, with the M-Pesa receipt number as reference. This gives you:

Keep raw callback data stored securely and unchanged, so you can always prove what was received.

Who benefits most?

Building the integration: step by step

  1. Get a paybill (or till) in the business name and access to the M-Pesa organisation portal.
  2. Register on the Daraja portal, create an app and develop against the sandbox.
  3. Register C2B URLs (validation and confirmation) and implement the STK Push callback if needed. Use HTTPS and verify incoming requests.
  4. Design account references and communicate them clearly to customers.
  5. Implement matching rules, receipts, and the exceptions queue.
  6. Add the daily safety net: statement import or status checks to catch missed callbacks.
  7. Connect accounting and dashboards.
  8. Go live with Safaricom's production approval, then monitor closely for the first weeks.

Developers commonly build this in PHP, Python, Node.js or similar. The code itself is not the hard part. Reliable handling of edge cases, security and monitoring is.

Security essentials

What results to expect

Organisations that automate reconciliation typically cut reconciliation time from hours a day to minutes, issue receipts instantly, stop "I paid but it's not reflecting" calls, and get a live view of collections on their dashboard. Collection rates often improve too, because accurate balances make reminders trustworthy. See custom business dashboards for how collections data fits into the bigger picture.

Example: a land company collecting instalments

Picture a land company selling plots on 12-month payment plans to 600 buyers, many in the diaspora. Before automation, two staff spent most of each day matching paybill payments to buyers using an Excel register, and buyers waited days for receipts. After automation, buyers pay using their plot number as the account reference. Each payment updates the buyer's balance within seconds, a WhatsApp receipt shows the amount paid and the balance remaining, and reminders go out automatically before each due date. Payments with wrong references, usually relatives paying for someone else, land in an exceptions queue that takes minutes to clear. Management sees collections, arrears and expected inflows live.

Next step

Count how many hours your team spends each week matching M-Pesa payments, and how many payments end up unidentified. That's the size of the opportunity. If you'd like reconciliation automated with your own paybill, invoices and accounting system, ask for a free 7-day prototype.

Frequently asked questions

How do I reconcile M-Pesa payments automatically?
Use Safaricom's Daraja API so each C2B or STK Push payment is sent to your system in real time, then match it by account reference, phone number and amount, issue a receipt and post it to your accounting software, with exceptions queued for review.
What is the Daraja API?
Daraja is Safaricom's developer platform for integrating M-Pesa into software. It provides APIs for STK Push, C2B payments, B2C payouts, transaction status and account balance queries.
Is paybill or till better for reconciliation?
A paybill is better for reconciliation because customers enter an account number, such as an invoice or admission number, that allows reliable automatic matching. STK Push is best for online checkouts.
What happens when a customer uses the wrong account number?
A good system tries phone number and amount matching first, then sends unmatched payments to an exceptions queue with suggestions, so a person can match them quickly.
Can M-Pesa payments sync with QuickBooks or Xero?
Yes. Matched payments can be posted automatically to accounting software such as QuickBooks, Xero, Zoho Books or Sage as receipts against the right customer and invoice.
How much does M-Pesa integration cost?
Costs include development of the integration and matching logic, hosting, and Safaricom's transaction charges, which vary by product and agreement. Confirm current tariffs with Safaricom.

Want this built for your business?

Kavenacc Digital Solutions builds custom AI dashboards, AI agents and web apps in days β€” with a free working prototype in 7 days and 100% ownership of the code.

Start My Free Prototype β†’

Written by Narkisho Nyonje β€” Founder, Kavenacc Digital Solutions. 26 years in IT & software, 50+ applications shipped, author of β€œThe Future of Work in the New AI Era” (Amazon / Barnes & Noble). Get a free 7-day working prototype of your own AI system.

Explore Kavenacc services & pricing β†’

Chat with a Real Personon WhatsApp
Get a quote WhatsApp (opens in a new tab) Call