M-Pesa (Safaricom Daraja API)

Safaricom's developer platform for M-Pesa, Kenya's dominant mobile money service: STK Push (M-Pesa Express), C2B, B2C and B2B APIs on a paybill or till.

Daraja is Safaricom's API portal for integrating directly with M-Pesa in Kenya. Merchants need an M-Pesa shortcode (paybill or till) and go-live approval from Safaricom. The most common flow is M-Pesa Express (STK Push), where the customer approves a PIN prompt on their phone and the result is posted to the merchant's HTTPS callback URL. Direct integration avoids aggregator fees but means handling callbacks, retries and reconciliation yourself.

Type
Mobile money
Headquarters
Nairobi, Kenya
Founded
2007
Regions
East Africa
Businesses can sign up in
Kenya
Customers can pay from
Kenya
Currencies
KES
Cross-border
No
Market presence
Dominant
Integration difficulty
Intermediate
Last verified
25 Nov 2026

Payment methods

  • Mobile money
  • Payouts
  • M-Pesa Express (STK Push / Lipa na M-Pesa Online)
  • C2B (register validation/confirmation URLs)
  • B2C (disbursements)
  • B2B
  • Transaction Status
  • Reversal
  • Account Balance

M-Pesa (Safaricom Daraja API) pricing

Daraja API access is not separately priced; M-Pesa paybill/till tariffs apply and are set by Safaricom. Tariffs were not verified in this review.

Requirements to sign up

  • M-Pesa paybill or till number (shortcode)
  • Daraja developer account and app
  • Safaricom merchant onboarding documents for the shortcode
  • Requires a Safaricom M-Pesa paybill or till number for production
  • Go-live requires Safaricom approval of the app
  • Callback URLs must be publicly reachable HTTPS endpoints

Developer experience

REST API
Yes
Authentication
OAuth 2.0 client credentials: consumer key/secret via HTTP Basic → short-lived bearer token; STK Push also needs a password = Base64(Shortcode + Passkey + Timestamp)
Webhooks
Yes
Webhook notes
Asynchronous results (STK Push, B2C, C2B confirmation) are POSTed to merchant-supplied callback/result URLs; there is no signature header, so verify by querying Transaction Status and by restricting/validating sources.
Sandbox
Yes
Sandbox notes
Sandbox apps can be created on the Daraja portal and simulated (sandbox.safaricom.co.ke).
API versioning
Path-versioned endpoints (e.g. /mpesa/stkpush/v1/processrequest)
Why this difficulty
Token handling, password generation and callback-only results are straightforward but production go-live and reconciliation take effort.

Documentation

Is M-Pesa (Safaricom Daraja API) right for you?

Ideal for

  • Kenyan businesses that want the lowest-overhead M-Pesa integration
  • Developers comfortable running their own callback infrastructure

Pros

  • Direct integration with the dominant Kenyan payment rail
  • No aggregator mark-up
  • Covers collections and disbursements

Cons

  • Kenya and KES only
  • No cards
  • Callback-only results; no signed webhooks
  • Production approval process

Use it when

  • Most of your customers are in Kenya and pay with M-Pesa

Avoid it when

  • You need cards or multi-country coverage from one integration
  • You cannot host a reliable HTTPS callback endpoint

M-Pesa (Safaricom Daraja API) integration guides

M-Pesa (Safaricom Daraja API) alternatives

Countries

Sources

M-Pesa (Safaricom Daraja API) website · All payment providers