M-Pesa ยท Payments ยท Kenya
M-Pesa Website Integration Guide for Kenyan Businesses (2025)
๐
October 2025
โ๏ธ Keniche Digital
โฑ๏ธ 8 min read
Over 30 million Kenyans use M-Pesa. If your website can't accept M-Pesa payments, you're
leaving serious money on the table. Here's everything you need to know โ in plain English.
Why M-Pesa Integration Matters
Cash is still king in many parts of Kenya, but mobile money is overtaking it fast. For any
e-commerce store, booking site, or services business, accepting M-Pesa online means:
- Customers pay instantly without leaving your website
- You receive automatic payment confirmations
- You can serve customers 24/7, even when you're asleep
- You build trust โ Kenyans trust M-Pesa completely
How M-Pesa Website Integration Works
Safaricom provides a developer platform called the Daraja API (Swahili for "Bridge"). It
lets your website communicate directly with M-Pesa. Here's the customer experience when it's set up
properly:
Step 1
Customer clicks "Pay with M-Pesa"
They enter their phone number (07XX XXX XXX) and confirm the amount.
Step 2
STK Push is sent to their phone
A pop-up appears on their Safaricom handset asking them to enter their M-Pesa PIN. This is called an "STK
Push" (SIM Toolkit Push).
Step 3
They enter their PIN and confirm
Payment is processed in seconds. Both the customer and you receive an SMS confirmation.
Step 4
Your website updates automatically
The order is marked as paid, a receipt is sent, and inventory is updated โ all automatically.
What You Need to Get Started
- An M-Pesa Business Account (Paybill or Till Number) โ Apply at any Safaricom shop with
your business registration documents (Certificate of Incorporation or Business Registration + KRA PIN)
- A Daraja API account โ Register at developer.safaricom.co.ke (free)
- A live website with HTTPS โ The Daraja API requires a secure (https://) website
- A developer to integrate it โ This is where Keniche comes in
๐ก Pro tip: If you're just starting out and don't have a Paybill yet, you can use
third-party payment gateways like Pesapal, iPay Africa, or
Flutterwave which support M-Pesa and are faster to set up โ though they charge slightly
higher transaction fees.
M-Pesa Integration Options Compared
| Method |
Setup Time |
Transaction Fee |
Best For |
| Daraja API (Direct) |
2โ4 weeks |
1โ2% (Safaricom rates) |
High-volume businesses |
| Pesapal |
3โ5 days |
3.5% |
SMEs, quick setup |
| iPay Africa |
3โ7 days |
3% |
E-commerce, WooCommerce |
| Flutterwave |
1โ3 days |
1.4% + KES 15 |
Businesses accepting international cards too |
| Intasend |
1โ2 days |
2.9% |
Startups, freelancers |
How Much Does M-Pesa Integration Cost?
The cost of integrating M-Pesa on your website in Kenya depends on the method and the developer:
- Third-party gateway (Pesapal/iPay): KES 8,000โ20,000 developer fee + gateway
subscription
- Direct Daraja API: KES 20,000โ50,000 developer fee (more complex)
- M-Pesa Paybill setup: Free (Safaricom) + monthly fee (varies)
Common Mistakes to Avoid
- โ Using sandbox credentials in production โ test thoroughly in the sandbox environment
first
- โ Not handling payment callbacks โ your site must listen for Safaricom's confirmation
message
- โ No timeout handling โ what happens if a customer's phone is off? Your code must
handle this gracefully
- โ Storing M-Pesa credentials in plain text โ always use environment variables
- โ Not testing with real money โ always run a live test transaction before going public
How Long Does Integration Take?
Realistically, here's what to expect:
- Getting your Paybill: 3โ10 business days (Safaricom approval)
- Developer integration: 3โ7 days for straightforward sites
- Testing: 2โ3 days
- Total: 2โ4 weeks from start to live
Need M-Pesa Integrated Into Your Website?
We've done this for fashion stores, booking platforms, and business portals across Kenya. WhatsApp us and
let's get your payments working.
๐ฌ
Chat With Us โ It's Free to Ask
The Bottom Line
M-Pesa integration is no longer optional for any serious Kenyan online business. Whether you go with a
third-party gateway for speed or the direct Daraja API for lower fees, the most important thing is to
just do it. Every day your site can't accept M-Pesa is a day you're sending potential
customers elsewhere.