Digital Africa11 min read

Integrating M-Pesa Into an App in Kenya and Tanzania in 2026

Mohamed Bah·Fondateur, Kolonell
August 20, 2026
Share:
Integrating M-Pesa Into an App in Kenya and Tanzania in 2026

Integrating M-Pesa Into an App in Kenya and Tanzania in 2026

Digital Africa

The verdict in three sentences

In Kenya and Tanzania, M-Pesa is not an option, it's the default rail: without it, your app loses the majority of payments. Integration goes through Safaricom's Daraja API (STK Push to pull, C2B to receive pushes, B2C to disburse), with merchant fees around 1.5% per collection in 2026. Plan for 3 to 6 weeks between sandbox access and validated production, with most of the time spent handling callbacks and timeouts.

The Daraja APIs and what they do

Safaricom exposes several endpoints via the Daraja platform. Each covers a distinct business flow: collecting from a customer, receiving a customer-initiated payment, or disbursing funds.

Daraja APIUseFlow directionTypical case
STK Push (Lipa na M-Pesa Online)App collectionApp → customer (pull)E-commerce cart payment
C2BCustomer to merchantCustomer → app (push)Paybill/Till payment
B2CDisbursementApp → customerRefund, salary, payout
B2BMerchant to merchantApp → appSupplier settlement
Account BalanceAccount balanceReadTreasury dashboard
Transaction StatusStatus checkReadReconciliation

In Tanzania, M-Pesa is operated by Vodacom on its own platform (often via an aggregator), but the STK Push / C2B / B2C logic is the same. Expect separate credentials and environments per country.

Fees and limits: 2026 ballpark

Fees vary by merchant account type (Paybill vs Till) and are negotiable by volume. The figures below are a 2026 estimate to confirm with your Safaricom account manager.

ParameterKenya (M-Pesa)Tanzania (M-Pesa TZ)
Merchant collection fee~1.5%~1.8%
Per-transaction limit250,000 KES5,000,000 TZS
Customer balance limit500,000 KES
B2C payout delayInstant to 24hInstant to 48h
Sandbox accessFreeFree
Paybill setup feeVariableVariable

Integration steps and timelines

StepDeliverableEstimated time
Daraja developer accountSandbox keys1 day
App registration + credentialsConsumer key/secret2-3 days
STK Push in sandboxTest payment OK3-5 days
Callback + timeout handlingReliable callback URL5-7 days
Go-live (real Paybill/Till)Safaricom validation1-2 weeks
C2B + B2C testsFull flows3-5 days

Need a professional website?

Kolonell builds websites that attract clients, optimized for the Sénégalese market. Free quote in 2 minutes.

The critical point: the callback. STK Push returns the result asynchronously. Without a reliable public HTTPS callback URL and Transaction Status reconciliation as a backup, you'll leave payments in an "unknown" status.

Mini case study

Grace, founder of an invoicing SaaS in Nairobi, collects 1,200 subscriptions at 900 KES/month, or 1,080,000 KES in monthly revenue. At 1.5% M-Pesa fees, she pays 16,200 KES/month in commissions, about ~194,400 KES/year. By automating retries via STK Push on failed payments (timeouts included), she recovers 8% of initially lost transactions, roughly ~86,000 KES/month in additional revenue — far more than the cost of fees.

FAQ

Do you need a local company to get a Paybill account? Yes, in Kenya an M-Pesa merchant account requires a registered entity and a local bank account. Plan for a few days to two weeks depending on documents.

Is the Daraja sandbox free? Yes, developer access and the sandbox are free. Fees only appear in production, on real transactions (~1.5%).

Can the same integration work in Kenya and Tanzania? The API logic is similar but platforms, credentials and currencies differ (KES vs TZS). Plan two separate configurations.

How long to reach production? On average 3 to 6 weeks, with Safaricom's Paybill go-live validation often being the bottleneck.

How do you avoid unknown-status payments? Combine the STK Push callback with a scheduled Transaction Status call (e.g. every 5 minutes) to catch lost callbacks.

Let's talk about your project. We integrate M-Pesa, Wave and Orange Money into your app with reliable callbacks and automatic reconciliation. WhatsApp +221 77 596 93 33.

Tags:#M-Pesa#mobile payment#Kenya#API
Share:

Mohamed Bah

Fondateur, Kolonell

Passionate about digital and entrepreneurship in Africa, Mohamed has been helping Sénégalese businesses with their digital transformation since 2020. Founder of Kolonell, he believes every SME deserves a professional and accessible online présence.