How to Build an Idempotent Stripe Failed-Payment Recovery Sequence (With 5 Email Templates)
Involuntary churn happens quietly: a corporate card expires, an issuer triggers a temporary fraud hold, and a paying SaaS customer disappears without ever clicking Cancel. Here is the clean webhook and email architectur
Involuntary churn happens quietly: a corporate card expires, an issuer triggers a temporary fraud hold, and a paying SaaS customer disappears without ever clicking Cancel.
Here is the clean webhook and email architecture I use to handle invoice.payment_failed events without spamming customers on Stripe retries.
1. Classify Soft vs Hard Declines
Inspect invoice.payment_intent.last_payment_error.decline_code before choosing the message tone:
-
Soft declines (
insufficient_funds,do_not_honor,try_again_later): keep the Day 0 notice calm and mention that Stripe will retry automatically. -
Hard declines (
expired_card,lost_card,card_not_supported): ask directly for a new card using a 1-click hosted billing link.
2. Enforce Idempotency Per Attempt
Stripe delivers webhooks at-least-once. Deduplicate notifications on (invoice_id, attempt_count) so a retried webhook never sends two emails for the same failure.
3. Never Require a Login Wall to Update a Card
Forgotten passwords kill recovery rates. Route directly to Stripe Hosted Invoice pages or a pre-authenticated Customer Portal link ({{invoice_or_billing_url}}) so the customer can fix billing in under 30 seconds.
Copy-Paste Templates & Webhook Reference
- Interactive template customizer (with live merge tags): Failed Payment Email Templates
- Open-source MIT Markdown/JSON template pack: taieddie/stripe-dunning-email-templates
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.