Problem: A payments platform routing transactions through 12 PSPs had no reliable way to handle network timeouts. A timeout meant the client could not know whether the charge had succeeded. Operations staff spent 4 hours daily reconciling mismatches.
Solution: Client-generated idempotency keys stored in Redis (24-hour TTL) prevented duplicate processing on retry. The outbox pattern wrote charge intents atomically to a Postgres table in the same transaction as the order record. A separate relay process forwarded to the PSP and updated the outbox with the outcome — idempotently re-runnable on crash.
Technology: Postgres · Redis · Go · Kafka
Optimisation pattern: idempotency-layer-outbox-pattern
Outcomes:
Zero duplicate charges in 14 months. Morning reconciliation process eliminated — 4 engineer-hours per day recovered. Manual PSP intervention reduced 91%.