NEW TICKET#37 · Payments
Retry a payment call with backoff
Hannah Cole · Senior Engineer
Opened today
“The card processor sometimes answers "busy" for a second, and we show the customer a failed payment when a retry would have worked. chargeWithRetry should try up to 3 times. After a failure, wait 200ms and try again, then 400ms (the wait doubles each time). Only retry an error marked retryable: true: a declined card must fail at once, or we charge someone's card three times. Return what happened, including the total time waited, for the logs. The loop and the success path are written; the catch is yours.”
YOUR PLAN
- 1Watch an example2 min
- 2Warm-up 11 min
- 3Warm-up 21 min
- 4Fix the ticket26 min
BY THE END YOU CAN
- Await a call and catch what it throws
- Decide between retrying and giving up
- Back off by doubling a delay