API Authentication
All HTTP requests to PayWay REST endpoints require HTTP Basic Authentication headers using your API Key Token generated in your PayWay Merchant Account Settings.
Authorization: Basic <your_api_key>
Content-Type: application/json
Accept: application/json
Initiate M-Pesa STK Push Prompt
Triggers an instant Safaricom M-Pesa SIM popup prompt on the customer's phone requesting PIN entry to complete the payment transaction.
curl --location 'https://payway.co.ke/api/v2/payments' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <your_api_key>' \
--data '{
"amount": "100",
"phone": "+254700000000",
"reference": "ORDER-9942",
"description": "Payment for Online Purchase"
}'
Automated B2C M-Pesa Payout
Disburse funds directly from your PayWay wallet to any registered M-Pesa recipient phone number in Kenya within seconds.
curl --location 'https://payway.co.ke/api/v2/withdraw' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <your_api_key>' \
--data '{
"amount": "500",
"phone": "+254700000000",
"channel": "MPESA_B2C",
"remarks": "Salary Payout #1042"
}'
Real-Time Webhook Callback
When an M-Pesa transaction is completed by the customer, PayWay immediately sends an HTTP POST JSON payload to your configured Callback URL.
{
"status": "SUCCESS",
"transaction_id": "PW-9821-4402",
"receipt_code": "RKS8910245",
"amount": 100.00,
"phone": "254700000000",
"reference": "ORDER-9942",
"gateway": "M-PESA EXPRESS",
"timestamp": "2026-08-25T11:45:00Z"
}