Skip to content

How to Set Up M-Pesa Payments on Your Kenyan Website

2. Minibus taxi in Maboneng, Johannesburg, South Africa – How to Set Up M-Pesa Payments on Your Kenyan Website
Photo: Shade Schutze Photography, CC BY-SA 4.0, via Wikimedia Commons

You’ve got a website, and a customer in Eastleigh wants to pay for a pair of sneakers. They don’t want to type in a card number. They want to pay the way they pay for everything else: M-Pesa. If your site can’t take that payment, you’re losing sales to the Instagram seller who just says “send to my till”.

Good news: setting up M-Pesa payments on a Kenyan website is far more doable than it was a few years ago. Here’s how the options work and which one fits your business.

The three ways to accept M-Pesa online

1. Manual Till or Paybill (the zero-tech option)

You show your Lipa na M-Pesa Till or Paybill number on the checkout page. The customer pays from their phone, then enters the M-Pesa confirmation code on your site. You check your statement and confirm the order by hand.

Advertisement

It costs nothing to set up, which is why so many small shops start here. The downside is obvious once you get busy: you’re matching codes to orders manually, and a customer can type a fake code. Fine for ten orders a week. Painful at a hundred.

2. A payment gateway that supports M-Pesa

Gateways such as Pesapal, Flutterwave, Paystack and IntaSend sit between your website and the customer. The customer sees a payment page, picks M-Pesa (or a card), and the gateway tells your site automatically when the money lands. Most also give you ready-made WooCommerce plugins.

The trade-off is a transaction fee, usually a percentage per sale, plus a settlement delay before funds reach your bank or M-Pesa account. For most small online shops, the automation is worth it. We compared the main options in our guide to payment gateways for Kenyan websites.

3. Direct integration with Safaricom’s Daraja API

Daraja is Safaricom’s developer platform. Its best-known feature is STK Push: your site sends a prompt straight to the customer’s phone, they enter their M-Pesa PIN, and your site is notified instantly. No gateway in the middle, so no gateway fee.

You’ll register on the Daraja portal, create an app, test in the sandbox, then request to go live with your own Paybill or Till. If you’re using WordPress and WooCommerce, you can skip writing code: several M-Pesa plugins wrap Daraja for you, though you’ll still need your own credentials from Safaricom. If you’re a developer or have one on call, this is the cheapest route at scale.

What you need before you start

Whichever route you pick, sort these basics first:

  • A registered Paybill or Till number. Business registration documents are normally required, so don’t leave this until launch week.
  • A website on HTTPS. Payment callbacks and customer trust both depend on a valid SSL certificate. Most Kenyan hosts include a free one.
  • A proper domain and email. Customers hesitate to pay on a site with a weird address. A clean .co.ke name signals you’re a real local business.
  • Clear policies. A refund and returns page reduces disputes. Have a look at our guide on a refund and returns policy for your online store.

Setting it up on WordPress and WooCommerce

Most Kenyan online shops run WooCommerce, so here’s the typical flow with a gateway plugin:

  1. Install WooCommerce and complete its basic setup (currency to Kenyan Shilling, shipping zones, tax).
  2. Create an account with your chosen gateway and complete verification. Expect to upload your ID or business documents.
  3. Install the gateway’s official WooCommerce plugin from the WordPress dashboard.
  4. Paste in your API keys, and switch on test mode first.
  5. Place a small test order from your own phone. Check that the order status updates to “Processing” without you touching anything.
  6. Switch to live mode and do one real payment of a small amount, say KES 10 or 50, to be sure.

That last test matters. We’ve seen shops go live with the sandbox keys still active, and customers pay into nothing.

Mistakes that cost Kenyan shops money

Ignoring failed callbacks. Sometimes a customer pays but the confirmation never reaches your site because of a slow server or firewall. Choose reliable hosting, and check your payment dashboard weekly for orders stuck on “pending”.

Hiding the fees. If the gateway takes a cut, decide whether you absorb it or build it into your prices. Surprising customers at the last step kills conversions.

No fallback. Safaricom has downtime now and then. Offer a card option or a manual Till as backup so a bad afternoon doesn’t mean zero sales.

Forgetting mobile. Most of your customers will browse on a phone. Test the whole checkout on a mid-range Android handset over mobile data, not just on your office laptop.

Which option should you choose?

If you’re just testing the market, start with a manual Till and move on once orders grow. If you want automation without hiring a developer, pick a gateway. If you’re processing serious volume or building a custom platform, go direct with Daraja.

Whichever you choose, the foundation is the same: a fast, secure website on a domain customers trust. If you’re still setting that up, you can check domain availability at Buy Domain Kenya and have a shop-ready address in minutes. Questions about hosting a store? Get in touch and we’ll point you in the right direction.

1 comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Chat now