Adding M-Pesa to Your App: What They Don't Tell You
App Development · 8 min read

Adding M-Pesa to Your App: What They Don't Tell You

M-Pesa in your app sounds simple. The reality involves Safaricom APIs, C2B charges, and a surprising amount of paperwork. Here is what you actually need to know.

Nelson

Nelson

Architect, KEPAS Technologies

February 28, 2026 · 8 min read

Last week, a school principal in Kitale called us. He had just paid a developer KES 80,000 to build a fee payment app for his school. 'It looks beautiful,' he said. 'But when parents try to pay, nothing happens. The developer says M-Pesa integration is extra — another KES 120,000.'

This happens all the time. Adding M-Pesa to an app is not a checkbox. It is a process with technical steps, business rules, and real costs that many developers do not explain up front.

It Starts with a Safaricom Business Account, Not Code

Before a single line of code is written, you need approval from Safaricom. This is the part that surprises most people.

  • You must have a registered business or organization with a certificate of incorporation (for companies) or registration certificate (for schools, NGOs).
  • You open a Safaricom Business Till or PayBill number. This is where the money will go. For a school collecting fees, a PayBill is standard.
  • You then apply for API access through the Safaricom Daraja portal. This involves submitting your business documents and describing your app's purpose.

This approval can take from a few days to a couple of weeks. You cannot test real payments until it is done.

A professional at a desk with a laptop open to the Safaricom Daraja developer portal dashboard on one screen, and physical business registration documents spread out next to the laptop. A smartphone showing an M-Pesa STK Push prompt sits nearby.
A professional at a desk with a laptop open to the Safaricom Daraja developer portal dashboard on one screen, and physical business registration documents spread out next to the laptop. A smartphone showing an M-Pesa STK Push prompt sits nearby.

The Two Ways Money Moves: STK Push vs C2B

There are two main technical methods, and the choice affects user experience and cost.

STK Push is what most people think of. The app sends a request to Safaricom, and a payment prompt pops up on the user's phone. They enter their PIN and the payment is done. It is smooth for the user but has a cost. According to Safaricom's 2024 commercial rates, businesses pay KES 0.52 for a successful STK Push transaction, plus the normal M-Pesa transfer fee from the customer.

C2B (Customer to Business) is older but still useful. The user manually enters your PayBill number and account number (like a student admission number) in their M-Pesa menu. Your app then uses another API to check if payment has arrived. This costs you, the business, nothing per transaction. The downside? It pulls the user out of your app, which increases the chance they get distracted and do not complete the payment.

KES 0.52 — The cost to a business for each successful STK Push payment, as per Safaricom's 2024 published API commercial pricing. This is on top of the transfer fee the customer pays.

For a school with 500 students paying fees each term, that is KES 260 in API costs alone. Not huge, but a real operating expense that must be budgeted for.

A spreadsheet dashboard comparing payment methods: one column for STK Push with data points for cost per transaction (KES 0.52) and completion rate (95%), and another column for C2B with cost per transaction (KES 0.00) and completion rate (78%). A line chart shows projected annual transaction costs for different user volumes.
A spreadsheet dashboard comparing payment methods: one column for STK Push with data points for cost per transaction (KES 0.52) and completion rate (95%), and another column for C2B with cost per transaction (KES 0.00) and completion rate (78%). A line chart shows projected annual transaction costs for different user volumes.

The Hidden Work: Reconciling Payments

Getting the payment is only half the job. The other half is knowing what it was for. When money hits your PayBill, you get a transaction code. Your app must reliably match that code to the right user and the right invoice in your system.

We worked with a clinic in Naivasha that learned this the hard way. Their app accepted payments but just listed them in one big pot. The finance officer spent hours each week calling patients to ask, 'Did you pay for lab tests or the consultation?'

A good integration does this automatically. When a parent pays KES 15,000 for Term 2 fees for student #123, your system should immediately mark that invoice as paid and send a receipt. This requires careful design from the start.

Side-by-side comparison: On the left, a finance officer looks stressed, surrounded by printed M-Pesa statements and a notebook, manually highlighting rows. On the right, a clean monitor screen shows an automated reconciliation dashboard with payments matched to student names and invoice descriptions, all marked green.
Side-by-side comparison: On the left, a finance officer looks stressed, surrounded by printed M-Pesa statements and a notebook, manually highlighting rows. On the right, a clean monitor screen shows an automated reconciliation dashboard with payments matched to student names and invoice descriptions, all marked green.

A Realistic Look at Cost and Time

If a developer gives you a quote for 'an app with M-Pesa,' ask them to break it down. The core app and the payment integration are two different pieces of work.

  • API Integration: This is the technical work of connecting to Safaricom's systems, handling the payment flow, and securing the communication. For a standard integration, a competent developer needs 5-10 working days.
  • Business Logic: This is the custom work for your needs—linking payments to student accounts, updating fee balances, generating receipts. This depends entirely on how complex your system is. A simple one might take a week; a complex one for a hospital with different departments could take a month.
  • Testing & Safaricom Approval: Budget at least another week for rigorous testing with real money (in small amounts!) and for the final Safaricom approval process.

A fair budget for a solid, well-integrated M-Pesa system in an existing app starts from around KES 80,000 and goes up based on complexity. If a quote seems too good to be true, it probably means they are cutting corners on security or reconciliation.

A developer at a workstation with three monitors. One monitor shows code, another shows a testing simulator with successful and failed M-Pesa transaction logs, and a third shows a project management timeline with phases marked: 'Safaricom API Setup', 'Payment Logic', 'Testing', 'Go-Live'.
A developer at a workstation with three monitors. One monitor shows code, another shows a testing simulator with successful and failed M-Pesa transaction logs, and a third shows a project management timeline with phases marked: 'Safaricom API Setup', 'Payment Logic', 'Testing', 'Go-Live'.

What to Do Before You Talk to a Developer

1. Get your Safaricom PayBill/Till number. Do this yourself at a Safaricom Service Centre. It establishes your business identity for the process.

2. Map out your payment scenarios on paper. 'A parent pays full fees.' 'A patient pays for a drug prescription.' 'A donor makes a one-time donation.' Write down what information you need to identify each payment.

3. Ask the developer specific questions: 'Will you use STK Push or C2B?' 'How will payments be matched to accounts?' 'Can you show me a test transaction from start to receipt?' 'What is your plan for handling failed transactions?'

Adding M-Pesa is not magic, but it is also not mysterious. It is a set of technical and business steps. When done right, it turns your app from a display tool into a real working system that collects money and saves your staff time. The goal is not just to have a 'Pay with M-Pesa' button, but to have that button work reliably and make your financial tracking simpler, not harder.

A school administrator standing in a sunny school courtyard, smiling while looking at a tablet that shows a confirmed fee payment notification and a digital receipt. A parent in the background is on their phone, gesturing as if they've just completed a transaction.
A school administrator standing in a sunny school courtyard, smiling while looking at a tablet that shows a confirmed fee payment notification and a digital receipt. A parent in the background is on their phone, gesturing as if they've just completed a transaction.

The next time you discuss your app, move past 'Can we add M-Pesa?' and ask 'How will we handle the payment, the reconciliation, and the cost?' That is the conversation that leads to something that actually works on Monday morning.

Want to see what this looks like for your organization?

Talk to Us on WhatsApp
Share

Ready to Start Your Project?

Let's discuss how we can bring your digital vision to life.

Get in Touch