PayHero is the easiest way to accept M-Pesa payments in your shop. You don't need to apply for Daraja API access from Safaricom — PayHero handles all of that for you. You just create a PayHero account, get three credentials, and paste them into your shop settings.
Before you start
- A registered PayHero account at app.payhero.co.ke
- A PayHero Payment Channel (this is where customer payments land)
- Your three PayHero credentials: API Username, API Password, and Channel ID
If you don't have these yet, see Getting your PayHero API keys first.
Step 1 — Open your shop settings
From your dashboard, go to Dashboard → Shop. Scroll down to the Payments section. You'll see a row labelled PayHero (M-Pesa) with a status of "Easier M-Pesa setup".
Step 2 — Open the PayHero setup
Tap the PayHero (M-Pesa) row. A setup form will slide up from the bottom of the screen. It asks for three things:
- API Username — from your PayHero dashboard
- API Password — from your PayHero dashboard
- Channel ID — the numeric ID of your payment channel
Step 3 — Paste your credentials
Copy each value from your PayHero account and paste it into the matching field. Be careful not to include extra spaces — although we automatically trim whitespace, it's a good habit.
Tap Save. If your credentials are correct, the row will change to Connected and a green toggle will appear to enable or disable PayHero at any time.
Step 4 — Test it
Open your shop in another tab, add a product to the cart, and go to checkout. You should see M-Pesa as a payment option. Use your own phone number to test a small payment (e.g. KES 1) — you should receive an STK push prompt within a few seconds.
If you have direct M-Pesa (Daraja) configured too
When both PayHero and direct M-Pesa are set up, your customers will only see one M-Pesa option at checkout — PayHero takes priority because it has fewer points of failure. Your direct setup stays saved but is hidden until PayHero is disabled.
Disconnecting PayHero
Open the PayHero row again and tap Disconnect. This clears your credentials and removes M-Pesa from checkout (unless you have direct M-Pesa enabled).
Common errors and what they mean
- "PayHero rejected your API credentials" — your username or password is wrong, or has been reset. Double-check both values from your PayHero dashboard.
- "PayHero channel ID is invalid or not active" — the channel ID doesn't exist, or your channel is in a paused state. Check that the channel is live in your PayHero dashboard.
- "PayHero account has insufficient balance" — this affects payouts, not checkout. Top up your PayHero account from your PayHero dashboard.
- "PayHero rejected the phone number" — the customer entered a non-Safaricom number or wrong format. M-Pesa STK Push only works with Safaricom numbers in the format 2547XXXXXXXX.