RECONCILIATION
Two records of one day, and three reasons they disagree
You reconcile Owoleaf's ledger against the processor's settlement file for one day. You pair rows by amount, queue whatever is left, and the totals bridge to the kobo. What do you know?
Reconciliation compares two independent records of the same money and explains every difference. For Owoleaf that is its own ledger of card top-ups and the processor’s settlement file for the same day. They disagree in three ways. A row is missing on one side. The amount differs, often because the processor netted its fee. Or the timing differs: a top-up at 23:58 lands in tomorrow’s file, and yesterday’s late one lands in today’s.
The fix is a set of matching rules run strictest first, an exceptions queue in which every item is a real break with an owner, and a totals check that bridges one total to the other.
// match on amount: the first row with the same amount wins
for (const l of ledger) {
const f = file.find((x) => !x.used && x.amount === l.amount && within(x.date, l.date, 1));
if (f) { pair(l, f); f.used = true; }
}
// whatever is left is "a break"// strictest rule first; each pass only sees what earlier passes left
matchOn(ledger, file, (l, f) => f.ref === l.ref && f.amount === l.amount); // 1 reference
matchOn(ledger, file, (l, f) => f.ref === l.ref && f.gross === l.amount
&& f.gross - f.fee === f.amount); // 2 fee netted
clearOpenItems(file, openItemsFromPreviousDays); // 3 carried in
matchOn(ledger, file, (l, f) => !f.ref && f.amount === l.amount
&& within(f.date, l.date, 1)); // 4 no reference
markInTransit(ledger.filter((l) => l.time > CUTOFF)); // 5 timing
queue(leftovers, ownerFor); // 6 exceptions
assert(bridge(ledgerTotal, fees, transit, carried, exceptions) === fileTotal); // 7 totals Watch the status column and the queue. MATCH ON AMOUNT pairs the two ₦25,000 top-ups the wrong way round and pairs today’s 23:58 top-up with yesterday’s: three wrong pairs, and the totals still bridge. MATCH ON REFERENCE ONLY makes no wrong pair but leaves eight exceptions, six of them false. The fix leaves two, each with an owner. FIX RULES, PARSER DROPS A ROW runs the same rules on a file whose no-reference row was skipped on load: no pair is wrong and L6 looks like an ordinary exception, but the totals bridge leaves ₦6,000.00 unexplained against the file’s control total: that is the check that shows a row went missing on the way in.
These are the fix’s passes, split between two people running them. The amount pass looks for equal amounts within a day. Order the passes so that at least one pair joins two different transactions.
GOAL: a matched pair joins two different transactions
Rewrite match to return pairs [ledgerIndex, fileIndex]. Rules, in order: same reference and same amount; same reference where the file row is net of a fee (gross === ledger amount and gross - fee === amount); then, for a file row with an empty reference only, equal amount with dates (whole days) at most one apart. Each row pairs at most once. Anything else stays unpaired for the exceptions queue. Amounts are kobo.
Payment operations at any wallet, merchant or payout company: the daily match of the ledger against processor settlement files, bank statements and scheme reports, with a fee line, an in-transit list and an aged exceptions queue. Safeguarding and custodial accounts are reconciled the same way, against the bank's balance. Settlement timing itself is the subject of the settlement float lesson.
“Design the daily reconciliation between our ledger and the bank.” Name the three mismatch kinds, then the rule order: reference, reference with fee, timing and carried-in items, amount and date for rows with no reference. Say why amount alone is unsafe. Describe the exceptions queue (owner, age, reason) and the totals bridge, and say what each catches. Mention that the ledger and the file must be independent, or the reconciliation proves nothing.
USED IN
Chapters that build on this lesson.
- Metric definitions and a single source of truthData and ML
- Clearing and settlement at the switch: files, netting and settlement riskPayments
- Double-entry bookkeeping for engineersPayments
- Idempotency and moving money exactly oncePayments
- LLMs in payments operations: reconciliation exceptions, dispute evidence and the controls around themPayments
- Project: a reconciliation engine that finds every planted breakPayments
- Project: a wallet with funding, transfers, refunds and daily reconciliationPayments
- Reconciliation: ledger against provider against bank statementPayments
- Settlement and payouts: timing, float, settlement accountsPayments
- Product analytics: funnels, cohorts and instrumentationProduct Manager
- AI and agent securitySecurity