M-Pesa on WHMCS

JMSURF PAY guide · updated 21 November 2026

The JMSURF PAY module lets your clients pay WHMCS invoices with an M-Pesa prompt on their phone. The invoice is marked paid with the M-Pesa receipt, and the money goes straight to your own till, paybill or bank.

Install

  1. 1Copy the files. Download jmsurf-pay-whmcs.zip from Developers, Integrations. Copy its modules folder into your WHMCS folder. It adds modules/gateways/jmsurfpay.php and modules/gateways/callback/jmsurfpay.php.
  2. 2Get your secret key. In JMSURF PAY open Developers, API & keys, create a key and copy the secret key.
  3. 3Get the channel code. Open Payment channels and copy the code of the channel the money should go to.
  4. 4Add the webhook. Open Developers, Webhooks, Add webhook. Address: your WHMCS address followed by /modules/gateways/callback/jmsurfpay.php. Events: payment.completed, payment.failed, payment.cancelled. Copy the secret.
  5. 5Activate in WHMCS. Open System Settings, Payment Gateways, All Payment Gateways and choose M-Pesa (JMSURF PAY). Paste the secret API key, channel code and webhook secret, and save.
  6. 6Try it. Open an unpaid invoice in KES, choose M-Pesa (JMSURF PAY), type the M-Pesa number and pay.

How it behaves

  • Invoices must be in Kenya Shillings (KES).
  • The payment is added to the invoice with the M-Pesa receipt as the transaction ID. A receipt is never added twice, even when the webhook and the waiting page see it at the same time.
  • A client who does not get the prompt can try again from the invoice. If your paybill has payment confirmations on, the waiting page also offers to pay by Paybill; that payment completes the invoice too.
  • The module keeps one small table, mod_jmsurfpay, with one row per invoice paid by M-Pesa.
  • Refunds are not supported in the module. Refund from your M-Pesa or bank account and record it in WHMCS.

Start on the Free plan: 1 payment channel, up to KES 50,000 a month, test keys included. Questions? WhatsApp +254 712 504 593.

Read next

© 2026 JMSURF PAY. All rights reserved. · ODPC reg. no. 194-9812-26EBPowered by JMSURF TECHNOLOGIES LTD