← Architecture Lab

Wallet Transaction Flow

Money left the passenger and never reached the driver — the incident that turned a wallet into a ledger.

ride faredebit entryPassengerDriverWallet APILedger (MySQL)ProviderReconciliation

Passenger → Wallet API → Ledger

The debit leg

A ride completes and the passenger is charged. The debit is recorded as a transaction entry — not a mutation of a balance number. Balances are derived from entries, which means every rupee's history is reconstructable.

Why not the alternatives?

Single balance column, mutated in place
Fast and simple until the first dispute or bug — then there's no history to audit and no way to prove what happened. In a payments system, auditability is the requirement, not a feature.
Batch-only reconciliation (nightly job)
A nightly job finds yesterday's missing money. Real-time reconciliation finds it before the driver notices — the difference between an internal metric and a trust-destroying support ticket.

Lessons

  • The happy path was never the problem. Payments engineering is designing for the partial-failure states — debit succeeded, credit did not.
  • Reconciliation isn't an audit chore; treated as a first-class real-time component, it converts 'we think balances are right' into 'we know'.
  • Multi-provider support is an abstraction test: every new provider (especially across markets) surfaces assumptions the first two integrations baked in.