How to Accept M-Pesa Payments on Your Online Store in Kenya (WooCommerce and Shopify)
If you sell online in Kenya, most of your customers will want to pay with M-Pesa. A store that only takes cards loses those sales at checkout. This guide explains the ways to accept M-Pesa on a WooCommerce or Shopify store, what each one needs from you, and the mistakes we see most often when we fix stores that “sort of” work.
The short answer
- WooCommerce: you can connect M-Pesa directly to your own Paybill or Till number through Safaricom’s Daraja API, using a plugin. Money goes straight to your M-Pesa business account.
- Shopify: Shopify does not offer M-Pesa natively. You add it through a third-party payment provider that supports Kenya and M-Pesa, such as Paystack, Pesapal or IntaSend, installed as a Shopify payment app.
- Either way, the customer experience you want is M-Pesa Express (STK Push): the customer types their phone number, a PIN prompt appears on their phone, and the order is marked paid automatically.
What you need before you start
- A Lipa na M-Pesa business account: a Paybill or a Buy Goods (Till) number registered to your business.
- A Daraja account on Safaricom’s developer portal, if you are integrating directly. You build and test in the sandbox, then apply to go live with your own shortcode.
- An HTTPS website with a valid SSL certificate. Safaricom sends payment confirmations (callbacks) to your site, and they must reach a secure URL.
- Hosting that does not block incoming callbacks. Aggressive firewalls and some security plugins block Safaricom’s requests, which leaves orders stuck on “pending” even though the customer paid.
Option 1: WooCommerce with a direct Daraja integration
This is the most common setup for Kenyan WooCommerce stores, and it is the cheapest per transaction because there is no middle-man gateway fee on top of Safaricom’s own charges.
There are several M-Pesa plugins in the WordPress plugin directory, including options from Kopo Kopo and other Kenyan providers. A good plugin should:
- Support STK Push for both Paybill and Till numbers.
- Handle the callback and mark the order paid automatically, with the M-Pesa receipt code saved on the order.
- Offer a fallback for customers whose STK prompt fails, such as manual Paybill payment with a receipt code check (C2B confirmation).
- Be actively maintained and tested with your WooCommerce version.
How the flow works: the customer places the order, enters their Safaricom number, and approves the PIN prompt on their phone. Safaricom calls your site back with the result, and the plugin moves the order to “processing”. If the callback never arrives, the order stays “pending payment”, which is the number one support complaint we see.
Option 2: WooCommerce through a payment gateway
Gateways such as Paystack, Pesapal, IntaSend and Kopo Kopo give you one checkout for M-Pesa, cards and sometimes Airtel Money. You do not have to handle Daraja go-live yourself. The trade-off is the gateway’s fee and a settlement delay before money reaches your bank or M-Pesa account. For a store that also sells to customers outside Kenya, a gateway that takes both M-Pesa and international cards is usually the simpler choice.
Option 3: Shopify
Shopify Payments is not available in Kenya, and Shopify does not connect to Daraja directly. To accept M-Pesa on Shopify, you install a payment provider from the Shopify App Store that supports Kenyan merchants and M-Pesa. Paystack, Pesapal and IntaSend all offer this. The customer is either sent to the provider’s checkout page or completes the payment in a provider window, and then returns to your store.
Things to check before you choose a provider:
- Is it a full payment app integrated in checkout, or a “manual payment method” where you confirm payments by hand? Manual methods do not scale and cause fulfilment mistakes.
- Which currency does the store charge in? Mixing USD prices with KES M-Pesa payments confuses customers and creates refund problems.
- How and when are funds settled, and what is the total fee per transaction?
Not sure which platform fits your business? Our Shopify vs WooCommerce comparison covers the same trade-offs, and most of them apply in Kenya too.
Common problems we fix
- Paid orders stuck on pending: callbacks blocked by a firewall, a caching plugin, or a callback URL that still points to the sandbox.
- Going live with sandbox credentials: the integration works in testing, then fails on launch day.
- Wrong shortcode type: a Till number configured as a Paybill (or the reverse), so STK prompts fail.
- Phone number format: customers type 07…, 7… or +254…, and the plugin only accepts one format.
- No reconciliation: nobody matches M-Pesa statements to WooCommerce orders, so missing payments are found weeks later.
- Abandoned plugins: an old M-Pesa plugin that breaks after a WooCommerce update.
A launch checklist
- Test STK Push in the Daraja sandbox with test numbers.
- Go live with your own shortcode and production keys.
- Make a real KES 1 to KES 10 test payment, and confirm the order is marked paid automatically.
- Check the M-Pesa receipt code is saved on the order and shown in the confirmation email.
- Test a failed payment (cancel the PIN prompt) and make sure the customer can retry.
- Exclude the callback URL from caching and firewall rules.
- Set up a simple weekly reconciliation between M-Pesa statements and orders.
Need M-Pesa working on your store?
We build and fix WooCommerce and Shopify stores for Kenyan businesses, including M-Pesa, card payments and delivery setup. See our Kenya e-commerce development services, or tell us about your store and we will reply within one business day with what it needs and a fixed price.
Recent Posts
- How to Accept M-Pesa Payments on Your Online Store in Kenya (WooCommerce and Shopify)
- WordPress Site Hacked? A Step-by-Step Clean-Up Guide (2026)
- Shopify vs WooCommerce in Sri Lanka: Real Costs and Which to Choose (2026)
- How to Set Up PayHere on WooCommerce (2026 Guide for Sri Lanka)
- How Your Website Turns Visitors Into Paying Customers
