Payment integration
Mpesa with API Keys
Receive M-Pesa payments via STK push, paybill, or till.
Read the payment gateway setup guideSupported markets
- Kenya
C2B and STK push can run together.
Reregister M-PESA URL (opens in a new tab)Setup guidance
- STK push: save credentials and shortcode.
- C2B only: save credentials, then click Register M-PESA URL.
- C2B + validation: enable validation, save, then register M-PESA URL again.
- Pull reconciliation: set nominated number, register pull URL, then enable pull.
- Use separate gateways per service when hotspot and PPPoE need different accounts.
Configuration requirements
Enter these values in the matching gateway settings. Obtain credentials from the provider and keep them private.
- Environment Required
- Choose first. Sandbox for testing; Production for live payments.
- Consumer Key Optional
- From the Safaricom Daraja portal.
- Consumer Secret Optional
- Keep this secret; used for OAuth.
- Pass Key Optional
- Lipa na M-Pesa online passkey for STK push.
- Short Code Type Required
- Paybill or Buy Goods till.
- Paybill Number Optional
- Shown when shortcode type is paybill.
- Till Short Code Optional
- Buy Goods short code from Safaricom.
- Till Number Optional
- Customer-facing till number.
- Enable C2B (customer deposits to your Paybill/Till) Optional
- Turn on to accept direct Paybill/Till deposits in addition to STK push, and to reveal C2B setup.
- C2B API Version Optional
- Daraja C2B register-URL version. Use v2 for most new apps; match your Daraja app.
- Use a validation URL Optional
- Off = confirmation only (most common). On = Safaricom validates the account number before completing - needs External Validation enabled on your shortcode.
- Enable C2B Pull Reconciliation Optional
- Recovers C2B payments that missed the confirmation webhook. Register the pull URL after setting the nominated number; missed payments are also recovered hourly by the mpesa:reconcile-c2b scheduler (or run that command manually).
- Pull Nominated Number Optional
- Organisation MSISDN in 254 format for pull registration.