Skip to content

Kenya Collections (V1)

Kenya collections use the V1 endpoint POST /api/v2/payments. You can collect over a wallet (network_code) or a payment channel (channel_id), online (STK push) or offline (Paybill).

Terminal window
curl -X POST "$PH_BASE_URL/api/v2/payments" \
-u "$PH_API_USERNAME:$PH_API_PASSWORD" \
-H "Content-Type: application/json" \
-d '{
"amount": 10,
"phone_number": "0712345678",
"provider": "sasapay",
"network_code": "63902",
"account_id": 63,
"external_reference": "test_ext",
"callback_url": "https://your-system.com/webhooks/payhero"
}'

A successful request returns 201 with a CheckoutRequestID:

{
"success": true,
"status": "QUEUED",
"reference": "UFD003217286.iI",
"CheckoutRequestID": "29119",
"external_reference": "test_ext"
}
Type Key fields
Wallet-based provider, network_code
Payment-channel provider, channel_id
Offline add is_offline: true (+ merchant_fee)

For an offline collection (is_offline: true), no STK push is sent. The customer completes payment manually via M-Pesa Paybill, using the CheckoutRequestID from the response as the account reference.

  1. Make the request with is_offline: true and read the CheckoutRequestID from the response (e.g. 29119).
  2. The customer pays on M-Pesa:
    • Paybill number: 756756
    • Account number: 553125#<CheckoutRequestID> — e.g. 553125#29119
  3. The final result is delivered to your callback URL.

See the API Reference → Wallet-based collection (V1) for the full schema, all three collection examples, and language snippets.