A low balance, an expired card and a stolen card are three different problems. Most dunning setups treat them as one: same retries, same email, same silence in the CRM.
Good dunning reads why each payment failed, retries only what can clear, asks for a new card when nothing else will work, and tells the rest of the team.
Start with what Stripe already does
Before building anything, turn on what Stripe Billing gives you under Billing → Revenue recovery:
- Smart Retries. Stripe picks the retry times. The recommended default is 8 tries within 2 weeks, and you can stretch it to 2 months.
-
Hard decline protection. For codes like
stolen_card,lost_cardorincorrect_number, Stripe only charges again once there is a new payment method. - Customer emails for failed payments and expiring cards, with an update link.
- An end state when retries run out: cancel, mark unpaid, leave past due, or pause.
It's free and it's the right baseline. Everything below is about the gaps.
Where one schedule falls short
Recovery happens inside Stripe, where most of the team never looks. Sales doesn't know a customer is past due until the account is canceled. Someone calls a client about an upsell while their card has been failing for ten days.
The emails are the same for everyone. A customer whose card simply expired gets the same message as one whose bank flagged the charge. A $40 plan gets the same treatment as a $4,000 one, where a personal message from the owner would recover it in a day.
And the three failures behave differently:
- A low balance often clears on the next retry.
- An expired card fails every time until the customer updates it.
- A stolen card should never get a friendly "please update your card" email.
Treating them the same loses money on the first two and creates risk on the third.
Route by decline_code
Every failure lands in one of four groups. Each group gets its own path.
| Group | Typical Stripe codes | What happens |
|---|---|---|
| Retryable |
insufficient_funds, generic_decline, do_not_honor, try_again_later, processing_error
|
One short notice, Stripe keeps retrying, CRM shows "payment retrying" |
| Needs an update |
expired_card, incorrect_cvc, incorrect_number, authentication_required
|
Ask for a new card (or 3D Secure confirmation) right away, no wasted retries |
| Needs review |
stolen_card, lost_card, pickup_card, fraudulent, highest_risk_level
|
Never retried, no automatic email, a person gets an alert |
| Unknown | Anything not mapped yet | Don't guess. Alert a person and log the code |
Here's the map as a function you can drop into an n8n Code node or any webhook handler:
const GROUPS = {
retryable: ['insufficient_funds', 'generic_decline', 'do_not_honor',
'try_again_later', 'processing_error'],
needs_update: ['expired_card', 'incorrect_cvc', 'incorrect_number',
'authentication_required'],
needs_review: ['stolen_card', 'lost_card', 'pickup_card',
'fraudulent', 'highest_risk_level'],
};
function classify(declineCode) {
for (const [group, codes] of Object.entries(GROUPS)) {
if (codes.includes(declineCode)) return group;
}
return 'unknown'; // route to a person, log the code for later mapping
}
authentication_required deserves its own message: the card is fine, the customer just needs to confirm the payment with their bank.
Rules that keep it clean
One case per invoice. Track Stripe's own retries inside the same case, so the customer never gets duplicate emails from you and from Stripe.
Bigger accounts get a person. Above an amount you set, alert the account owner on the first failure.
Recovered only when paid. Close the case only when Stripe reports the invoice paid. If it's still unpaid after the last attempt, warn the team before the subscription is canceled.
Don't rely on the webhook alone. If one invoice.payment_failed event is missed, the case never opens. A daily check against open invoices catches what the webhook missed.
Mistakes we see most
- Retrying hard declines on a custom schedule. Every attempt on a stolen or invalid card is wasted and can look bad to card networks.
- Two sets of emails. Stripe's emails stay on while a separate tool sends its own.
- The CRM never finds out. Stripe cancels the subscription, the CRM still shows an active customer.
- Counting a retry as recovery. Only a paid invoice is recovered.
What to measure
Three numbers, monthly, before and after the change:
- Share of failed invoices that end up paid
- Average days from failure to payment
- Subscriptions that end because of a failed payment rather than a decision to cancel
Originally published on Heaq Digital, with the full flow diagram and FAQ. We build automations between CRMs, inboxes and payments for US service businesses.
Top comments (4)
I'd put the Stripe invoice lookup just before the email goes out. A slow queue is enough to get this wrong. The
invoice.payment_failedcomes in, Smart Retries gets the money while it's waiting, then the worker reads that olddecline_codeand goes to reopen the case in the CRM. Check the invoice there and you can drop the whole thing if it's paid.Good map — the check I'd run before trusting it in production is to trace one failure per group end to end in Stripe test mode, plus one code the map doesn't cover. Send an insufficient_funds, an expired_card, a stolen_card, and an unmapped code through the webhook, and check each lands in the group you intended, with the right email — or no email — the right CRM case, and no retry where the map says never retry. The two to watch most are generic_decline and do_not_honor in Retryable: if either ever comes back for a card that was actually stolen or invalid, the retry is the risk, not the recovery. If all four traces match the map, the routing is evidence, not just a table.
Routing by decline_code is the right call. A few things I'd add:
Do you handle the end state differently for annual plans than for monthly ones?
A daily check against open invoices catches what the webhook misses. One lost invoice.payment_failed event and the case never opens.