Initiate MPESA STK Push
POST
https://upesipay.com/api/v2/payments
Initiate an MPESA STK Push request to a customer's phone
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization* |
String | Basic auth token |
Content-Type* |
String | application/json |
Request Body
| Parameter | Type | Description |
|---|---|---|
amount* |
Integer | Payment amount (e.g., 100) |
phone_number* |
String | Customer phone number (e.g., 0787677676) |
channel_id* |
Integer | Your registered payment channel ID (e.g., 133) |
provider* |
String | Value: m-pesa or sasapay (if you provided your wallet channel ID) |
external_reference |
String | Your unique reference to track this transaction (e.g., INV-009) |
customer_name |
String | Customer name (Optional) |
callback_url |
String | Your endpoint URL for payment status response |
credential_id |
String | Optional: The ID of your registered credential for custom Mpesa Daraja integration |
network_code |
String | Value: 63902 (for MPESA/wallet channels) |
Responses
201 Created - Upon Successful Request
{
"success": true,
"status": "QUEUED",
"reference": "E8UWT7CLUW",
"CheckoutRequestID": "ws_CO_02012026164321519708344109"
}
Notes
- channel_id - Your wallet channel ID can be found under Payment Channels menu
- provider - Use 'm-pesa' for MPESA channels or 'sasapay' for wallet channels
- network_code - Use 63902 for MPESA
Try It Out
Please set your authentication token in the sidebar to test this API.
Code Samples
curl -X POST \
'https://upesipay.com/api/v2/payments' \
-H 'Content-Type: application/json' \
-d '{"amount":100,"phone_number":"0787677676","channel_id":133,"provider":"m-pesa","external_reference":"INV-009","customer_name":"John Doe","callback_url":"https://example.com/callback.php"}'