MojaedgeStart trial
Payments

M-Pesa (Daraja)

STK Push from any Sales Order. Callback fires the Payment Entry automatically.

Configuration

Settings → **M-Pesa Settings**: Paybill (or BuyGoods), Consumer Key, Consumer Secret, Passkey, Environment (sandbox/production), Callback URL (we pre-fill). All credentials are encrypted at rest.

From a Sales Order

Open the SO → click **Request M-Pesa**. Customer gets an STK prompt on the phone number stored on the Customer record. Once they enter the PIN, our callback receives the result, creates a Payment Entry against the SO, and SMSes the customer their receipt. Their PDF receipt includes the M-Pesa code + the eTIMS QR.

Refunds

From a paid order → **Refund via M-Pesa**. We call Daraja's Transaction Reversal API. Reversal lands in the customer's M-Pesa within ~30 minutes. The matching Payment Entry is reversed in ERPNext automatically.

Test it

Use sandbox keys (consumer_key=`PASTE_SANDBOX_KEY`). Trigger an STK to phone `254708374149` → enter PIN `0000` on the simulator. Callback lands within 5 seconds.


Missing something? Tell us what you needed.