Reconciliation is the only feature that matters on your worst day

Payment systems earn trust when they can prove the ledger matches the outside world, especially when retries, timing gaps and partial batches hit.

Every payments product looks similar while the network behaves. Money goes in, a webhook arrives, a row appears, and a balance updates. A webhook is the notification another system sends when something changes. You can build that flow in a fortnight, and it will pass a demo comfortably.

The difference between that demo and a system a finance director will sign off shows up when the network misbehaves. Those days are not rare. They are Tuesday.

The feature that decides whether the system can be trusted is reconciliation. By reconciliation, we mean the ability to take a period and prove that what your system believes happened matches what the outside world believes happened. When the two disagree, the system must say precisely where and why.

The report labelled reconciliation in an admin panel usually falls short of that. It often sums over the rows you already trust. That gives you a number, but it does not prove that the ledger matches the processor, the bank, or the accounting package.

A payment has several books, and they do not agree at the same moment

A payment is a conversation between several parties. Each party keeps its own book. Each party also has its own opinion about when something became true.

Your system, the processor, the acquiring bank, the customer’s issuer, and your accounting package will all eventually agree. They will not agree at the same moment. The gaps between those views are where the money appears to go missing.

Most of the failures we are called in to fix are not failures of correctness in the ordinary sense. Nobody computed a total wrong. Two systems disagreed about the state of a transaction for eleven minutes. Something in between read one of them, and a decision got made on a state that was true at the time and false afterwards.

The code was right. The model of time was wrong.

These five normal conditions break simple payment systems

We introduce these conditions deliberately in staging before anything goes live, because production will introduce them without asking.

  • The same webhook, twice. Providers retry. A callback you already processed arrives again, sometimes hours later, sometimes out of order with a newer one. The correct outcome is one ledger entry and an acknowledged duplicate, not two charges and a support ticket.
  • The write succeeded, the confirmation never arrived. Your database committed and then the connection dropped before your service knew. On recovery the system has to determine which of those two worlds it is in, without a human reading logs.
  • Two services disagree about now. Ordering by wall clock across machines is a bug waiting for a leap second or a slow NTP sync. If your sequence depends on comparing timestamps from different hosts, it will eventually be wrong and you will not be able to tell when it was.
  • The batch half lands. Four hundred of a thousand movements clear and the rest fail. The reconciliation has to identify the six hundred precisely, not report a mismatched total and leave somebody to find them.
  • A day is replayed at volume. Reprocessing a historic day must produce the identical ledger. If it does not, the ledger was never the source of truth, it was a cache of one.

Every one of those conditions is testable. None of them is exotic. They become expensive when you find them after go live, when the evidence has aged and the person who can explain the anomaly has left.

Idempotency has to cover the whole path

The common half-solution is to sprinkle idempotency keys on inbound endpoints and call it done. Idempotency is the property that lets a system recognise a repeat request and return the same outcome. Keys on inbound endpoints handle the duplicate webhook and nothing else.

Real idempotency has to be a property of the whole path. The key has to be derived from something the originator controls. It has to survive a retry from a different process. The stored result has to be returned rather than recomputed, because recomputing may produce a different answer if anything upstream has moved.

The subtle part is what you store against the key. If you store “processed”, you have protected yourself against double writing, but you cannot answer what the first attempt actually did.

We store the full outcome, including the identifiers of everything created. A repeat request then returns the original answer byte for byte. That turns a retry from a risk into a non-event, which is what the client integrating with you needs it to be.

Balances should come from movements you never edit

One structural decision separates systems that reconcile easily from systems that do not. Balances should not be stored and updated. They should be derived from an immutable sequence of movements, meaning movements that are kept as written rather than edited later.

The objection is performance, and it is a reasonable objection until you measure it. A running balance can be materialised, cached, and recomputed on demand. The cost of doing so is trivial next to the cost of a stored balance that has drifted for reasons nobody can reconstruct.

A stored balance is a claim. A derived balance is a proof. When somebody asks why an account shows what it shows, you can produce the working.

This also makes correction honest. In a mutable model, fixing a mistake means editing history, and the fix is indistinguishable from the error afterwards. In an append only model, a correction is another movement with its own reason and author.

Nothing is erased. The auditor sees what went wrong and what was done about it. That is a far better position to be in than having a tidy ledger with no explanation.

The systems we build have the same core shape

The shape is consistent across the payment systems we have delivered.

  • An event log of movements, immutable, with the originating reference from every external party attached to each one.
  • A projection layer producing balances and statements, rebuildable from scratch at any time, and rebuilt nightly as a test that it still can be.
  • A reconciliation job that pulls each counterparty’s own record for the period and compares it line by line, not in aggregate.
  • An exceptions queue for anything that does not match, with an age and an owner, because a mismatch nobody is looking at is worse than no reconciliation at all.
  • A dashboard whose primary number is the count of unexplained differences, which should be zero, and whose secondary number is the age of the oldest one.

The dashboard point is the one clients push back on most often. They want a percentage. Ninety nine point nine percent matched sounds excellent. The missing tenth of a percent can still be the problem that matters.

That missing tenth of a percent is not distributed evenly across harmless small transactions. It clusters. It clusters on exactly the cases that are unusual, and those cases are most likely to be somebody’s large and angry problem.

A small timing difference can hide a bigger failure

A client processing around forty thousand transactions a month came to us with a recurring problem. Roughly every fortnight, the finance team found a difference between the platform and the processor’s own statement.

The difference was never large, usually a few hundred pounds against a monthly volume in the millions, and it always resolved itself within a week or two. They had learned to live with it.

That phrase, learned to live with it, is the one that gets our attention. A difference that resolves itself is a difference nobody understands. A mechanism you do not understand is not safe just because it has been small so far.

What was happening was simple once we could see it. Refunds issued near midnight were being recorded against the day the request was made. The processor recorded them against the day they cleared.

On most days those were the same day. On the days they were not, the two books disagreed until the next statement caught up. Nothing was lost. Nothing was double counted. The system was using one clock for its own records and inheriting another for everyone else’s.

The fix was not complicated once it was visible. Every movement now carries both its own timestamp and the counterparty’s, and reconciliation compares like with like.

What made it worth doing was not the few hundred pounds. The same mechanism, applied to a settlement batch rather than a refund, would have produced a five figure difference on a bank holiday weekend. The team would have spent three days finding it under pressure rather than an afternoon finding it calmly.

Partial settlement needs a list, not a netted-off total

When a batch half lands, there is always a shortcut available. You can compare totals, spot that the difference equals the sum of the failures, post an adjustment, and move on. It closes the books and it takes an hour.

We do not do it, and we ask clients not to either. Netting off destroys the one thing that would have let you find the pattern.

Six hundred failed movements is a list. The list will tell you whether the failures share a payment method, a corridor, an amount band, or a customer.

Every time we have insisted on identifying them individually, the list had a shape, and the shape was the actual bug. Twice it was a limit at an intermediary that nobody on either side knew existed.

The acceptable discrepancy at the end of a day is zero

We ask every client the same question early: what is your acceptable discrepancy at the end of a day? The answer we want is zero, expressed in currency rather than percentage.

We want zero because any other answer is a decision to tolerate an unknown, and unknowns in a ledger compound.

Zero does not mean nothing ever mismatches. It means nothing mismatches without an explanation attached to it.

A timing difference that resolves at settlement is not a discrepancy. It is a known state with an expected resolution date. A difference nobody can account for is a discrepancy of any size. One penny of it is a reason to stop and look, because the mechanism that produced one penny will eventually produce a larger number.

This costs more early and less later

Honestly, this costs more up front. An append only ledger with projections and a real reconciliation harness is perhaps a third more work in the first phase than the version that stores balances and trusts webhooks. We say so in proposals, because the alternative is discovering it in month nine.

What it buys is that the second year is cheap. Systems built this way do not accumulate the sediment of manual corrections and spreadsheet adjustments that eventually makes a finance team distrust the software entirely.

We have inherited the other kind. The first job is always the same: work out which of the numbers can be believed. That usually means rebuilding the history from whatever external records still exist. That is far more expensive than building it properly, and it is done under pressure.

These questions show whether the ledger can be trusted

We ask teams these questions because the answers reveal how the system behaves on a bad day.

  • If we reprocessed last Tuesday from the raw inputs, would we get the identical ledger?
  • Where is the list of transactions that did not match, and who looked at it this morning?
  • What happens if our processor sends the same notification twice, four hours apart, with the second one stale?
  • Can we produce, for any balance, the complete list of movements that produced it?
  • Which of our totals are stored, and which are derived?

If the answers come back quickly and specifically, the system is probably sound. If they come back as “it has not happened yet”, it has, and nobody noticed.

More on how we build in this sector on our financial services page, and the wider argument about correctness under load in what has to be true at any volume.

Written by Brilliant Systems

Our engineers write these between projects. If something here is relevant to a decision you are making, we are happy to talk it through without it becoming a pitch.

Certified, partnered and awarded