Quick answer

To accept M-Pesa on WooCommerce in Kenya, install a compatible payment gateway plugin such as Pesapal, IntaSend, or DPO Pay. These gateways add M-Pesa STK Push as a checkout option. For in-store M-Pesa at your physical counter, use WebpinnPOS, which sends STK Push requests and automatically confirms payment: separately from your WooCommerce online checkout.

M-Pesa payment options for WooCommerce

WooCommerce does not include M-Pesa support out of the box. To accept M-Pesa, you install a payment gateway plugin from a provider that has integrated with Safaricom's Daraja API. There are two distinct contexts in which you might want to accept M-Pesa through WooCommerce:

  • Online payments: A customer visits your WooCommerce store, adds items to their cart, and pays with M-Pesa at checkout from their computer or phone. The gateway handles this via STK Push.
  • In-person checkout: A customer is at your physical shop counter, and you want to use WooCommerce as your POS. In this case you need an STK Push trigger from the counter. This is better handled by a dedicated POS system like WebpinnPOS that also keeps stock in sync with your WooCommerce store.

This guide covers both scenarios. Most merchants with a physical shop will use a gateway plugin for online orders and WebpinnPOS for in-store M-Pesa.

Available WooCommerce M-Pesa plugins and gateways in Kenya

GatewayM-Pesa STK PushCard supportSettlement
PesapalYesVisa, MastercardDaily, KES
IntaSendYesVisa, MastercardNext business day, KES
DPO PayYesYes, multi-currencyVaries by agreement

All three providers require you to create a merchant account and complete identity and business verification before you can process live payments. This process typically takes one to three business days and requires your national ID or passport, business registration certificate (if applicable), and bank account details for settlement.

How to install and configure (step by step)

  1. Create a merchant account with your chosen gateway and complete verification. You will receive API credentials (API key, IPN URL, etc.) from their dashboard.
  2. Install the gateway's WooCommerce plugin. Most are available directly from the WordPress plugin directory: search by provider name. Some providers supply a downloadable zip you install via Plugins then Add New then Upload Plugin.
  3. Activate the plugin. Then go to WooCommerce then Settings then Payments. Your new gateway should appear in the list. Click Manage next to it.
  4. Enter your API credentials from your gateway merchant dashboard. Enable the gateway and set it to sandbox/test mode.
  5. Place a test order on your WooCommerce store. Select M-Pesa at checkout. If the gateway is in sandbox mode, use their test phone number and PIN. Confirm the order appears as paid in WooCommerce and in your gateway dashboard.
  6. Once testing is successful, switch the gateway from sandbox to live mode. Your store is now ready to accept real M-Pesa payments.

IPN (Instant Payment Notification) URL: Most gateways require you to configure a webhook URL (often called the IPN URL) in their dashboard. This is how they notify WooCommerce when a payment is confirmed. The plugin documentation will specify the exact URL format to use, typically something like yourdomain.co.ke/?wc-api=gateway_name.

STK Push for in-person checkout via WebpinnPOS

If you use WooCommerce and also have a physical shop, you face a practical challenge: WooCommerce's gateway plugins are designed for online checkout flows, not for a cashier initiating a payment from a counter tablet. The flow where a cashier sees the customer, enters their phone number, and the customer receives an STK Push. That is a point-of-sale flow, not a web checkout flow.

WebpinnPOS handles this natively. The cashier enters the customer's phone number (or the customer's Safaricom number is retrieved from their loyalty profile), WebpinnPOS sends an STK Push, and the system automatically confirms when payment is received from Safaricom's callback. No one needs to check SMS messages or manually verify the transaction. The completed sale then syncs to your WooCommerce store, reducing stock levels automatically.

This combination, a WooCommerce M-Pesa gateway for online orders and WebpinnPOS for in-store M-Pesa, gives customers a consistent payment experience on both channels without requiring two separate manual reconciliation processes at the end of the day.

Testing your M-Pesa integration

Before going live, run through the following test checklist:

  • Place a test order on your WooCommerce store using the gateway's sandbox mode. Confirm the order appears as pending payment, then as paid after the simulated STK Push confirmation.
  • Check that your WooCommerce stock count reduces correctly after the test order is paid.
  • Test an order where the customer "times out" on the STK Push (does not confirm). Confirm the order stays in a pending state and is not marked as paid.
  • If you are using WebpinnPOS for in-store payments, initiate a test in-store sale and confirm the payment completes and the sale appears in your WooCommerce order list or inventory is updated correctly.

Running these tests in sandbox mode before switching to live credentials prevents real-money issues on your first day of trading.

Frequently asked questions

Handle in-store M-Pesa through WebpinnPOS

STK Push with automatic confirmation, stock sync to WooCommerce, and full sales reporting: built for Kenyan shops.

Start Free Trial
14 days free. No credit card required.