Overview
Guides, API references, and tools for building payment experiences with Pay Hero.
All API requests use HTTPS. The production base URL is https://backend.payhero.co.ke.
Authenticate with HTTP Basic Auth. You can save an API username and password in the sidebar and use them when you send a test request.
Quick start
Trigger an M-Pesa STK Push. Replace the token and channel ID with your own.
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",
"callback_url": "https://example.com/callback.php"
}'Getting Started
Create an account, generate credentials, and authorize your requests.
Introduction
Welcome to Pay Hero Developer APIs - Your comprehensive guide to payment integration
Creating Account
How to create your Pay Hero account
Authorization
How to authenticate with Pay Hero APIs
Payment Channels
Register and list the M-Pesa tills, paybills, and bank accounts you collect into.
Get Payment Channels
GET Retrieve all your payment channels
Register Payment Channel
POST Register a new payment channel (paybill, till, or bank)
Get PH Bank Paybills
GET Fetch all Pay Hero registered bank paybills for your reference when registering payment channels
Payments
Collect payments with STK Push, payment buttons, Lipwa links, and callbacks.
Initiate MPESA STK Push
POST Initiate an MPESA STK Push request to a customer's phone
Payment Button
Integrate Pay Hero payment button widget into your website or application
Lipwa Link
Learn how to use and customize your unique Lipwa payment link
Payment Callback
POST Structure of the callback response received after a payment is processed.
Wallets
Check balances, top up your service wallet, and withdraw to mobile.
Get Service Wallet Balance
GET Query your service wallet balance
Service Wallet Top Up
POST Top up your service wallet on Pay Hero. The phone number you provide will get an MPESA prompt to enter PIN to complete the top-up request
Transactions
Look up the status and history of your transactions.
Get Transaction Status
GET Fetch the status of any payment transaction
Get Account Transactions
GET Retrieve all account transactions with pagination support
Pricing
Understand the fees applied to each transaction.
Plugins
Drop-in integrations for WooCommerce and WordPress.

