0Pricing
Stripe Payments & SaaS Billing Systems · Lesson

Handling Failed Payments and Dunning

Keep subscription revenue healthy by understanding failed recurring charges, Stripe's automatic retries, and dunning emails that recover lost payments.

Handling Failed Payments and Dunning is a free Stripe Payments & SaaS Billing Systems lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Stripe Payments & SaaS Billing Systems learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Why Recurring Payments Fail

Subscriptions renew automatically, but cards expire, run out of funds, or get blocked. These involuntary failures are a major source of churn.

The past_due Status

When a renewal charge fails, Stripe moves the subscription to past_due. The customer still has access while Stripe attempts recovery.

What Is Dunning?

Dunning is the process of retrying failed charges and notifying customers to update their payment method, recovering revenue that would otherwise be lost.

Smart Retries

Stripe's Smart Retries use machine learning to pick the best times to re-attempt a charge, instead of fixed intervals.

Configuring Retry Behavior

In Billing settings you choose how many retries to attempt and what happens after the final failure: cancel, mark unpaid, or leave past_due.

Listening for the Failure Event

The webhook invoice.payment_failed tells you a renewal failed so you can react in your app.

function onWebhook(event) {
  if (event.type === 'invoice.payment_failed') {
    return 'flag account, prompt card update';
  }
  return 'ignore';
}
console.log(onWebhook({ type: 'invoice.payment_failed' }));

Dunning Emails

Stripe can automatically send branded emails asking customers to fix their payment method, with a secure link to update the card.

Recovery Link to the Portal

Those emails point to the Customer Portal, where the user can add a new card and immediately retry the open invoice.

When Recovery Fails

After the final retry, decide the consequence: canceled ends the subscription, while unpaid keeps it for later collection. Restrict feature access accordingly.

function accessLevel(status) {
  if (status === 'active' || status === 'trialing') return 'full';
  if (status === 'past_due') return 'grace';
  return 'blocked';
}
console.log(accessLevel('past_due'));

Measuring Recovery

Track your recovery rate: the share of failed invoices that eventually get paid. Improving it directly grows revenue.

Reduce Failures Proactively

Use card-account-updater and warn customers before cards expire to prevent failures rather than only reacting to them.

Quick Check

Which webhook signals a failed recurring subscription charge?

Recap

You learned to handle failed payments and dunning:

  • past_due status and Smart Retries
  • invoice.payment_failed webhook handling
  • Dunning emails linking to the Customer Portal
  • Tracking recovery rate and preventing failures proactively

Frequently asked questions

Is the “Handling Failed Payments and Dunning” lesson free?

Yes — the full text of “Handling Failed Payments and Dunning” is free to read here on the web, and the Stripe Payments & SaaS Billing Systems course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Stripe Payments & SaaS Billing Systems course, upgrade to CoddyKit PRO.

What will I learn in “Handling Failed Payments and Dunning”?

Keep subscription revenue healthy by understanding failed recurring charges, Stripe's automatic retries, and dunning emails that recover lost payments. You practise Stripe Payments & SaaS Billing Systems with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Stripe Payments & SaaS Billing Systems?

No prior experience is required. Stripe Payments & SaaS Billing Systems on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Handling Failed Payments and Dunning” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Stripe Payments & SaaS Billing Systems lesson?

Yes. Every Stripe Payments & SaaS Billing Systems lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Introduction to Stripe Subscriptions API
  2. Creating Products and Prices for Plans
  3. Customer Portal & Basic Billing Management
  4. Handling Failed Payments and Dunning
← Back to Stripe Payments & SaaS Billing Systems