M-Pesa on WooCommerce
JMSURF PAY guide · updated 21 November 2026
The JMSURF PAY plugin adds M-Pesa to your WooCommerce checkout. The customer types an M-Pesa number, gets a prompt on the phone and enters the PIN. The order is marked paid and the money goes straight to your till, paybill or bank.
What you need
- WordPress 6.0 or newer, WooCommerce 7.6 or newer and PHP 7.4 or newer.
- The store currency set to Kenya Shilling (KES).
- A JMSURF PAY account with a payment channel. The plugin zip is under Developers, Integrations in the dashboard.
Install
- 1Upload the plugin. In WordPress open Plugins, Add New, Upload Plugin. Choose
jmsurf-pay-woocommerce.zip, install and activate it. - 2Get your secret key. In JMSURF PAY open Developers, API & keys and create a key. Copy the secret key.
- 3Get the channel code. Open Payment channels and copy the code (
tnnt_…) of the till, paybill or bank the money should go to. - 4Add the webhook. Open Developers, Webhooks, Add webhook. Address: your shop address followed by
/wp-json/jmsurf-pay/v1/webhook. Events:payment.completed,payment.failed,payment.cancelled. Copy the webhook secret it shows. - 5Fill in the settings. In WooCommerce open Settings, Payments, M-Pesa (JMSURF PAY). Paste the secret API key, the channel code and the webhook secret. Tick Enable and save.
- 6Try it. Place a small order. The customer can leave the M-Pesa number empty to use the billing phone. A waiting page shows until the payment is done.
How it behaves
- Works with the classic checkout and the block-based Checkout, and with High-Performance Order Storage.
- The order is marked paid with the M-Pesa receipt as its transaction ID. Each step is written in the order notes.
- The waiting page checks the payment every few seconds through your own shop. Your secret key never reaches the browser.
- The customer can send the prompt again, to another number if needed.
- If the prompt does not reach the phone and your paybill has payment confirmations on, the page also offers to pay by Paybill. That payment completes the order too.
- Every prompt carries an Idempotency-Key, so a retried request never prompts twice. Webhooks for another shop on the same account are ignored.
- Refunds are not done by the plugin. Refund from your M-Pesa or bank account and note it on the order.
Build the shop first with a test key (
sk_test_…): nothing reaches M-Pesa. See the test mode guide. Switch to a live key when your business is verified.Start on the Free plan: 1 payment channel, up to KES 50,000 a month, test keys included. Questions? WhatsApp +254 712 504 593.