Cards & Money Handling
Stripe, Paystack, idempotency, rounding and not charging twice.
4 articles
Your spare Android phone is a payment gateway: an offline-first SMS relay for M-Pesa
M-Pesa till confirmations arrive as an SMS, and Daraja is not open to every merchant. So we turned a spare Android phone into a self-hosted SMS-to-HTTP gateway: encrypted on-device, HMAC-signed on the wire, and built so that it never loses a message.
Your M-Pesa Callback Will Fire Twice: Idempotency, Retries and the 1037 Problem
Daraja callbacks are unreliable notifications, not a source of truth. Seven production failure modes, with the database constraints, pollers and parsers that make double charges structurally impossible.
KES, TZS and UGX: Multi-Currency Ledgers and the FX Gap Eating Your Margin
There is no single exchange rate in East Africa. Minor-unit traps, largest-remainder allocation, quote expiry, realised versus unrealised FX, and a schema that records the rate you actually transacted at.
Your Queue Isn't Broken: Background Jobs Need Idempotency, Not Exactly-Once
A crashed worker charged the card twice. The queue did its job: at-least-once delivery. The real fix is an idempotent handler, not exactly-once infrastructure.