M-Pesa integration pitfalls that cost real money
Seven Daraja API mistakes we see weekly — and the production-grade patterns that fix them.
Seven Daraja API mistakes we see weekly — and the production-grade patterns that fix them.
M-Pesa integrations in Kenya look easy in the sandbox. Then production happens — duplicate payments, dropped callbacks, finance teams stuck reconciling 800 transactions in Excel.
Daraja callbacks fail more than you think. Idempotent, queryable transactions plus a reconciliation cron are non-negotiable.
A retry without idempotency means double-charged customers. Always design around an idempotency key the moment a transaction is initiated.
Daraja credentials in env files committed to a repo is one of the most common breaches we see. Use a real secret manager, vaulted access, and rotation.
Reconciliation is at least half of any real M-Pesa engagement. Automate it from day one. Your finance team will thank you.
Daraja error codes are surprisingly precise. Map and surface them — don't generalize to 'payment failed'.
Sandbox is permissive; production is not. Bulk B2C disbursements without rate-limit handling will silently start failing.
Every state transition for every transaction should be logged. When Safaricom or your auditor asks questions, you need answers ready in 30 seconds.
Founder of Thunder Studio. Nairobi-based engineer and designer building premium web, AI, and SaaS systems for category-defining brands across Kenya and beyond.
Field notes on premium web, AI automation, and modern brand systems — written for Kenyan operators building serious things.
An honest diagnosis of why business websites underperform — and the five interventions, in order, that turn a brochure site into a real revenue channel.
A no-fluff checklist for businesses planning a website redesign — covering strategy, content, design, SEO, performance, and launch. Built from years of redesign work.
A founder-friendly guide to integrating M-Pesa Daraja into your website, e-commerce store, or SaaS — covering STK Push, callbacks, reconciliation, and the mistakes that quietly lose money.