PayHero integration
Trigger M-Pesa STK push payments through your PayHero account, then confirm the result server-side before fulfilling an order.
What this integration supports
- Methods
- M-Pesa mobile money (STK push).
- Currency
- KES.
- Country
- Kenya (KE).
- Checkout
- No hosted URL. The customer confirms the prompt on their phone (STK push).
- Webhooks
- PayHero posts a server callback. NunuaPay treats the callback as untrusted and re-verifies.
- Refunds
- Not supported by PayHero.
- Status query
- Yes — NunuaPay can query PayHero for the transaction status.
How to configure it
- In Providers, add a PayHero account for your business.
- Enter the credentials from your own PayHero dashboard and select the environment.
- Confirm the callback base URL is reachable from PayHero.
Payment initiation flow
- Create a payment intent with
method: "mobile_money"and the customer’s phone number. - NunuaPay asks PayHero to send an STK push to that number.
- The customer confirms in M-Pesa. The payment stays
pending/processinguntil confirmed. - PayHero calls NunuaPay; NunuaPay verifies and notifies your endpoint.
Callbacks and verification
PayHero does not sign its callbacks, so a callback alone is never enough to mark a payment paid. NunuaPay correlates the callback to the payment attempt and verifies the status before completing the payment, then sends you a signed payment.succeeded or payment.failed event.
Common errors
- Invalid phone number — use an MSISDN in international format (e.g. 2547XXXXXXXX).
- Request cancelled by user — the customer dismissed the STK prompt; treat the intent as failed and allow a retry.
- Duplicate reference — reuse the same
Idempotency-Keyfor retries instead of sending a new request.