The M-Pesa checkout, step by step
This is the flow I build into client apps: the customer enters an amount, the prompt lands on the phone, the PIN is entered, the server confirms with the gateway, and the receipt is generated. Try it below. Nothing is charged.
What is happening
The demo copies the real sequence, including the part most developers skip: the money is only credited after the gateway confirms, never when the button is pressed.
- The app creates a pending record with the amount and the phone number.
- The server asks the payment gateway for a push. The gateway answers with a checkout id.
- The customer's phone shows the prompt and they enter their PIN.
- The server checks the gateway for that checkout id. Only a confirmed payment credits the wallet.
- A receipt is written with a reference, and it can go straight to WhatsApp.
Built for
Shops, saccos, riders and platforms that collect money on a phone. The same pattern covers payouts and refunds, with an approval step.
Want this in your product?
I wire it up on your own shortcode or gateway account.
Message me on WhatsAppCHECKOUTDuka Ledger
KES 200
Paying into your wallet
PUSH SENTCheck your phone
Mobile money
Pay KES 200 to Duka Ledger?
Enter your M-Pesa PIN to confirm this payment.
On a real phone this arrives as a system prompt.
CHECKINGConfirming with the gateway
Waiting for confirmation. The wallet is not credited until this comes back.
✓
Payment received
Wallet credited instantly
Receipt-
Phone07xx xxx 592
MethodM-Pesa
Time-
PaidKES 200
!
Payment cancelled
Nothing was charged. This is the commonest reason a checkout fails, and the app must say so plainly.