The verdict in three sentences
A missed or duplicated webhook means either a paid order never shipped or a customer served twice — and on M-Pesa and Airtel Money in Nairobi, 2 to 5 % of notifications cause trouble. The fix rests on three pillars: idempotency (process each ID once), exponential retry (5 attempts over 24 h) and HMAC signature (reject fakes). Done right, this trio pulls order loss below 0.1 %.
Webhook problems and their frequency
Before fixing, measure. Here are typical mobile money webhook incidents in Nairobi, 2026 orders of magnitude.
| Problem | Raw frequency | Consequence | Fix |
|---|---|---|---|
| Duplicate notification | 2 - 4 % | Double processing | Idempotency (unique ID) |
| Delay > 30 s | 3 - 5 % | Order stuck pending | Async queue |
| Lost notification | 1 - 2 % | Payment unseen | Retry + polling |
| Fake webhook | Rare | Possible fraud | HMAC signature |
| Server timeout | 2 - 3 % | Provider re-sends | Fast 200 response |
Retry strategy and target delays
A good retry doesn't hammer the server: it spaces attempts. Here is a reference strategy and the delays to aim for.
| Parameter | Target | Note |
|---|---|---|
| Attempts | 5 over 24 h | Exponential backoff |
| Intervals | 1 min, 5, 30, 2 h, 12 h | Progressive |
| P95 processing delay | < 5 s | M-Pesa Daraja requirement |
| Provider ACK response | < 2 s | Else re-send |
| Target loss rate | < 0.1 % | After idempotency + retry |
| Event retention | 30 days | To replay if needed |
Mini case study
Wanjiru, who runs an online grocery in Nairobi, collected via M-Pesa and Airtel Money. Without an idempotent queue, about 4 % of her 900 orders/month (36 orders) were either duplicated or stuck pending — an estimated ~540,000 KES/month cost between disputes, refunds and missed deliveries (15,000 KES average basket). After deploying an idempotent queue + exponential retry + HMAC signature, the incident rate dropped to 0.1 % (under one order/month). Loss nearly eliminated, support team relieved.
Need a professional website?
Kolonell builds websites that attract clients, optimized for the Sénégalese market. Free quote in 2 minutes.
FAQ
What is webhook idempotency?
It guarantees the same transaction ID is processed only once, even if the provider sends the notification two or three times. You store the ID and ignore any repeat — no more double shipments.
Why exponential retry instead of fixed?
Because an incident is often transient (server briefly unavailable). Spacing attempts (1 min, 5, 30, 2 h, 12 h) gives the system time to recover without overloading it.
What is the HMAC signature for?
It proves the webhook truly comes from the provider and wasn't forged. Without it, a fraudster could fake a payment and trigger an unpaid shipment.
What does M-Pesa Daraja require on timing?
Daraja requires validating the notification in under 5 seconds, or the request times out and is re-sent. Hence the need for a fast ACK and asynchronous queue processing.
Let's talk about your project. We harden your M-Pesa, MTN and Airtel webhooks with idempotency and retry so you never lose an order. WhatsApp +221 77 596 93 33.
Mohamed Bah
Fondateur, Kolonell
Passionate about digital and entrepreneurship in Africa, Mohamed has been helping Sénégalese businesses with their digital transformation since 2020. Founder of Kolonell, he believes every SME deserves a professional and accessible online présence.
