Payment cascading without double charge
Your task
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?
It covers
- Smart routing
- Cascade
- Decline recovery