</>CodeWithKarani
All topics
Topic

Payments & Fintech

6 articles in this topic.

Payments & Fintech7 min read

Daraja API in Production: STK Push, C2B and B2C With Callbacks That Actually Work

A build-order guide to Safaricom's Daraja API with real payloads: OAuth token caching, STK Push, C2B v2 registration, B2C v3 with RSA security credentials, and the callback URL rules nobody documents.

Read
Payments & Fintech7 min read

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.

Read
Payments & Fintech6 min read

M-Pesa Reconciliation That Scales: From Paybill Statement to Trial Balance

Stop reconciling in spreadsheets. A three-way match between the Safaricom statement, your callback events and a double-entry ledger, with named break categories and a daily close job in Python and SQL.

Read
Payments & Fintech7 min read

Build a Payments Port, Not a Daraja Wrapper: Provider-Agnostic Money Movement in Africa

The right payments abstraction is a normalised state machine plus a normalised event, not a charge() function. Ports, adapters, webhook signature handling, minor-unit traps and config-driven routing.

Read
Payments & Fintech7 min read

KRA eTIMS Survival Guide: OSCU, cmcKey and the Rules the Spec Leaves Out

eTIMS is a fiscal device protocol, not an invoicing API. Real OSCU endpoints, the device handshake, a full saveTrnsSalesOsdc payload, the tax type codes, and six gotchas that will get invoices rejected.

Read
Payments & Fintech8 min read

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.

Read