Skip to content

Wallet-based collection (V1)

POST
/api/v2/payments
curl -X POST "https://api.payhero.africa/api/v2/payments" \
-u "API_USERNAME: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://payd-txest.free.beeceptor.com"
}'

Legacy V1 collection endpoint. Initiates a customer collection (STK push / offline). Use channel_id for payment-channel-based collections, or network_code for wallet-based collections. Set is_offline: true for offline (paybill/till) collections.

For offline collections, no STK push is sent. The customer pays via M-Pesa Paybill 756756, using account number 553125#<CheckoutRequestID> (the CheckoutRequestID is returned in this endpoint’s response). Confirm the exact paybill/account template for your account on your dashboard.

Media typeapplication/json
object
amount
required
number
phone_number
required

Customer phone number.

string
provider
required

E.g. sasapay, m-pesa.

string
network_code

Network code for wallet-based collections.

string
channel_id

Channel ID for payment-channel-based collections.

integer
account_id
required
integer
is_offline

Set true for offline (paybill/till) collections.

boolean
external_reference
string
merchant_fee
number
callback_url

Your system’s callback URL.

string format: uri
Examples

Wallet-based collection

{
"amount": 10,
"phone_number": "0712345678",
"provider": "sasapay",
"network_code": "63902",
"account_id": 63,
"external_reference": "test_ext",
"callback_url": "https://payd-txest.free.beeceptor.com"
}

Collection queued.

Media typeapplication/json
object
success
boolean
status
string
reference
string
CheckoutRequestID
string
external_reference
string
Example
{
"success": true,
"status": "QUEUED",
"reference": "UFD003217286.iI",
"CheckoutRequestID": "29119",
"external_reference": "test_ext"
}

The request was rejected (validation or business-rule failure).

Media typeapplication/json
object
error_code
string
error_message
string
status_code
integer
Examples
{
"error_code": "invalid_argument",
"error_message": "the transaction amount is insufficient as it wont cater for cost: (4.62)",
"status_code": 400
}

Missing or invalid Basic auth credentials.

Media typeapplication/json
object
error_code
string
error_message
string
status_code
integer
Example
{
"error_code": "invalid_argument",
"error_message": "the transaction amount is insufficient as it wont cater for cost: (4.62)",
"status_code": 400
}