CSE Roadmap

Core tier · about 5 hours · 8 parts

Part 6 of 8 · 2 min read

Reconciliation

The last line of defence.

Services talk asynchronously, and messages can be lost, so internal records and external ones can drift apart. Reconciliation compares states periodically to find and fix differences. It is the last line of defence.

The settlement file. Every night the PSP or bank sends a file with every transaction and the account balance for the day. The reconciliation system reads it and compares each line with the ledger. It also compares the ledger with the wallet, to spot internal drift.

A worked example (made up). The PSP file lists payments P1 to P5. The ledger has P1, P2, P3 and P5, but P5's amount is $25 in the file and $20 in the ledger, and P4 is missing from the ledger. Two mismatches: a missing entry and a wrong amount.

Fixing mismatches. Three kinds:

  1. Known cause and cheap to fix by program: fix automatically.
  2. Known cause but costly to automate: put in a queue for the finance team to adjust by hand.
  3. Unknown cause: put in a special queue for investigation.

Slow payments. Some payments take hours or days: a human reviews a risky payment, or a card needs extra confirmation from the cardholder. The PSP returns a pending status. The client shows it and offers a page to check the status. The PSP tracks the payment and calls the webhook when it ends. Some PSPs require the shop to poll instead.

Sync or async inside. Synchronous calls between internal services are simple, but they make slow, tightly coupled chains where one failure blocks all. Asynchronous messages through a queue (page 1 of this level) isolate failures and scale better, at the cost of simplicity and more careful consistency. A payment event published to a log can feed several consumers: the payment flow, analytics, notifications. For a large payment system, async is the better fit.

Read it as

Reconciliation is the nightly stock-take in a shop. The till says one thing, the shelves say another, and someone has to find out why.

Check yourself: 1. What does the settlement file contain? 2. Which kind of mismatch needs a person? 3. What does the client show for a payment that is pending?