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

# Dunning retries

# Decline Classifications, Smart Retries & Dunning

Fype manages payment recovery automatically using a rules-based dunning engine to handle transaction declines and retry failed charges.

***

## Decline Classifications

Fype separates payment failure codes received from gateway networks (Razorpay and Cashfree) into two distinct categories:

1. **Soft Declines (Recoverable)**:
   * **Causes**: `insufficient_funds`, `bank_timeout`, `network_error`, `temporary_decline`.
   * **Handling**: Bypasses immediate cancellation. The subscription status changes to `past_due`, and Fype schedules a smart retry campaign.
2. **Hard Declines (Unrecoverable)**:
   * **Causes**: `expired_card`, `cancelled_mandate`, `invalid_account`, `mandate_revoked`.
   * **Handling**: Bypasses the retry loop entirely. The subscription transitions to `cancelled` immediately and alerts the merchant via a `subscription.cancelled` webhook.

***

## Smart Retry Scheduling Rules

To maximize transaction authorization rates, Fype schedules retry attempts for soft declines using the following optimizations:

```
                  SOFT DECLINE DETECTED
                            │
               Is retry scheduled on Sunday?
              /                             \
            YES                              NO
            /                                 \
   Reschedule to Monday                        │
            │                                  │
            └───────────────┬──────────────────┘
                            │
              Does retry fall in nightly window?
              (11:00 PM - 3:00 AM IST)
              /                             \
            YES                              NO
            /                                 \
   Reschedule to 8:00 AM                       │
            │                                  │
            └───────────────┬──────────────────┘
                            │
               Is fail date late in month?
               (On or after the 28th)
              /                             \
            YES                              NO
            /                                 \
   Reschedule to 1st of                        │
   next month at 10:00 AM                      │
            │                                  │
            └───────────────┬──────────────────┘
                            │
                     Execute Charge
```

### 1. The Sunday Check

Fype automatically shifts retry attempts scheduled for a Sunday to Monday morning. Transaction success rates are historically lower on Sundays due to decreased bank processing speeds and low settlement activity.

### 2. Nightly Bank Maintenance Blackouts

Many Indian banks execute system maintenance windows late at night, resulting in high failure rates. Fype blocks retry attempts scheduled between **11:00 PM and 3:00 AM IST** and reschedules them to run at **8:00 AM IST** the following morning.

### 3. Salary Credit Optimization

For transactions that fail **on or after the 28th of the month**, Fype schedules the retry to occur on the **1st of the next month at 10:00 AM IST**. This aligns retry attempts with salary credits to maximize success.

***

## Dunning & Notification Schedule

While Fype is retrying charges in the background, it runs a configurable customer notification campaign:

| Attempt             | Reschedule CADENCE | Customer Notification Action                                            |
| :------------------ | :----------------- | :---------------------------------------------------------------------- |
| **Initial Failure** | -                  | Email / SMS notification of payment failure; card update link provided. |
| **Retry #1**        | + 2 Days           | Payment failed notification; subscription marked as `past_due`.         |
| **Retry #2**        | + 5 Days           | High-priority SMS / WhatsApp alert.                                     |
| **Retry #3**        | + 10 Days          | Final warning.                                                          |
| **Failure Limit**   | + 15 Days          | Max retries met. Subscription moves to `halted` (or `cancelled`).       |
