Gateways
M-Pesa (Daraja)
Safaricom M-Pesa STK Push (Lipa Na M-Pesa Online) - payer approves on their phone. Kenya, KES.
On this page
Safaricom M-Pesa STK Push (Lipa Na M-Pesa Online) - payer approves on their phone. Kenya, KES.
At a glance#
| Type | mpesa |
| Countries | Kenya |
| Currencies | KES |
| Capabilities | Hosted checkoutOn-demand status verification |
| Gateway docs | developer.safaricom.co.ke/APIs/MpesaExpressSimulate |
Checkout experience#
No redirect. STK Push (Lipa Na M-Pesa Online): the payer receives a PIN prompt on their phone. A valid Safaricom mobile number is required; amounts must be whole shillings.
Configuration fields#
Enter these in the dashboard under Settings → Payment providers → M-Pesa (Daraja). Secret fields are encrypted at rest and masked after saving; leave a secret blank when editing to keep the stored value.
| Field | Type | Notes |
|---|---|---|
| Consumer keyrequired consumerKey | Text | From your Daraja app |
| Consumer secretrequired consumerSecret | Secret | – |
| Business short coderequired shortcode | Text | Paybill number, or for Buy Goods the store/head-office number linked to the till. Sandbox: 174379 |
| Lipa Na M-Pesa Online passkeyrequired passkey | Secret | – |
| Transaction type transactionType | Choice | Options: Paybill (CustomerPayBillOnline); Buy Goods / Till (CustomerBuyGoodsOnline) Default: |
| Till number tillNumber | Text | Buy Goods only - sent as PartyB. Leave blank for Paybill. |
| Callback secret callbackSecret | Secret | Optional. Appended to the callback URL as ?secret= and checked on every callback (Daraja does not sign callbacks). |
Every provider also has Enabled, Sandbox / test mode and Default checkout method switches.
Notification URL#
https://app.centrapoint.co.za/api/webhooks/mpesa?provider={providerId}Copy the exact URL, with your provider ID filled in, from Settings → Payment providers.
- Nothing to paste: CentraPoint sends the callback URL with each STK Push. It must be public HTTPS.
- Optionally set a Callback secret; it is appended to the callback URL as ?secret= and checked on every callback.
How notifications are verified#
- Daraja callbacks are not signed. Every callback is confirmed with an STK Push Query before a final status is recorded.
- Result codes: 0 = complete, 1032 = cancelled by the payer, anything else = failed.
- The amount and currency must match the transaction before it can be marked complete.
Going live#
- Test with sandbox credentials and Sandbox / test mode on, and confirm the notification appears as processed in the Webhook log.
- Replace the credentials with live ones and switch off Sandbox / test mode.
- Update any URL or secret configured in the gateway's portal for the live environment.
- Make a small live payment and confirm it with the Transactions API.