M-PESA STK Push integration
An STK Push sends a payment prompt to the customer's phone. The customer enters their M-PESA PIN and Safaricom returns the result asynchronously.
Payment lifecycle
- initiated
- pending
- successful
- failed / cancelled / timeout
Status values
| Status | Meaning |
|---|---|
initiated | Request received, not yet acknowledged by Daraja. |
pending | Customer prompted, awaiting PIN entry. |
successful | Payment confirmed. |
failed | Declined, insufficient funds, or a Daraja error. |
cancelled | Customer cancelled the prompt. |
timeout | No result received in the expected window. |
Verifying a payment
Treat a payment as final only when its status is successful. The safest pattern is to
act on the payment.success webhook and then re-fetch the transaction to confirm.
NixPay documentation · A Supreonix product
Back to introduction