How it works
Send the STK push request
Call
POST /api/v1/payment/collection/stk-push/ with the customer’s phone number and the amount to collect.Customer receives a prompt
Safaricom sends a push notification to the customer’s phone with your business name and the payment amount.
Customer enters their PIN
The customer opens the prompt and enters their M-Pesa PIN to authorise the payment.
Send an STK push
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
phone_number | string | Yes | Kenyan phone number in international format, e.g. 254712345678. |
amount | number | Yes | Amount in KES. Minimum KES 10, maximum KES 150,000. |
api_ref | string | No | Your internal reference for this payment, e.g. an order ID. Returned in the webhook payload. |
wallet_id | string | No | The ID of a specific KES wallet to receive funds. Defaults to your primary settlement wallet. |
mobile_tarrif | string | No | Who pays the transaction fee. BUSINESS-PAYS (default) or CUSTOMER-PAYS. |
Success response
id field in the response is your invoice ID. Save it — you’ll use it to check payment status.
Amount limits
M-Pesa enforces minimum and maximum transaction amounts:- Minimum: KES 10
- Maximum: KES 150,000
400 error.
After sending the request, poll
POST /api/v1/payment/collection/status/ with the invoice_id from the response to check whether the customer completed the payment. Alternatively, configure a webhook to receive automatic notifications.