Articles · Payments · 6 min read

How M-Pesa STK push works on your store

By Ken Murithi · 20 June 2026

PAYMENTS

STK push is the prompt that appears on a customer's phone asking them to enter their M-Pesa PIN. It feels simple to the buyer, but a lot happens behind it, and that is exactly where weak integrations fail.

What happens when a customer pays

Your store sends a request to Safaricom's Daraja API with the amount and the customer's phone number. Safaricom pushes a PIN prompt to that phone. When the customer confirms, Safaricom processes the payment and sends the result back to your store through a callback URL.

The order should only be marked paid when that callback confirms success, not when the prompt is sent. This is the single most common mistake we see: stores that assume payment happened because the prompt appeared.

Why transactions get lost

Callbacks arrive asynchronously, sometimes seconds later, sometimes after a retry. If your store has no reliable callback handler, or the callback URL is not publicly reachable, the money leaves the customer's account but the order never updates. The customer is charged and sees nothing.

A production-grade integration reconciles every transaction: it records the checkout request, waits for the callback, and also queries Safaricom directly for any transaction that has not resolved. Nothing is left to chance.

What a reliable checkout needs

A publicly reachable HTTPS callback endpoint, idempotent handling so a repeated callback does not double-count an order, a status query fallback, and clear customer messaging while the payment settles. Get those right and M-Pesa checkout becomes the smoothest part of the buying experience.

Building something for the East African market?

Talk to us