M-Pesa payments, one API
Get paid on M-Pesa before lunch.
STK Push, tills, paybills, and wallets behind a single Pay Hero endpoint. Send a real request from these docs, then paste the sample into your app.
- Live API tester
- 11 language samples
- Callbacks included
curl -X POST https://backend.payhero.co.ke/api/v2/payments \
-H "Authorization: Basic <your_basic_auth_token>" \
-H "Content-Type: application/json" \
-d '{
"amount": 100,
"phone_number": "0787677676",
"channel_id": 133,
"provider": "m-pesa",
"external_reference": "INV-009"
}'Base URL https://backend.payhero.co.ke. Swap in your token and channel ID.
Everything you need to collect
Pick a path and go. Each card opens the guide or endpoint, with parameters, responses, and a request you can run yourself.
Prompt a customer’s phone for a PIN and get the result on your callback.
Register the channels you collect into and look them up from the API.
Check a balance, top up with M-Pesa, and keep service credit ready.
Copy cURL, JavaScript, PHP, Python, and more from every endpoint.
Save credentials in the sidebar and send a live request without leaving the page.
Drop in a checkout plugin or a donation button and start collecting.