The Tiny Tweak That Unblocked Revenue
An online electronics store in Nairobi was losing approximately 35 percent of its checkouts to M-Pesa STK Push timeouts. Customers would click "Pay," the STK prompt would arrive, but by the time they entered their PIN, the transaction had expired, or the prompt never appeared at all.
We implemented a single, 4-second timing adjustment and a micro-UX element that reduced failed payments by over 70 percent within the first week. The client recovered an estimated KSh 120,000 in previously lost monthly revenue. Here is exactly what we did.
Aggressive Timeouts
- 20-second default STK window
- Prompt expires before PIN entry
- Generic "Processing..." spinner
- No guidance or reassurance
- Users refresh and break the flow
Human-Friendly Timing
- 60-second extended STK window
- Countdown badge creates urgency
- Resend link provides a safety net
- Clear instructions at each step
- Users stay on the checkout page
The problem: Aggressive timeouts and PIN anxiety
The Safaricom STK Push API has a default validity window of 20 seconds. If the user does not input their PIN within that window, the request expires. Many users, especially on slower phones or with poor network, could not get to the prompt fast enough.
The fix: The 4-second buffer and countdown badge
Three targeted changes that together eliminated the majority of failed payments.
Extend the STK request timeout
We reconfigured the STK API call to request a 60-second timeout window, the maximum allowed by Safaricom, instead of the default 20 seconds. This alone gave users 3 times more time.
A simple parameter change in the API request. The time window moved from20 to 60 seconds.
Add a "Prompt Sent" countdown badge
Instead of a vague spinner, we added a small, animated badge right below the M-Pesa number field. It created urgency without panic and told the user exactly what to do next.
"M-Pesa prompt sent. Enter PIN within 45 seconds."The "No Prompt Yet?" safety net
After 10 seconds, if no callback was received, a small link appeared. This gave users agency and prevented them from refreshing the whole page.
"Didn't receive the prompt? Tap here to resend."The results
Recovered Revenue from the Same Cart
A 4-second adjustment in code, combined with clear user communication, unlocked a significant revenue stream that was already sitting in the cart.
The customers were already there. They had already decided to buy. A 20-second timeout was the only thing standing between them and the sale.
Give them more time. Tell them what is happening. Give them a way to retry. That is the whole fix.
Ready to recover your abandoned checkouts?
Stonehenge Digital builds e-commerce platforms with optimized STK Push timeouts, countdown badges, and one-tap resend links, designed to turn failed payments into completed sales.
Optimize My STK Push Checkout →Interested in E-Commerce Website with M-Pesa?
Let's build this for your business
Sell to any Kenyan with a phone. Full online shop with Safaricom STK Push payment — no card needed.