Eduard Iadigarov say hello →
Interactive · one payment, end to end

Where does your money go after you tap Pay?

Follow a single payment through a backend built so it is never lost, never charged twice, never silently stuck. Scroll to move it along. Tap any block to jump there.

a walkthrough by Eduard Iadigarov · backend engineer, Java & Spring

Live simulation
0payments in flight
0settled
182 msp99 latency
0duplicates blocked
scroll
01 · The tap

It starts with a key

Your app sends POST /payments with an Idempotency-Key generated on the device. If the network hiccups and the app retries, the key stays the same.

That one header is what makes “charged twice” impossible later on.

HTTPSIdempotency-KeyUUID
02 · The front door

Who are you, and how fast?

The gateway terminates TLS, checks the OAuth2 token, applies rate limits per user and stamps a trace ID that will follow this payment through every system it touches.

OAuth2 / JWTmTLSrate limitingtrace-id
03 · Seen this before?

Idempotency in one atomic call

The payment service runs SET key NX in Redis. The first request wins the key. Any duplicate gets the stored answer of the first one instead of a second charge.

RedisSET NXTTL 24h
04 · Limits & risk

A decision in milliseconds

Daily limits, velocity checks, a risk score. It has to answer within a few milliseconds, so counters live in memory and the decision stays cheap: allow, challenge or decline.

sliding windowsrisk scorelatency budget
05 · The ledger

Write it down, exactly once

The payment row and an outbox event are written in one PostgreSQL transaction. Either both exist or neither does. Money is double-entry: every debit has a matching credit.

PostgreSQLACIDtransactional outboxdouble-entry
06 · The event bus

Tell everyone, reliably

A relay reads the outbox and publishes to Kafka. Notifications, analytics and the bank connector each consume at their own pace. If one of them is down, events wait, nothing is lost.

Kafkaat-least-onceconsumer groups
07 · Talking to the bank

Expect the bank to be slow

Timeouts, retries with exponential backoff, a circuit breaker. The connector sends the same idempotency key to the bank, so a retry can never turn into a second transfer.

What still fails after all retries is parked in a dead-letter queue, not dropped.

timeoutsbackoff + jittercircuit breakerDLQ
08 · The rail

Money actually moves

The instant-payment rail moves the funds between banks and confirms. The confirmation flows back through Kafka and the ledger flips PENDING → SETTLED.

instant paymentsISO 20022callbacks
09 · 03:00 AM

Trust, but reconcile

Every night a job compares the bank statement with the ledger, line by line. Anything that doesn't match (a lost callback, a double, a missing cent) gets fixed or flagged before a customer notices.

batch jobstatement matchingidempotent fixes
10 · Someone is watching

Page people, not customers

Every hop emits traces, metrics and logs. Alerts fire on symptoms: rising latency, a growing dead-letter queue, a dip in settlement rate. The on-call engineer hears first, not support.

OpenTelemetryPrometheusGrafanaalerting
Now break it

Pick a failure. Watch it get absorbed.

› choose a scenario
Built by

Eduard Iadigarov

Backend engineer, Java & Spring. I work on payment integrations and the unglamorous, reliable plumbing around them, the kind of system you just scrolled through.

A teaching model: real systems differ in the details, not in the spirit. Built with Three.js.