How to Integrate M-Pesa with Your ERP System in Kenya (ERPNext & Odoo)
Picture your finance team at 5pm on a Thursday. Somewhere in Nairobi, a staff member is hunched over a phone, cross-referencing M-Pesa confirmation SMS messages against a sales log, manually matching each transaction to an invoice. It takes two hours every day. When they miss something, and they do, a customer gets a reminder for an invoice they already paid. That customer calls, frustrated. Someone spends twenty minutes finding the error, apologising, and fixing it. Multiply that across a week, a month, a year.
Now consider that every single one of those two hours, every one of those frustrated calls, every one of those manual matching errors is avoidable. Not by hiring more staff. Not by building a new process. By integrating M-Pesa directly into the ERP system that is already managing your invoices.
This guide covers exactly how that integration works, what you need to set it up, how it behaves differently in ERPNext versus Odoo, and the specific ways it changes daily life for your finance team, your cashiers, and your customers.
Why M-Pesa Integration with Your ERP Is Non-Negotiable in 2026
M-Pesa processes over KES 35 trillion in transactions annually in Kenya. Over 30 million Kenyans use it every month. For most retail, wholesale, and service businesses in Kenya, it is not just a payment method. It is the payment method. Your customers pay by M-Pesa. Your suppliers expect to be paid by M-Pesa. Your staff expects to be paid by M-Pesa.
And yet, the majority of Kenyan businesses in 2026 are still managing M-Pesa payments in exactly the way they managed them in 2015: a till number on the wall, manual SMS confirmation checking, end-of-day reconciliation against a cashbook, and a weekly catch-up where someone tries to match transactions that have been sitting unreconciled for days.
When M-Pesa lives outside your ERP, you have a gap in your financial data that causes real problems. Payments go missing. Invoices appear unpaid when they are not. Cash flow reporting is delayed. Fraud is harder to detect because there is no automatic three-way match between the sale, the invoice, and the payment. And when KRA validates your eTIMS income records against your actual payment data, unreconciled M-Pesa transactions create discrepancies that attract audit queries.
Integrating M-Pesa with your ERP closes that gap permanently. Aqiq Solutions includes M-Pesa integration as a standard part of every ERPNext implementation for Kenyan businesses, because a Kenyan ERP without M-Pesa integration is simply incomplete.
Understanding the Three Types of M-Pesa Integration
Before getting into how integration works within ERPNext and Odoo specifically, it is important to understand the three main M-Pesa API flows, because each one serves a different business purpose and your ERP may use one, two, or all three depending on your operation.
STK Push Most Common
Your ERP or POS sends a payment prompt directly to the customer’s phone. The customer sees a pop-up requesting them to enter their M-Pesa PIN to confirm the exact invoice amount. No manual entry of till or paybill numbers, no risk of wrong amounts. The confirmation comes back to your system automatically via a callback URL.
Best for: Retail, restaurants, high-volume sales countersC2B (Customer to Business) Paybill & Till
The customer initiates the payment themselves by entering your Paybill or Till number, an account reference (usually the invoice number), and the amount. Your ERP receives a webhook notification from Safaricom and automatically matches the payment to the correct invoice using the account reference.
Best for: Wholesale, B2B invoicing, recurring payments, servicesB2C (Business to Customer) Outgoing
Your ERP triggers a payment disbursement from your M-Pesa business account directly to a recipient’s phone number. Used for paying suppliers, employee wages, refunds, or any outgoing payment that you want processed automatically through the system without manual M-Pesa transfers.
Best for: Supplier payments, payroll, refunds, agent disbursementsFor most Kenyan retail and wholesale businesses, the STK Push and C2B flows are the most immediately valuable. The STK Push transforms the checkout experience. C2B handles the paybill-based payments that B2B customers prefer. B2C becomes critical once you want to automate outgoing payments to suppliers or staff without anyone manually initiating M-Pesa transfers.
Safaricom rolled out Daraja API 3.0 in late 2025 and stabilised it in early 2026. The update brings stronger capacity and faster onboarding, along with a cleaner developer portal at developer.safaricom.co.ke. If you integrated M-Pesa before 2026, it is worth confirming with your implementation partner that your setup is running on current API specifications. Aqiq Solutions ensures all integrations are built and maintained against the current Daraja documentation.
What You Need Before Integration Can Begin
Before your technical partner can start the integration work, certain prerequisites must be in place on the business side. Missing any of these will delay the process, sometimes significantly.
M-Pesa Paybill or Till Number
You need a registered M-Pesa business account with Safaricom. A Till Number (Buy Goods) is easier to get and good for in-person retail. A Paybill Number is better for invoice-based reconciliation because it supports account references. Apply at any Safaricom shop or through the Safaricom Business Portal. Bring your business registration documents, KRA PIN, CR12 (for companies), and your bank letter.
Daraja API Credentials
Register at developer.safaricom.co.ke to get your Consumer Key, Consumer Secret, and for STK Push, your Passkey. The Daraja registration requires your Paybill or Till number. Approval typically takes one to two weeks once all documents are submitted correctly. Your implementation partner should be registered on Daraja as a developer to assist with this.
Head Office Account (for Daraja API)
For direct API integration beyond basic till usage, your Paybill needs to be upgraded to a Head Office account with bank settlement. This requires a bank letter confirming your business account and a signed authorisation form. Your Safaricom account manager or business portal can initiate this process.
A Publicly Accessible HTTPS Server
The Daraja API sends payment confirmation callbacks to a URL on your server. That URL must be publicly reachable and secured with SSL (HTTPS). If your ERP is hosted on Frappe Cloud or a managed cloud server, this is already handled. If it is self-hosted, your IT setup must support a live HTTPS endpoint before integration can go live.
Businesses frequently start the ERP implementation and assume M-Pesa integration is plug-and-play. It is close, but the Safaricom documentation and approval process has its own timeline. Start the Daraja application and Paybill/Head Office setup in parallel with your ERP implementation, not after it. A week’s delay in Safaricom approval becomes a week your system is live without the integration working.
How M-Pesa Integration Works in ERPNext
ERPNext has a dedicated M-Pesa integration module built specifically for the Kenyan market, available through the Frappe Mpesa Payments app, which connects directly to Safaricom’s Daraja API. Aqiq Solutions configures this as part of every ERPNext deployment in Kenya, customising it to the specific payment flows each business uses.
STK Push in ERPNext: How It Works in Practice
Once configured, the STK Push flow in ERPNext works like this. Your cashier processes a sale and generates a Sales Invoice. From the invoice or Payment Request, they enter the customer’s phone number and trigger the STK Push. Safaricom sends an instant payment prompt to that phone number. The customer enters their PIN. Safaricom confirms the transaction to ERPNext via the callback URL. ERPNext automatically marks the Payment Request as complete and creates a Payment Entry against the invoice. The invoice status changes to paid. The accounting entry is created. Everything updates in real time, with no manual step beyond the initial trigger.
For retail businesses using the ERPNext POS module, the STK Push can be initiated directly from the POS interface, making the checkout flow fast and familiar for cashiers.
C2B Paybill Integration in ERPNext
For B2B customers who prefer paying via Paybill, ERPNext’s C2B integration works through registered callback URLs. When a customer makes a payment to your Paybill number and enters an account reference, Safaricom sends a webhook notification to ERPNext. The system uses the account reference to automatically identify the matching Sales Invoice or Customer record and creates a payment entry against it.
ERPNext has an Auto Reconcile C2B Payments option. When this is enabled, the system applies incoming C2B payments to outstanding invoices automatically using FIFO (First-In First-Out) logic. If a customer’s payment amount matches an outstanding invoice, it reconciles automatically. If no exact match is found, the payment is held in the M-Pesa Payment Register for manual review and assignment.
For businesses with a high volume of B2B paybill payments, this saves hours of manual matching every day. The finance team sees a clean register of received payments and unmatched exceptions, rather than an inbox full of SMS confirmations to sort through.
B2C Disbursements from ERPNext
ERPNext also supports outgoing B2C payments, meaning you can initiate supplier payments, salary disbursements, refunds, or agent payments directly from the system. Navigate to the B2C Payment Disbursement using the system’s search, enter the recipient’s phone number and amount, and ERPNext triggers the transfer through the Daraja API. The payment status updates automatically when Safaricom confirms the transaction. This is particularly valuable for businesses paying many individuals, such as commission agents, delivery riders, or casual labour, where manual M-Pesa transfers would take significant time.
How M-Pesa Integration Works in Odoo
Odoo’s M-Pesa integration is handled through the payment provider module, available for Odoo 16, 17, and 18. The M-Pesa C2B Connector module handles webhook receipt and reconciliation for incoming Paybill and Buy Goods payments, while separate STK Push configurations handle customer-initiated payment prompts.
To configure M-Pesa in Odoo, navigate to Sales or Invoicing, go to Configuration, then Payment Providers, and create or select the M-Pesa provider. Enter your Consumer Key, Consumer Secret, Shortcode, and Passkey. Configure the callback URLs, test the connection in sandbox mode, and confirm the M-Pesa payment method is available on invoices and sales orders.
Odoo’s M-Pesa integration creates payment records automatically from incoming webhook data, matches payments to partners using phone number hashing, and posts payments to the correct journal. A reconciliation wizard handles bulk assignment of payments that could not be automatically matched, allowing your finance team to process exceptions in batches rather than one by one.
Odoo also supports multiple Paybill or Till numbers within a single instance, which is useful for businesses operating under multiple brands or across different company entities within the same Odoo database.
It is worth noting that Odoo’s M-Pesa modules vary in quality and completeness across different marketplace vendors. Aqiq Solutions evaluates and configures the most appropriate Odoo M-Pesa module for each client’s specific payment flows, ensuring proper callback handling, error logging, and reconciliation logic before the system goes live.
ERPNext vs Odoo for M-Pesa Integration: A Direct Comparison
| Factor | ERPNext | Odoo |
|---|---|---|
| Native M-Pesa module availability | Dedicated Frappe Mpesa Payments app, built for Kenya | Available via Odoo App Store (quality varies by vendor) |
| STK Push support | Yes — from Sales Invoice or POS | Yes — via payment provider configuration |
| C2B Paybill integration | Yes — with auto-reconciliation option | Yes — with reconciliation wizard |
| B2C outgoing payments | Yes — supplier, payroll, refund disbursements | Limited — depends on module version |
| POS integration | Yes — STK Push from POS interface | Yes — configurable per POS session |
| Offline fallback | System supports offline POS, M-Pesa requires internet | Same constraint — Daraja API requires connectivity |
| Multi-company / multi-shortcode | Yes | Yes — supported in C2B Connector |
| Automatic accounting entry creation | Yes — payment entry auto-created on confirmation | Yes — journal entry created automatically |
| Software licensing cost | Zero — open-source, no per-user fee | Enterprise license required for advanced features |
| Local Kenya support | Yes — Aqiq Solutions, Kenya-based | Limited local implementation partners |
For most Kenyan businesses, ERPNext’s M-Pesa integration delivers more depth out of the box, especially the B2C disbursement capability and the built-for-Kenya design of the Frappe Mpesa Payments module. Odoo’s integration is solid for businesses already on the Odoo platform, but the module ecosystem requires more careful selection and configuration to get the same reliability.
The Step-by-Step Integration Process
Here is the actual sequence that Aqiq Solutions follows when integrating M-Pesa with a client’s ERP system in Kenya. This is what the technical process looks like end to end.
-
Confirm Safaricom Business Credentials Are Ready
Before any code is written, confirm that the business has a registered M-Pesa Paybill or Till number, has completed the Head Office account upgrade for Daraja API access, and has valid Daraja API credentials: Consumer Key, Consumer Secret, and Passkey. If any of these are missing, this step must be completed first. Do not skip it, as it is the most common cause of delayed go-live dates for M-Pesa integrations in Kenya.
-
Configure M-Pesa Settings in the ERP
In ERPNext, create an M-Pesa Settings record with your Consumer Key, Consumer Secret, Passkey, and Business Shortcode. Set the environment to Sandbox first, never Production during initial setup. Link the settings to the correct company and assign the appropriate Mode of Payment. In Odoo, navigate to Payment Providers and configure the M-Pesa provider with the same credentials.
-
Register Your Callback URLs with Safaricom
The Daraja API needs to know where to send payment confirmations. In ERPNext, open the C2B Payment Register, link it to your M-Pesa Settings, and save. The system registers your callback URLs with Safaricom automatically. The register status should update to “Success.” In Odoo, configure the webhook and callback URLs in the payment provider settings and test the registration. Your server must be live, publicly accessible, and SSL-secured for this step to succeed. A callback URL that is not reachable by Safaricom’s servers will cause all payment confirmations to fail.
-
Test Thoroughly in Sandbox Mode
With sandbox credentials active, simulate multiple transaction types. Test an STK Push from a Sales Invoice. Test a C2B payment with a matching account reference. Test a payment with a mismatched reference to confirm the exception handling works correctly. Test a failed payment (wrong PIN, cancellation, timeout) to confirm the system handles it gracefully without hanging or creating incorrect entries. Log all results and fix issues before proceeding.
-
Switch to Production and Test with Small Live Transactions
Once sandbox testing is clean, update the M-Pesa Settings to Production mode and enter your live Daraja credentials. Re-register the callback URLs against the production environment. Run three to five live test transactions with small amounts: KES 10 is sufficient. Confirm that the STK Push reaches a real phone, the confirmation comes back to the ERP, the invoice is marked paid, and the accounting entry is correct. Only after all of this passes should you train staff and go live fully.
-
Train Staff and Set Up Reconciliation Workflows
Cashiers need to know how to trigger the STK Push from the POS or invoice. Finance staff need to know how to monitor the M-Pesa Payment Register, review unmatched payments, and perform manual reconciliation when automatic matching does not find a corresponding invoice. Set up a daily reconciliation review as part of the closing process for the first few weeks, then review whether the frequency can be reduced as confidence in the system builds.
What Happens When the Integration Works: The Real Business Impact
The daily reality of a properly integrated M-Pesa ERP setup in Kenya is significantly different from what most businesses experience today. Here is what changes.
For the cashier, the process becomes frictionless. They enter the sale, select M-Pesa as payment, enter the customer’s phone number, and press send. Within seconds, the customer’s phone prompts them for their PIN. The customer confirms. The cashier’s screen shows the invoice as paid. No asking to see the customer’s phone. No reading out an SMS message. No risk of accepting a fake confirmation screenshot. The payment is verified directly by Safaricom’s servers before the invoice ever closes.
For the finance team, the morning reconciliation goes from two hours to twenty minutes. Incoming Paybill payments have already been matched to invoices automatically overnight. The team reviews the small number of exceptions where the account reference was blank or incorrect, assigns them manually, and moves on. The accounts receivable ledger is accurate before 9am rather than after lunch.
For the business owner, the cash flow picture is real-time. The dashboard shows collections by payment method, live. There is no lag between a customer paying and that payment appearing in the financial reports. And because every M-Pesa transaction flows through the same ERP accounting module as every other payment, the month-end close is clean, the VAT figures are accurate, and the eTIMS income records match the financial statements because they are generated from the same source.
Common M-Pesa ERP Integration Errors and How to Fix Them
- Callback URL not receiving data from Safaricom. The most common cause is that the callback URL is not publicly accessible, is not HTTPS, or is being blocked by a firewall. Verify that the URL is reachable from outside your network, that your SSL certificate is valid and not expired, and that no server-level firewall is blocking incoming requests from Safaricom’s IP ranges. Test the URL independently before blaming the Daraja configuration.
- STK Push sent but no confirmation received. This usually means the callback URL failed to receive Safaricom’s response after a successful transaction. Implement a reconciliation check using the STK Push Query API or Transaction Status API to look up pending transactions after a timeout of five minutes. Never treat the absence of a callback as a failed payment without querying the transaction status first, as the customer may have paid successfully.
- C2B payments not matching invoices automatically. This happens when the customer enters an account reference that does not match any invoice number or customer identifier in the system. The most reliable fix is to train customers and staff to always use the exact Sales Invoice number as the account reference when making Paybill payments. You can also print the Paybill number and the invoice reference clearly on every invoice PDF.
- Daraja API credentials rejected in production. Sandbox and production environments use different credentials. Ensure you have switched the ERP settings to Production mode and entered the production Consumer Key, Consumer Secret, and Passkey. The production Passkey is different from the sandbox one and is sent to your registered developer email after go-live approval.
- Duplicate payment entries being created. This can happen if the callback is delivered more than once by Safaricom (which occasionally occurs on network retries). Your integration must implement idempotency checks, meaning the ERP verifies whether a payment with the same transaction ID already exists before creating a new entry. ERPNext’s M-Pesa module handles this, but custom implementations must build this check explicitly.
- STK Push working in sandbox but failing in production. Often caused by a mismatch between the Paybill number registered in the ERP settings and the one on your Safaricom production account. Confirm the Business Shortcode entered in production mode exactly matches your live Paybill or Till number, with no extra spaces or incorrect digits.
Do You Need a Technical Partner for M-Pesa ERP Integration?
The honest answer is yes, for almost every business. Not because the integration is conceptually complex, but because the number of configuration details that can go wrong is high, and the cost of a flawed integration showing up in your financial records is significant.
A Safaricom approval process that takes longer than expected, a callback URL that silently fails on one in ten transactions, an auto-reconciliation logic that misassigns payments to the wrong customer account, these are all real issues that are difficult to detect in testing and deeply disruptive when they surface in production.
Aqiq Solutions includes M-Pesa integration as a standard component of every ERPNext implementation in Kenya. The team manages the Daraja configuration, sandbox testing, production go-live, callback URL verification, reconciliation workflow setup, and staff training as part of the same project. Post-implementation support means that if a Safaricom update changes API behaviour or a credential expires, there is a local team in Kenya that you can call who already knows your setup.
For retail businesses, the POS-level STK Push integration is a priority. For wholesale and distribution businesses, the C2B Paybill auto-reconciliation typically delivers the most immediate value. For businesses with complex outgoing payment needs, such as large supplier bases or agent networks, the B2C disbursement flow becomes the critical piece.
Want to see exactly what M-Pesa integration looks like in ERPNext or Odoo for your specific business? Aqiq Solutions offers a free session to walk through the flows, the requirements, and what the daily experience looks like for your team.
Book a Free Integration SessionFrequently Asked Questions: M-Pesa ERP Integration in Kenya
Can ERPNext integrate with M-Pesa in Kenya?
Yes. ERPNext has a dedicated M-Pesa integration module through the Frappe Mpesa Payments app, built specifically for the Kenyan market and Safaricom’s Daraja API. It supports STK Push (customer-to-business payment prompts), C2B Paybill and Till Number payments with automatic reconciliation, and B2C outgoing payments to suppliers, employees, or agents. Aqiq Solutions configures M-Pesa integration as a standard part of every ERPNext implementation in Kenya.
What is the difference between STK Push and C2B M-Pesa integration for ERP?
STK Push is initiated by your ERP system. When a cashier processes a sale, the system sends a payment prompt directly to the customer’s phone. The customer enters their PIN and the confirmation flows back to the ERP automatically. C2B is initiated by the customer. They go to their M-Pesa menu, enter your Paybill number and an account reference (usually the invoice number), and the payment. Your ERP receives a webhook notification from Safaricom and matches the payment to the correct invoice. STK Push is better for retail and high-volume checkout. C2B is better for B2B invoicing where customers pay on their own timeline.
How long does M-Pesa ERP integration take?
The technical configuration and testing typically takes one to two weeks once all Daraja credentials are in place. The most common cause of delays is the Safaricom account setup process, specifically obtaining a Paybill Head Office account and Daraja API approval, which can take one to two weeks depending on how quickly documents are submitted and approved. Starting the Safaricom process at the same time as your ERP implementation, rather than after it, avoids this becoming a bottleneck.
Does M-Pesa integration with ERPNext work for multi-branch businesses?
Yes. ERPNext supports multiple company and branch configurations, and the M-Pesa integration can be set up with separate Paybill or Till numbers for different branches or business entities within the same system. Each branch’s M-Pesa receipts are recorded against the correct company and accounting entity. Consolidated reporting across branches is available from the same dashboard.
Can M-Pesa payments reconcile automatically in ERPNext?
Yes. ERPNext has an Auto Reconcile C2B Payments option. When enabled, incoming Paybill payments are automatically matched to outstanding Sales Invoices or Customer accounts using the account reference the customer entered when making the payment. Payments that cannot be automatically matched are held in a Payment Register for manual review. This eliminates the manual matching process that most Kenyan finance teams currently perform every morning.
What documents do I need to get M-Pesa Paybill and Daraja API access in Kenya?
For a company, you typically need your Certificate of Incorporation, CR12, KRA PIN certificate, a bank letter confirming your business account, and the completed Safaricom Business application forms. For a sole trader, requirements are simpler but you may still need business registration documentation. Name matching between KRA, bank, and Safaricom documents is critical. Mismatched names are one of the most common causes of application delays. Your implementation partner can advise on the current Safaricom requirements at the time of your application.
Does Odoo support M-Pesa integration for businesses in Kenya?
Yes. Odoo has M-Pesa payment provider modules available for Odoo 16, 17, and 18. The M-Pesa C2B Connector handles Paybill payment receipt and reconciliation. STK Push is available through the payment provider configuration. The quality and completeness of these modules varies across Odoo App Store vendors, so working with an implementation partner who can select and configure the right module for your specific payment flows is important. Aqiq Solutions evaluates and configures M-Pesa integration for both ERPNext and Odoo deployments in Kenya.
What happens if the internet goes down during an M-Pesa transaction in my ERP?
The Daraja API requires internet connectivity for STK Push and C2B webhook processing. If internet is unavailable at the point of transaction, the STK Push cannot be initiated. A fallback option is to use a physical Till Number displayed at the counter, where the customer pays manually via the M-Pesa menu and the cashier confirms the payment by checking the SMS before processing the sale. ERPNext’s POS module supports offline mode for the core sale but M-Pesa payment confirmation will queue until connectivity is restored. For areas with unreliable internet, a backup payment process should always be defined and communicated to staff.
Can I use M-Pesa integration to pay suppliers automatically from ERPNext?
Yes. ERPNext’s B2C integration allows outgoing payments from your M-Pesa business account directly to a recipient’s phone number. You can initiate supplier payments, agent disbursements, refunds, or payroll payments from within the system. The payment is triggered via the Daraja B2C API, and the confirmation updates automatically in your accounts payable ledger. This requires that your M-Pesa Paybill account has sufficient float and the correct B2C permissions enabled on your Daraja account.
Is M-Pesa integration included when Aqiq Solutions implements ERPNext in Kenya?
Yes. Aqiq Solutions includes M-Pesa integration as a standard component of every ERPNext implementation for Kenyan businesses. The scope covers Daraja API configuration, STK Push and C2B setup, sandbox and production testing, reconciliation workflow configuration, and staff training. Post-implementation support means the team is available if Safaricom changes API behaviour or credentials need to be refreshed. Book a free session to discuss your specific M-Pesa integration requirements.
The Bottom Line: M-Pesa Should Flow Into Your ERP, Not Around It
Every M-Pesa payment that goes unrecorded, manually matched, or entered twice represents a real cost to your business. Not a theoretical risk. A real, daily drain on finance staff time, a real source of errors in your accounts, and a real gap in the data that your ERP is supposed to give you visibility over.
The businesses in Kenya that are running tightly in 2026 are not doing so because they have more staff. They are doing so because their systems do the heavy lifting. A properly integrated M-Pesa ERP setup means your cashier can focus on serving the customer. Your finance team can focus on analysis rather than data entry. And you, as the business owner, can look at a dashboard that actually reflects what happened in your business today, not what someone managed to compile by end of week.
Aqiq Solutions builds M-Pesa ERP integration for businesses across Kenya, from single-outlet retail shops to multi-branch wholesale operations, from professional services firms to manufacturers with complex supplier payment needs. The starting point is always a conversation about your specific payment flows and where the current friction is costing you the most.
Ready to stop matching M-Pesa payments manually and start running your finances from one connected system? Book a free session with Aqiq Solutions and see what M-Pesa integration looks like for your business.
Book Your Free Session