M-Pesa integration for websites: STK Push, Paybill & Till in 2026
A plain-English guide to integrating M-Pesa on your website in Kenya — STK Push, Paybill, Till, callbacks, and how to test with Safaricom Daraja. Costs and pitfalls.
If you sell online in Kenya, M-Pesa isn't a nice-to-have — it's usually 70–90% of your revenue. Getting the integration right is the difference between a store that converts and one that abandons at checkout.
The three M-Pesa flows on a website
- STK Push (Lipa Na M-Pesa Online) — customer taps Pay, gets a prompt, done. Best UX.
- Paybill — customer enters your business number + account manually. More friction, cheaper.
- Buy Goods (Till) — similar to Paybill, no account number. Good for single-price products.
How STK Push actually works
Behind the scenes:
- Your site calls Safaricom Daraja with the amount and the customer's phone number.
- Daraja pushes a prompt to that phone.
- Customer enters M-Pesa PIN. Safaricom confirms.
- Daraja calls your callback URL with success or failure.
- Your site updates the order and shows confirmation.
What you need before integrating
- A registered business (sole prop counts) — needed to apply for Paybill/Till.
- Paybill or Till number from Safaricom.
- Daraja developer account and app credentials.
- A live HTTPS callback URL on your website.
- A test flow — Safaricom's sandbox lets you test without moving real money.
Common pitfalls we see on Kenyan websites
- Callback URL on http:// (Safaricom requires https).
- No timeout handling — customer's prompt expires, order stuck as "processing".
- Not verifying the callback signature — anyone can spoof a success.
- Storing the M-Pesa reference in a Google Sheet instead of the database.
- No manual override for admins to mark orders paid.
What it costs
M-Pesa integration on a Kenyan e-commerce site typically adds KES 30,000 – 80,000 to the project depending on how much automation you want (auto-reconciliation, admin dashboards, refund flows). Ongoing costs from Safaricom are per-transaction and small.
FAQ
Can I integrate M-Pesa on any website in Kenya?+
Yes, on any site you can add server-side code to. WordPress, Shopify, custom sites — all can integrate M-Pesa Daraja. You'll need a Paybill or Till from Safaricom and a developer to wire up STK Push and callbacks.
Is M-Pesa STK Push safe for my customers?+
Yes. The customer confirms the payment on their own phone with their M-Pesa PIN — the merchant never sees the PIN. As long as your callback URL is HTTPS and you verify the callback, it's very secure.
Need a website, e-commerce store, or app in Kenya?
We're a Nairobi-based studio building fast, honest websites and apps for Kenyan startups, SMEs and NGOs — priced transparently in KES.
How Much Does a Website Cost in Kenya in 2026? (Real KES Prices)
A realistic 2026 breakdown of what websites actually cost in Kenya — from KES 15,000 landing pages to KES 300,000+ custom platforms.
ReadWeb Design in Kenya: A 2026 Guide for Business Owners
Good web design in Kenya isn't about pretty layouts — it's about loading fast on 4G, converting on mobile, and ranking on google.co.ke. Here's what to look for.
Read