API reference / M-PESA Express
Check the result of an STK Push
POST
/mpesa/stkpushquery/v1/queryChecked against the Safaricom sandbox on 1 December 2026
Returns the outcome of an STK Push. Use it to confirm a payment before you deliver,
and to recover results whose callbacks never arrived. While the customer is still
deciding, Daraja answers with an error (errorCode 500.001.1001, "The
transaction is being processed"); retry after a few seconds. Querying too
often, or right after the push, returns HTTP 429: wait at least a few seconds
before the first query and back off between queries.
In the SDKs
| SDK | Method |
|---|---|
| TypeScript | stkQuery(), waitForStkResult() |
| Python | stk_query(), wait_for_stk_result() |
| PHP | stkQuery(), waitForStkResult() |
| Kotlin | stkQuery(), waitForStkResult() |
| Swift | stkQuery(), waitForStkResult() |
Request
| Environment | URL |
|---|---|
| Sandbox | https://sandbox.safaricom.co.ke/mpesa/stkpushquery/v1/query |
| Production | https://api.safaricom.co.ke/mpesa/stkpushquery/v1/query |
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}$. |
CheckoutRequestID | stringRequired |
Example request
curl -X POST "https://sandbox.safaricom.co.ke/mpesa/stkpushquery/v1/query" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"BusinessShortCode": "174379",
"Password": "MTc0Mzc5YmZiMjc5ZjlhYTliZGJjZjE1OGU5N2RkNzFhNDY3Y2QyZTBjODkzMDU5YjEwZjc4ZTZiNzJhZGExZWQyYzkxOTIwMjYxMTMwMTAxMDAw",
"Timestamp": "20261130101000",
"CheckoutRequestID": "ws_CO_30112026101000123708374149"
}'Response
The current result of the STK Push.
| Field | Type | Description |
|---|---|---|
ResponseCode | stringRequired | |
ResponseDescription | stringRequired | |
MerchantRequestID | stringRequired | |
CheckoutRequestID | stringRequired | |
ResultCode | stringRequired | The payment result as a string. "0" means paid. See StkResultCode. |
ResultDesc | stringRequired |
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
{
"ResponseCode": "0",
"ResponseDescription": "The service request has been accepted successsfully",
"MerchantRequestID": "29115-34620561-1",
"CheckoutRequestID": "ws_CO_30112026101000123708374149",
"ResultCode": "0",
"ResultDesc": "The service request is processed successfully."
}