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

# Dunning

> Retry failed subscription and membership payments on a schedule you set

Dunning retries failed subscription and membership payments for you. When a recurring [billing attempt](/documentation/manage/charges/payments) fails, Supercycle creates a dunning record on the charge, retries on the schedule you set, and stops after the maximum number of attempts. Configure it under  **[Risk](https://admin.shopify.com/apps/supercycle/settings/risk)**.

***

## How it works

Dunning starts when Shopify can't process a recurring billing attempt for a subscription or membership cycle. Checkout charges and one-off charges aren't retried this way.

Retries run once a day, after **Time between retries** has passed since the last attempt. Collection stops after **Maximum retries** failed attempts, counting the first and any failed **Retry now**. Canceling the charge cancels its collection too.

***

## Set up dunning

**1. Open Risk settings**

Go to  [Risk](https://admin.shopify.com/apps/supercycle/settings/risk). The settings are under Payment collection.

**2. Set the retries**

Enter the **Maximum retries** and the **Time between retries**, and select **Days** or **Hours** for the interval.

**3. Save**

Select **Save** in the save bar. The new schedule applies to dunning that starts from now on.

| Setting | Default | Description |
| - | - | - |
| Maximum retries | 3 | Failed attempts before collection stops, including the first and any failed **Retry now** |
| Time between retries | 2 | Wait after an attempt before the next daily retry |
| Retry unit | Days | Days or Hours |

With Maximum retries set to `7` and Time between retries set to `1` day, collection makes 7 attempts, counting the first:

* The first attempt fails.
* Retries run once a day, after Time between retries has passed since the last attempt.
* After the 7th failure, scheduled collection stops.

> [!NOTE]
>
> The failed charge email is turned on or off for the whole store under  **[Emails](https://admin.shopify.com/apps/supercycle/settings/emails)**. It can't be changed per dunning record.

***

## Retry a payment by hand

Select **Retry now** under Payment collection on the charge to take payment right away instead of waiting for the next scheduled retry. A failure counts toward **Maximum retries**. You can still do this after scheduled collection has stopped. See [Retry a failed payment](/documentation/manage/charges/charge-actions#retry-a-failed-payment).

***

## Automate with Shopify Flow

**Charge failed** fires on every failed billing attempt, once for each charge on the payment. **Payment collection failed** fires on each failed attempt for a charge in collection, including **Retry now**. Stopping collection doesn't send its own trigger.

On these triggers, `customer.outstandingBalance` is the unpaid total in cents, and `paymentCollector.failedPaymentCount` is how many attempts have already failed. See [Available triggers](/documentation/manage/automation/automation#available-triggers).

Use Payment collection failed to notify your team, pause or cancel the subscription, or take another action while attempts are running. To act only once failed attempts reach your **Maximum retries**, add a condition that compares `paymentCollector.failedPaymentCount` with that number.

Pair it with the **Create payment attempt** action to retry billing from inside a workflow, for example after a delay or once another system signals that the customer has updated their card. See [Available actions](/documentation/manage/automation/automation#available-actions) and [Create a workflow](/documentation/manage/automation/create-workflow).

***

## Failure codes

When collection isn't Active, open the charge to read the Card declined explanation of the latest failure. Read the raw code in the Last payment column on [Subscription contracts](/documentation/manage/subscriptions/subscription-contracts). See [Failure codes](/documentation/manage/subscriptions/billing-statuses#failure-codes) for what each one means and which need you rather than another retry.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.