Code Room
System designHard
Question
Design a payment-routing layer that, on a soft decline from one PSP, cascades the same charge to a second (and third) PSP to recover the sale — 'decline recovery / payment cascading' — while guaranteeing the customer is charged at most once even though the same payment is attempted across multiple processors. ~5,000 charges/sec, each potentially hitting 1–3 PSPs. The danger: PSP A times out (you don't know if it charged), you cascade to PSP B which succeeds, and later PSP A's charge also lands — double charge. How do you cascade safely?
What a strong answer looks like
Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.
Learn the concepts
Loading whiteboard…
Run or narrate your approach, then ask the coach.