AlgoViz

Payments after a lost response

medium 6 min

A customer presses pay twice after the first response disappears.

Video lesson · Chapter 1 of 5

The customer saw no receipt

0:00 / 4:23

One payment, two clicks, one ledger transfer

1:21Reel

Theory

Read or listen first. About 1 min.

What it is

A customer intent says what the buyer meant to pay. A processor operation identifies the external request. A ledger transfer records the economic movement. Keeping those identities linked lets the service recover a payment whose response was lost without treating every retry as another purchase.

Follow one $25 payment intent

Pay P7New transfer T1Buyer account− $25Merchant account+ $25Requests = 1 · Transfers = 1 · Net = $0
A single transfer for intent P7 moves $25 out of the buyer account and into the merchant account. The entries balance to zero.

Why it exists

A balanced transfer moves an amount between accounts within a single asset ledger. For a 25-dollar sale, the paired entries explain where the 25 dollars came from and where they went. Balancing entries can still describe the wrong purchase twice, so balancing and deduplication solve separate problems.

View diagram · Payment records
Buyer → Payment intent (authorize); Payment intent → Processor (stable key); Processor → Reconciler (settlement); Reconciler → Ledger (reconcile)
A stable identity and payload check make the retry safe.
Full size

Words to know

Idempotency key
A stable identifier grouping retries of the same logical operation.
Reconciliation
Comparison of independently recorded facts to find unexplained discrepancies.

How it works

Step through the idea, or press Play.

Step 1 of 3

Identify the intent. Store an operation key with a fingerprint of the intended amount, currency and parties. Reuse the key for retries. Reject a changed payload under the same key.

Understand it

Start here

The buyer taps Pay twice

A customer sees a spinner after tapping Pay. Follow the purchase through the processor and merchant ledger before deciding what a second tap should do.

The buyer taps Pay twice
One purchase, two tapsIntent P425 dollarsProcessorpendingLedgerpendingThe buyer taps Pay

Compare provider settlement to the local ledger.

Structure

Payment records

Payment records

Buyer → Payment intent (authorize); Payment intent → Processor (stable key); Processor → Reconciler (settlement); Reconciler → Ledger (reconcile)
A stable identity and payload check make the retry safe.

A split-brain customer receipt

Imagine a processor approved a 25-dollar payment but the local service crashed before issuing a receipt. Recover using the same payment identity and reconcile with provider state. Verify the ledger has exactly one balanced 25-dollar movement and the receipt refers to it.

From intent to reconciliation

Follow a 25-dollar payment

ObservationDurable evidenceRecovery
Customer submitsIntent with amount and currencyReuse its identity
Processor approves, response dropsProvider has an operationQuery or safely retry with the same key
Settlement arrives twiceOne identified settlementApply one corresponding movement
Customer is refundedOriginal movement remains visibleAdd a linked reversing movement

Define what a retry is allowed to repeat

If two requests share an idempotency key but disagree on amount, silently replaying the first result can hide a client bug. Check the identity against the intended payload. Document the provider’s retention window for keys. A retry after that window needs reconciliation against existing provider records before issuing a fresh operation.

Read the reconciliation report

A balanced local ledger proves an internal accounting property. It cannot prove that every approved external charge reached local storage. Compare independently recorded settlements to internal transfers by provider identity and amount. Surface missing, duplicate and mismatched entries separately so recovery can replay only the missing work.

Reconcile independently

  • Compare provider settlement to the local ledger.

Trust balance alone

  • Posting a duplicate movement can still balance.

Summary

The whole topic in one minute.

Keep intent, external outcome and internal movement traceable across retries. Corrections add an auditable movement and reconciliation checks the boundary between systems.

Sources