Skip to content
Dean's Notebook
Go back

After You Tap Pay: How Money Actually Moves

· 12 min readEdit page

Who this is for: engineers who want to understand the payments industry, and anyone about to follow this series.

What you’ll get: the difference between acquiring and payment; why “Payment successful” is a promise, not a receipt; the full journey of a cross-border payment from authorization to settlement; and why this series starts with Java fundamentals.

You tap “Pay” at checkout. The page spins for a moment, then shows “Payment successful.” The whole thing takes under two seconds.

But in those two seconds, the money hasn’t reached the merchant. Strictly speaking, it hasn’t even left your account — it has only been reserved. The actual movement of funds happens after you close the page.

That’s the first counterintuitive lesson of the payments industry, and the starting point of this series. Conclusions first:

TL;DR

1. Why I’m writing this series

I’m a backend engineer on the fund platform at Ant International, working on the fund control layer. A metaphor pins down my seat: the whole payment pipeline is a large freight company. The upstream business systems — commerce lines, payment networks, channel gateways — are the sales desk taking orders. The downstream capabilities — foreign exchange, accounting (the ledger), reconciliation, blockchain settlement — are the fleets and warehouses doing the actual work. My team is the dispatch hub in between.

Concretely: upstream calls us to initiate a payment. We record its information flow and money flow in full, orchestrate the route it must take — whether to exchange currency, which entries to book, when to clear, how to roll back on error — and coordinate the downstream capabilities to deliver the money safely. Each downstream step reports back; we advance the state and leave the evidence. The money never passes through our hands directly, but every step of every cent must leave a trace in our books.

Sit in that seat long enough and you notice something: the most expensive incidents are almost never crashes. A crash raises its hand — exceptions, alerts, on-call pages, the whole organization swarms it. What’s truly expensive are the errors that don’t raise their hand: a duplicate charge let through, a retry that silently vanishes, an “audit snapshot” rewritten along with the original object, a timeout treated as failure while the downstream actually charged successfully. They pass quietly through every monitor and surface weeks later as reconciliation breaks, customer complaints, or direct financial loss.

I’ve seen the cost of these errors, and I’ve seen how they root themselves in the most basic engineering details — a poorly overridden hashCode, a non-atomic compound operation, a shared mutable object.

So this series has a concrete mission: retell everything every backend engineer has already studied — Java, concurrency, distributed systems, databases — from the perspective of payment engineering. Not for interviews, but to answer one question: which class of silent failure does this mechanism guard against?

This is also the first formal practice of the “learning in public” I described when restarting this blog: I’ll separate what I’m sure of from what I’m guessing, cite sources for key claims, and correct mistakes when I make them.

2. Acquiring and payment: two sides of the same thing

The word “acquiring” is much younger than “payment,” and its origin is concrete: in the POS era of the 1950s, a cardholder signed a paper slip after swiping a card. The merchant collected these slips and periodically handed them to an acquiring institution in exchange for the proceeds. The institution “collected the transaction slips” — that’s literally where acquiring comes from.

The slips are electronic messages today, but the division of labor hasn’t changed:

The same movement of money, two perspectives. The industry abstracts this division into the four-party model:

flowchart TD
    CH["Cardholder<br/>(user)"] -- "swipes / links card" --> M["Merchant"]
    IB["Issuer"] -- "issues cards<br/>owns accounts & limits" --> CH
    AC["Acquirer"] -- "signs merchants<br/>processes & settles" --> M
    AC -- "authorization request" --> CN["Card scheme<br/>Visa / Mastercard"]
    CN -- "routes" --> IB
    IB -- "authorization response" --> CN
    CN --> AC

Each party has a job: the issuer stands behind the user — it owns the account, controls the credit limit, and decides whether to approve the transaction. The acquirer stands behind the merchant — it sends the transaction out and brings the money back. The card scheme never touches the money; it sets the rules and routes messages so that banks who have never met can speak the same language. Merchants and users usually don’t deal with banks directly — they face their acquirer and issuer, or a payment service provider (PSP) that wraps these roles.

The four-party model as a relay race: the payment message passes between cardholder, merchant, issuer and acquirer, while the card scheme referees with the rulebook

Keep this division in mind; every concept that follows hangs off it.

Takeaway: acquiring solves “the seller gets paid”; payment solves “the buyer pays.” The four-party model is the skeleton of the entire industry.

3. The instant you tap Pay

Back to the opening question: when the page says “Payment successful,” where is the money?

Answer: nowhere yet. What completed in those two seconds was an authorization — the information flow made a round trip; the money flow didn’t move an inch:

The instant of tapping Pay: above the line, light trails of information race toward the banks; below it, the vault and coins stay perfectly still — information flow first, money flow later

sequenceDiagram
    participant U as User
    participant M as Merchant app
    participant A as Acquirer / PSP
    participant N as Card scheme
    participant I as Issuer
    U->>M: taps "Pay"
    M->>A: transaction request (amount, card, order id)
    A->>N: authorization request
    N->>I: routed to the issuer
    Note over I: risk checks, card verification<br/>limit / balance check<br/>hold the amount
    I-->>N: authorization response (approve / decline)
    N-->>A: relay response
    A-->>M: payment result
    M-->>U: "Payment successful" page
    Note over U,I: typically 1-2 seconds end to end<br/>money is only held, not moved

When the issuer approves an authorization, it’s saying “I’ll keep this money aside for this transaction” — a promise with an expiry date. Stripe’s public documentation is blunt about it: most card authorizations expire within 5-10 days (Stripe: Authorize and capture).

Turning the promise into actual money takes a second action: capture. The industry runs two transaction modes:

After capture, the money begins its real journey: clearing (institutions reconcile and agree who owes whom how much) → settlement (funds actually land in the merchant’s account). That’s typically T+N days later. Add reverse flows like refunds and chargebacks, and the full lifecycle of a payment is far longer than those two seconds.

This is also why payment systems are hard: the instantaneous state you see on a page sits on top of a fund pipeline that spans multiple institutions, multiple currencies, several days, and can reverse at any moment. Every step can fail, and every failure involves real money.

Takeaway: information flow first, money flow later. “Payment successful” is a promise, not a receipt.

4. The two ledgers: information flow and money flow

Ask a finance team “where did this money go?” and they won’t open a banking app to show you a balance — they’ll open a ledger. Payment systems work the same way: every payment lives in two ledgers at once.

Section 3 showed that the two are separated in time. But separation doesn’t mean they can drift apart: they must ultimately agree, or someone loses money. What guarantees the agreement? Two things.

First: double-entry bookkeeping. Every movement of funds writes at least two entries of equal amount and opposite direction — every debit has a credit. Why not a single record? Because a lone record can be lost or wrong and you’d never know; two mutually-checking entries expose any missing or unequal side immediately. This is also why payment systems are full of internal “transit accounts” and “pending-settlement accounts”: before money truly leaves the bank, it travels through an internal account system, leaving a paired entry at every hop. The internal ledger is a slow-motion replay of the money flow — every step traceable.

Double-entry as a balance scale: debit on the left pan, credit on the right, every entry mirrored by an equal one; the vault below stays still while the books record everything

Second: reconciliation. Every day, our books are compared line by line against the banks’ and channels’ books: information flow against money flow, internal ledger against external ledger, cross-checked in four directions. Reconciliation is the last line of defense of the whole pipeline — every silent error upstream, however deeply hidden, eventually surfaces here. That’s why I said in section 1 that every step of every cent must leave a trace: without traces, there is nothing to reconcile.

Takeaway: money may be slow; the books may never be wrong. Double-entry plus reconciliation is what lets a payment system promise first and move funds later.

5. The full journey of a cross-border payment

Let’s chain the concepts into one concrete example: a buyer in Berlin opens a Singapore merchant’s store, orders SGD 100, and holds a euro-denominated credit card.

This money passes four currency checkpoints:

CheckpointCurrencyWho decides
Acquiring currency (merchant’s price)SGDMerchant
Payment currency (buyer pays)EURBuyer’s card
Clearing currency (between institutions)USDClearing network
Settlement currency (merchant receives)SGDMerchant contract

One coin's cross-border journey: leaving Europe, passing two exchange booths and stamped ledger checkpoints, its tint shifting with each currency, finally arriving in Southeast Asia

The journey goes like this: at authorization the buyer gets a locked price — she sees a definite euro amount, and from that moment the FX risk sits on the platform side. After capture, euros enter the acquiring side. Inter-institution clearing runs in US dollars — why the detour? Because many local currencies are restricted from leaving their country (the industry calls them NDF, non-deliverable currencies), so the most liquid currency, USD, serves as the bridge. Before settlement, the funds convert back to Singapore dollars and land in the merchant’s account.

Every conversion carries FX risk and cost: who bears it, when the rate is locked, which rate is used — these are the core product decisions of cross-border payments, and the place where section 4’s two ledgers most easily disagree: the information flow says “paid SGD 100,” while the money flow may hold three real transfers — EUR in, USD across, SGD out.

Add clearing batches and settlement cycles, and the merchant actually seeing “funds received” is often days later. T+N isn’t technical slowness; cross-institution trust takes time to establish.

Takeaway: a cross-border payment is not one transfer — it’s a relay with currency exchanges. The four-currency model is its map; the two ledgers are its diary.

6. Money also flows backwards: refunds and chargebacks

The forward path is done, but a payment system has another half: the reverse.

Reverse is more dangerous than forward: on the forward path everyone wants it to succeed; on the reverse path the parties’ interests oppose each other. The state machine must allow rollback without corrupting terminal states; refunds must guard against duplication, over-refunding, and a dead original path (what if the card is closed?). A large share of industry loss incidents happen on reverse paths — because they are tested least and thought about last.

Takeaway: collecting money is passing grade; returning it safely is graduation. Reverse paths are where losses concentrate.

7. Why the first post is Java fundamentals

Fair question: for a payments series, why start with equals/hashCode instead of channel integration or reconciliation systems?

Because money amplifies every small mistake. In an ordinary system, a broken deduplication contract might be one dirty record; in a payment system, it’s a duplicate charge. In an ordinary system, retrying on timeout is routine; in a payment system, one wrong retry can make the downstream charge twice. On a fund pipeline, the correctness of basic mechanisms isn’t a code-quality issue — it’s a financial-loss issue.

From the dispatch hub’s seat, what we fear most isn’t a slow downstream — slow can be waited on and chased. What we fear is a downstream that is quietly wrong: reporting success without booking the entry, reporting failure after the money moved. Those errors can only be prevented by each step’s own fundamental correctness; the control layer and reconciliation are the safety net, not the excuse.

The first post, The Silent Failure Tax, is already written. It covers four Java fundamentals and the class of silent failure each one guards: the deduplication contract, atomic compound operations, immutable value objects, and the three-state error contract. With real crime scenes, it shows why a “thread-safe collection” can still double-charge, and why “unknown” must never be treated as “failed.”

The rough roadmap after that: language fundamentals → concurrency & memory → distributed consistency → payment domain modeling → system design & a capstone project. Every post starts from a concrete failure story, explains the mechanism thoroughly, then returns to the payment scenario.

See you in the next one.

Sources


Edit page
Share this post:

Previous Post
Building My Next Chapter: Engineering, AI, and a Wider View of the World