Failed payments and dunning Required
Retry failed renewals on a fixed schedule
Retry a soft-declined renewal a fixed number of times over a fixed window, such as 4 times in 14 days. Then move the subscription to a planned end state.
How to do it
Space the retries, such as after 1, 3, 7 and 14 days, or use the provider's smart retries. Never retry the same card several times in one day. After the last retry, apply the end state you chose, such as cancel, pause or move to a free plan, and tell the customer. Keep the schedule in configuration, so finance can read it without the code.
Example
dunning:
retry_after_days: [1, 3, 7, 14]
grace_period_days: 7
after_last_retry: cancel
messages: [on_failure, before_last_retry, on_cancel]
How to check
With a test clock and a card that declines for insufficient funds, the provider shows exactly the planned retries. Then the subscription ends in the planned state.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers payments playbook: https://agentwranglers.se/playbook/payments/failed-payments-and-dunning/dunning-schedule.