Skip to content

M-Pesa — Encyclopedia

Last updated: January 2024


M-Pesa is the world’s most successful mobile money service. Launched by Safaricom in Kenya in 2007, it transformed how East Africa transacts and became the template for mobile money globally. It is operated by Safaricom in Kenya, with M-Pesa Africa (a Safaricom/Vodacom joint venture) licensing the brand across other African markets.

Understanding M-Pesa is essential for any developer building payment integrations for Kenya. For many Kenyans, M-Pesa is money — it’s where salaries arrive, bills are paid, and savings are kept.


DetailValue
OperatorSafaricom PLC (Kenya)
OwnershipVodacom Group (35%), Kenyan government and public (65%)
Founded2007
RegulatorCentral Bank of Kenya (CBK)
LicenseNon-Bank Payment Service Provider (CBK)
Active Users~32 million (Kenya, as of 2023)
Annual Transactions~$314 billion USD processed (2023)

M-Pesa processes roughly 50% of Kenya’s GDP in transaction value annually. This is not a payment method — it is national financial infrastructure.


M-Pesa’s position in Kenya is more dominant than Telebirr in Ethiopia. Kenya has a competitive mobile network market (Safaricom, Airtel, Telkom), yet M-Pesa maintains overwhelming market share because:

  • It was first (2007, a decade before competitors)
  • Network effects: everyone already has M-Pesa
  • Deep integration into daily life (salaries, utilities, government services, e-commerce)
  • M-Pesa agents exist even in rural Kenya — physical cash-in/cash-out infrastructure

Competitors (Airtel Money, Equitel) exist but have low adoption.


The primary merchant payment product. Two variants:

1. STK Push (Recommended for online merchants)

  • Your system sends a payment request via Safaricom API
  • Customer receives a USSD push on their phone
  • Customer enters M-Pesa PIN to approve
  • Callback sent to your system

2. PayBill / Buy Goods

  • Customer initiates payment by entering your PayBill number on their phone
  • Used for in-person or manual payments
  • Not suitable for automated online checkout

For online integrations, STK Push is what you want — and what Zirzir uses under the hood.


M-Pesa’s developer ecosystem is more mature than Ethiopian gateways. Safaricom runs the Daraja API platform (Daraja means “bridge” in Swahili).

To get credentials:

  1. Register at developer.safaricom.co.ke
  2. Create an app — sandbox credentials are immediate
  3. For production: apply for Go Live, provide business documentation
  4. Go Live review typically takes 1-2 weeks
CredentialDescription
consumerKeyYour app’s consumer key
consumerSecretYour app’s consumer secret
businessShortCodeYour PayBill or Till number
passKeyLipa Na M-Pesa passkey (provided after approval)
callbackUrlWebhook URL for STK Push results

M-Pesa’s merchant fee structure depends on your agreement type:

Buy Goods (Till Number)

Transaction Amount (KES)Fee
1 - 1000 KES
101 - 5007 KES
501 - 1,00013 KES
1,001 - 1,50023 KES
1,501 - 2,50033 KES
2,501 - 3,50053 KES
3,501 - 5,00057 KES
5,001 - 7,50078 KES
7,501 - 10,00090 KES
10,001 - 15,000100 KES
15,001 - 20,000105 KES

PayBill (Business Number) PayBill fees vary by industry and are negotiated with Safaricom. Banks, utility companies, and large merchants typically have custom rates.

Merchants above ~KES 5 million/month in volume have room to negotiate. Contact your Safaricom Enterprise account manager.


DetailValue
Advertised cycleT+1 business days
Real-world cycleT+1 (more reliable than Ethiopian gateways)
Settlement currencyKES
Settlement methodBank transfer to registered business account
Settlement daysMonday - Friday
ReportingVia M-Pesa portal or API

M-Pesa’s settlement is more reliable and consistent than most African payment gateways. T+1 is generally what you actually get.


Safaricom’s Daraja platform is the most mature payment API in sub-Saharan Africa.

AspectRatingNotes
API documentation4/5Good, with some outdated sections
Sandbox4/5Solid; simulates STK Push without real phone
Production stability5/5Excellent, enterprise-grade uptime
Error messages3/5Improving but still occasionally cryptic
Support3/5Developer forums active; enterprise support better
OAuth token handling3/5Tokens expire every hour — must be managed

Daraja quirks:

  • OAuth tokens expire every 3600 seconds. Zirzir handles refresh automatically
  • STK Push callbacks sometimes arrive out of order — always verify via API, not just callbacks
  • Production and sandbox use different base URLs and different credentials — easy to mix up
  • The ResultCode: 0 means success, but always check ResultDesc too
  • Phone numbers must be in 2547XXXXXXXX format (country code, no +)

M-Pesa operates under:

  • Central Bank of Kenya National Payment System Act (2011)
  • CBK National Payment System Regulations (2014)
  • CBK Prudential Guidelines for Digital Credit Providers (2022)

Safaricom holds a Payment Service Provider license from CBK. As a Daraja API user, you are operating under Safaricom’s license — you don’t need your own CBK payment license to process M-Pesa payments. However, depending on your business model, you may need other CBK registrations.


The M-Pesa brand operates in multiple African countries through M-Pesa Africa, a Safaricom/Vodacom joint venture. Each country is a separate API, separate credentials, and different features:

CountryOperatorAPI PlatformNotes
KenyaSafaricomDarajaMost mature
TanzaniaVodacomM-Pesa OpenAPIDifferent API, same brand
DRCVodacomM-Pesa OpenAPI
MozambiqueVodacomM-Pesa OpenAPI
GhanaVodafoneM-Pesa OpenAPI
EthiopiaSafaricom EthiopiaLimitedNew market, limited reach

Important: M-Pesa Kenya and M-Pesa Tanzania are different products with different APIs. Do not assume your Kenya integration will transfer.


The most common issue. Causes:

  • callbackUrl is not publicly accessible (localhost won’t work in production)
  • Firewall blocking Safaricom’s callback IP ranges
  • HTTPS required — Safaricom won’t call HTTP endpoints in production
  • URL must respond within 5 seconds or Safaricom marks it as failed

Tokens expire every 3600 seconds. Ensure you’re refreshing proactively, not reactively.

”The transaction amount is less than the minimum amount”

Section titled “”The transaction amount is less than the minimum amount””

Minimum STK Push transaction: 1 KES. But some operations have higher minimums — check the specific endpoint docs.

Customer dismissed the USSD prompt. The transaction is permanently failed — you cannot re-push the same request.