Skip to main content

M-Pesa STK Push (Kenya)

This sends an M-Pesa prompt to the customer's phone. They enter their PIN and the funds arrive in your KES wallet.

curl -X POST https://api.intasend.com/api/v1/payment/mpesa-stk-push/ \
-H "Authorization: Bearer $INTASEND_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"amount": 100, "phone_number": "254712345678", "api_ref": "order-123"}'

Request​

FieldRequiredDescription
amountYesAmount in KES. It is rounded up to a whole shilling.
phone_numberYes2547XXXXXXXX, 2541XXXXXXXX, 07XXXXXXXX or 01XXXXXXXX. Digits only.
api_refNoYour reference, for example an order ID. It is returned on the invoice and in webhooks.
wallet_idNoKES wallet to credit. Defaults to your settlement wallet.
mobile_tarrifNoBUSINESS-PAYS or CUSTOMER-PAYS.

Response​

{
"id": "5b9d…",
"invoice": {"invoice_id": "ABC123", "state": "PENDING", "provider": "M-PESA", "value": 100, "account": "254712345678", "api_ref": "order-123"},
"customer": {"customer_id": "…", "phone_number": "254712345678"},
"created_at": "…"
}

Then track the payment with payment status or the collection_event webhook.

Common failures​

failed_codeMeaningWhat to do
1032The customer cancelled the promptAsk them to try again
1037The phone couldn't be reached (off, no network, or an old SIM)The customer may get paybill instructions to pay manually
1Insufficient M-Pesa balance
2001Wrong PIN