API reference / M-PESA Express
Send an STK Push payment prompt
/mpesa/stkpush/v1/processrequestChecked against the Safaricom sandbox on 1 December 2026
Asks the customer to approve a payment on their phone. A ResponseCode of "0"
means only that Daraja accepted the request; the payment result arrives later at
your CallBackURL, or can be read with the STK Push Query.
In the SDKs
| SDK | Method |
|---|---|
| TypeScript | stkPush() |
| Python | stk_push() |
| PHP | stkPush() |
| Kotlin | stkPush() |
| Swift | stkPush() |
Request
| Environment | URL |
|---|---|
| Sandbox | https://sandbox.safaricom.co.ke/mpesa/stkpush/v1/processrequest |
| Production | https://api.safaricom.co.ke/mpesa/stkpush/v1/processrequest |
Send the access token as Authorization: Bearer <token>, and the body as JSON.
| Field | Type | Description |
|---|---|---|
BusinessShortCode | stringRequired | A paybill or till number. Matches ^[0-9]{5,7}$. |
Password | stringRequired | Base64 of BusinessShortCode + Passkey + Timestamp. |
Timestamp | stringRequired | The time of the request in Kenyan time (EAT), formatted YYYYMMDDHHmmss. Matches ^[0-9]{14}$. |
TransactionType | stringRequired | CustomerPayBillOnline for a paybill, CustomerBuyGoodsOnline for a till. One of CustomerPayBillOnline, CustomerBuyGoodsOnline. |
Amount | integerRequired | Whole Kenyan shillings. At least 1. |
PartyA | stringRequired | A Kenyan mobile number in international format without the plus, e.g. 254708374149. Matches ^254(7|1)[0-9]{8}$. |
PartyB | stringRequired | A paybill or till number. Matches ^[0-9]{5,7}$. |
PhoneNumber | stringRequired | A Kenyan mobile number in international format without the plus, e.g. 254708374149. Matches ^254(7|1)[0-9]{8}$. |
CallBackURL | string (uri)Required | The public HTTPS URL that receives the result. Matches ^https://. |
AccountReference | stringRequired | Shown to the customer as the account number. Up to 12 characters. 1–12 characters. |
TransactionDesc | stringRequired | A short note about the payment. Up to 13 characters. 1–13 characters. |
Example request
curl -X POST "https://sandbox.safaricom.co.ke/mpesa/stkpush/v1/processrequest" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"BusinessShortCode": "174379",
"Password": "MTc0Mzc5YmZiMjc5ZjlhYTliZGJjZjE1OGU5N2RkNzFhNDY3Y2QyZTBjODkzMDU5YjEwZjc4ZTZiNzJhZGExZWQyYzkxOTIwMjYxMTMwMTAxMDAw",
"Timestamp": "20261130101000",
"TransactionType": "CustomerPayBillOnline",
"Amount": 1,
"PartyA": "254708374149",
"PartyB": "174379",
"PhoneNumber": "254708374149",
"CallBackURL": "https://example.com/mpesa/callback",
"AccountReference": "INV-1001",
"TransactionDesc": "Invoice 1001"
}'Response
Daraja accepted the request and sent the prompt.
| Field | Type | Description |
|---|---|---|
MerchantRequestID | stringRequired | |
CheckoutRequestID | stringRequired | Identifies this payment in the callback and the STK Push Query. |
ResponseCode | stringRequired | "0" means Daraja accepted the request. |
ResponseDescription | stringRequired | |
CustomerMessage | string |
Errors
| Status | Meaning |
|---|---|
400 | Daraja rejected the request. An HTTP 401 with "Invalid API call as no apiproduct match found" means your Daraja app does not have this API product enabled: add it to the app on the Daraja portal, then request a new access token. |
401 | Daraja rejected the request. An HTTP 401 with "Invalid API call as no apiproduct match found" means your Daraja app does not have this API product enabled: add it to the app on the Daraja portal, then request a new access token. |
429 | Daraja's gateway is rate-limiting this app. Observed in the sandbox for an STK Push Query sent seconds after the STK Push (2026-12-01). The body does not follow the usual error shape, so read the status code, wait, and retry with backoff. |
500 | Daraja rejected the request. An HTTP 401 with "Invalid API call as no apiproduct match found" means your Daraja app does not have this API product enabled: add it to the app on the Daraja portal, then request a new access token. |
See errors and rate limits for what to do with each.
Example response
{
"MerchantRequestID": "29115-34620561-1",
"CheckoutRequestID": "ws_CO_30112026101000123708374149",
"ResponseCode": "0",
"ResponseDescription": "Success. Request accepted for processing",
"CustomerMessage": "Success. Request accepted for processing"
}Callback
Daraja calls these on your server. They are not signed: confirm with Daraja before you act on one. See handling callbacks.
The payment result
Sent to CallBackURL from your request.
Daraja POSTs the outcome to your CallBackURL. ResultCode 0 means the
customer paid; any other value means the payment did not happen.
CallbackMetadata is present only when the payment succeeded. Respond
with HTTP 200 quickly; the callback is not signed and may be lost, so
reconcile unconfirmed payments with the STK Push Query.
| Field | Type | Description |
|---|---|---|
Body | objectRequired | |
Body.stkCallback | objectRequired | |
Body.stkCallback.MerchantRequestID | stringRequired | |
Body.stkCallback.CheckoutRequestID | stringRequired | |
Body.stkCallback.ResultCode | integerRequired | Common results. Daraja may return others; treat any non-zero code as not paid.
- 0 paid
- 1 insufficient balance
- 1001 another transaction is in progress for this customer
- 1019 the prompt expired
- 1025 / 9999 Daraja could not send the prompt
- 1032 the customer cancelled
- 1037 the customer's phone could not be reached, or they did not respond
- 2001 the customer entered the wrong PIN
|
Body.stkCallback.ResultDesc | stringRequired | |
Body.stkCallback.CallbackMetadata | object | |
Body.stkCallback.CallbackMetadata.Item | array of objectRequired |