> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dodopayments.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Subscription Dunning

> Automatically send email sequences to recover lapsed or cancelled subscriptions by prompting customers to update their payment method.

<Info>
  Subscription Dunning automatically sends email sequences to customers whose subscriptions have lapsed due to payment failure or customer cancellation, prompting them to update their payment method and reactivate.
</Info>

## What Is Subscription Dunning?

Dunning automatically detects when a subscription enters a recoverable state and sends a sequence of emails prompting the customer to take action:

* **On Hold subscriptions**: Renewal payment failed (insufficient funds, expired card, etc.)
* **Cancelled subscriptions**: Customer cancelled from the customer portal

## How Dunning Works

<Steps>
  <Step title="Trigger">
    Dunning is triggered when a subscription enters one of two states:

    * **On Hold**: A renewal payment failed (insufficient funds, expired card, etc.)
    * **Cancelled**: The customer cancelled their subscription from the customer portal
  </Step>

  <Step title="Email Sequence">
    Based on the trigger state, the system sends up to 4 dunning emails at
    configured intervals. Each email includes a link to the customer portal where
    the customer can update their payment method or re-purchase the subscription.
  </Step>

  <Step title="Recovery">
    When the customer updates their payment method through the customer portal, a charge is automatically created for remaining dues. If the payment succeeds, the subscription is reactivated and the dunning attempt is marked as recovered.
  </Step>
</Steps>

## Status Lifecycle

| Status       | Description                                                                  |
| ------------ | ---------------------------------------------------------------------------- |
| `recovering` | Dunning attempt is active; emails are being sent                             |
| `recovered`  | Customer updated payment method and payment succeeded                        |
| `exhausted`  | All emails sent with no recovery, or subscription state changed unexpectedly |

<Info>
  When a dunning attempt is marked as `exhausted`, the subscription state is not modified. The subscription remains in its current state (on hold or cancelled).
</Info>

## Configuring Dunning

Enable and configure Dunning from **Settings** in your dashboard.

<Frame caption="Dunning settings in the dashboard showing enable toggle, on-hold sequence, and cancelled sequence">
  <img src="https://mintcdn.com/dodopayments/tvJ2MmXYymW0IZ3R/images/recovery/dunning-settings.png?fit=max&auto=format&n=tvJ2MmXYymW0IZ3R&q=85&s=7389a9413d6008800e7ca8a5c4cd1ee5" alt="Dunning settings page with enable toggle, four on-hold emails at 1, 3, 5, and 7 day intervals, and four cancelled emails at the same intervals" style={{ maxHeight: '500px', width: 'auto' }} width="2250" height="1628" data-path="images/recovery/dunning-settings.png" />
</Frame>

### Email Sequences

Dunning supports two email sequences — **On Hold** and **Cancelled** — each with up to 4 configurable emails.

Each email has the following configurable fields:

| Setting      | Description                                              |
| ------------ | -------------------------------------------------------- |
| **Enabled**  | Toggle individual emails on or off without deleting them |
| **Delay**    | How long after the trigger event to send this email      |
| **Subject**  | Email subject line with variable placeholders            |
| **Body**     | HTML email body with variable placeholders               |
| **Reply-To** | Email address for customer replies                       |

**Default email timing:**

| Sequence  | Email # | Default Delay |
| --------- | ------- | ------------- |
| On Hold   | 1       | 1 day         |
| On Hold   | 2       | 3 days        |
| On Hold   | 3       | 5 days        |
| On Hold   | 4       | 7 days        |
| Cancelled | 1       | 1 day         |
| Cancelled | 2       | 3 days        |
| Cancelled | 3       | 5 days        |
| Cancelled | 4       | 7 days        |

### Example Dunning Emails

Dunning sends different emails depending on the subscription state. Below are examples of each type as seen by the customer.

<Tabs>
  <Tab title="On Hold">
    <Frame caption="Dunning email sent when a renewal payment fails and the subscription is on hold">
      <img src="https://mintcdn.com/dodopayments/tvJ2MmXYymW0IZ3R/images/recovery/dunning-on-hold-email.png?fit=max&auto=format&n=tvJ2MmXYymW0IZ3R&q=85&s=5e46040ed49a4da84569afdeeb87c813" alt="Dunning email for an on-hold subscription showing store name, message about failed payment, subscription details with plan and amount, and an Update Payment Method button" style={{ maxHeight: '500px', width: 'auto' }} width="1070" height="1502" data-path="images/recovery/dunning-on-hold-email.png" />
    </Frame>
  </Tab>

  <Tab title="Cancelled">
    <Frame caption="Dunning email sent when a customer cancels their subscription">
      <img src="https://mintcdn.com/dodopayments/tvJ2MmXYymW0IZ3R/images/recovery/dunning-cancelled-email.png?fit=max&auto=format&n=tvJ2MmXYymW0IZ3R&q=85&s=f404fbf9415df4e4bd01562a90bd2456" alt="Dunning email for a cancelled subscription showing store name, message about cancellation, subscription details with plan and amount, and a Re-purchase Subscription button" style={{ maxHeight: '500px', width: 'auto' }} width="1070" height="1502" data-path="images/recovery/dunning-cancelled-email.png" />
    </Frame>
  </Tab>
</Tabs>

## Customer Recovery Experience

When a customer clicks the link in a dunning email, they are taken to the customer portal where they can see their subscription status and update their payment method.

<Frame caption="Customer portal showing an on-hold subscription with option to update payment method">
  <img src="https://mintcdn.com/dodopayments/tvJ2MmXYymW0IZ3R/images/recovery/customer-recovery-page.png?fit=max&auto=format&n=tvJ2MmXYymW0IZ3R&q=85&s=f498d3654afd3d70447b7b8ce7bf3767" alt="Customer portal showing an on-hold subscription for Pro Plan at $95.00/year with an Update payment method button and a warning banner about the failed payment" style={{ maxHeight: '500px', width: 'auto' }} width="2144" height="734" data-path="images/recovery/customer-recovery-page.png" />
</Frame>

After the customer updates their payment method, a charge is automatically created for any outstanding dues. If the payment succeeds, the subscription is reactivated immediately.

For a cancelled subscription, customer is taken to a checkout page that already has the subscription added as the product.

## Analytics

Track the performance of Dunning from the **Recovery** tab in the **Analytics** section of your dashboard.

<Frame caption="Recovery analytics dashboard showing ACR and dunning metrics">
  <img src="https://mintcdn.com/dodopayments/B3-0kuKcZDP1TiJD/images/recovery/recovery-analytics.png?fit=max&auto=format&n=B3-0kuKcZDP1TiJD&q=85&s=d3bf0c7474818bc4584b75654423e14c" alt="Recovery analytics dashboard showing dunning entry counts, success rates, recovered revenue, and per-email performance breakdown" style={{ maxHeight: '500px', width: 'auto' }} width="2548" height="2190" data-path="images/recovery/recovery-analytics.png" />
</Frame>

| Metric                  | Description                                                 |
| ----------------------- | ----------------------------------------------------------- |
| **Dunning Entries**     | Total number of dunning attempts created                    |
| **Success Rate**        | Percentage of dunning attempts that led to recovery         |
| **Recovered Revenue**   | Total revenue recovered through dunning                     |
| **Recovery by Attempt** | Breakdown of which email in the sequence drove the recovery |

## Webhook Events

| Event               | Description                                           |
| ------------------- | ----------------------------------------------------- |
| `dunning.started`   | A dunning attempt has been started for a subscription |
| `dunning.recovered` | A subscription has been recovered through dunning     |

<Card title="Recovery Webhook Payloads" icon="code" href="/developer-resources/webhooks/intents/recovery">
  View the full webhook payload schemas for dunning events.
</Card>

## Edge Cases

| Scenario                                                   | Behavior                                                                   |
| ---------------------------------------------------------- | -------------------------------------------------------------------------- |
| Customer updates payment method before any email           | Recovery is detected; dunning attempt is marked as recovered               |
| Customer purchases another subscription from same business | Dunning attempt is marked as exhausted                                     |
| All dunning emails exhausted                               | Dunning attempt is marked as exhausted; subscription state is not modified |

## Best Practices

* **Start with defaults**: The default email timing is designed with reasonable spacing (1, 3, 5 and, 7 days) to avoid overwhelming customers while maintaining urgency.
* **Monitor success rates**: Track which email in the sequence drives the most recoveries. If later emails have near-zero conversion, consider disabling them.
* **Coordinate with support**: Ensure your support team knows that dunning emails are being sent, so they can assist customers who reach out.
* **Review subscription states**: Pair dunning with `subscription.on_hold` and `subscription.cancelled` webhooks for comprehensive lifecycle tracking.

<Info>
  Dunning works alongside the existing subscription on-hold and reactivation flows in the customer portal. Once enabled, it runs automatically with no additional integration required.
</Info>

## Related

<CardGroup cols={2}>
  <Card title="Recovery Webhooks" icon="webhook" href="/developer-resources/webhooks/intents/recovery">
    React to `dunning.started` and `dunning.recovered` events.
  </Card>

  <Card title="Abandoned Cart Recovery" icon="cart-shopping" href="/features/recovery/abandoned-cart-recovery">
    Recover incomplete or failed one-time checkouts with targeted emails.
  </Card>

  <Card title="Customer Portal" icon="id-card" href="/features/customer-portal">
    Customers update payment methods through the customer portal.
  </Card>

  <Card title="Subscriptions" icon="repeat" href="/features/subscription">
    Understand subscription states that trigger dunning workflows.
  </Card>
</CardGroup>
