payments

M-PESA, live.
Push → PIN → receipt.

This is the real thing — a production Safaricom Daraja till wired exactly the way I build it for clients: STK push to your phone, instant callback confirmation, and a WhatsApp receipt when it lands. Use it to support the site, or just to see the flow work end-to-end.

send_payment()

Enter your number. Get the prompt.

This is a real till — the charge is genuine, not a sandbox. Secured by Safaricom Daraja · your PIN never leaves your phone.

david@mpesa: ~/transaction
  1. 1STK pushserver → Safaricom Daraja API
  2. 2PIN entryprompt lands on your phone — enter M-PESA PIN
  3. 3CallbackSafaricom confirms → receipt issued
  4. 4Donereceipt shown here + WhatsApp confirmation

// every result is a real Daraja ResultCode —
success, cancelled, wrong PIN, insufficient funds, timeout — handled, labeled, and logged to the admin dashboard.

under the hood

What just happened, in 4 hops.

01

STK Push

Your number and amount hit Safaricom's Daraja API over a signed request — the phone buzzes with a payment prompt.

02

PIN on-device

You enter your M-PESA PIN on your own phone. It never touches this server — that's the whole security model.

03

Callback

Safaricom posts the result to a webhook here — idempotent, deduplicated, matched to your transaction id.

04

Receipt + WhatsApp

The receipt number lands on screen and a formatted WhatsApp confirmation lands on your phone via my WotSap API.

edge_cases

Every M-PESA outcome, handled.

The same result-code map I ship to clients — no mystery failures, no silent drops. If the callback stalls, the system queries Daraja directly.

CodeWhat it meansWhat you see
0SuccessReceipt + WhatsApp confirmation
1Insufficient fundsClear message, retry prompt
1032Cancelled on the phone“Declined” state, retry allowed
1037Phone unreachable / no responseTimeout state with guidance
1019Prompt expired — no PIN in timeExpired state, fresh retry
2001Wrong M-PESA PINPIN error, safe to retry
1004 / 13Another push already in progressDuplicate guard blocks spam
others40+ mapped result codesHuman-readable, logged for admin

// want this on your own platform? see the integration service →

Payments are infrastructure.
Build them properly.

STK Push, C2B, B2C, reconciliation and every failure mode — shipped the same way you just used it.