Create a dunning rule
POST/subscriptions/dunning-rules
Dunning rules must use a fixed
strategy. This means payments are retried on a fixed schedule.
When an invoice is created, it immediately becomes eligible for payment by the next payment run. If the first payment attempt fails then the invoice enters dunning. In subsequent payment runs, invoices are only considered for payment if they meet the dunning rules you create.
You can configure a dunning rule to be the default for your store. There can only be one default rule per store. All invoices in your store will then perform dunning according to the specified rules.
If no dunning rule is configured, then payment is retried once a day for 10 days, in total 11 payments. You can decide what action to take after the Subscriptions has stopped retrying the payments.
The following attributes are used to define a fixed
schedule:
- `payment_retry_unit - the unit of time used to measure the intervals between payment attempts or retries.
payment_retry_interval
- the number ofpayment_interval-units
to wait between each payment retry attempt.payment_retries_limit
- the number of times subscriptions attempts payments retries before anaction
is taken.action
- the action to take if payment is not successful.
For example, if:
- the
payment_retry_unit
isdays
- the
payment_retry_interval
is2
- the
payment_rety_limit
is10
- the
action
isclose
.
Subscriptions attempts to retry the payment every 2 days until 10 payment attempts have been tried. At that point, the subscription ends and it's status changes to inacive
.
Following on from this, you can specify that the dunning rule is no longer the default. You do not have to specify another rule to replace it. If you do remove the default dunning rule, the store defaults to the behavior that is followed when dunning is not enabled.
Request
Responses
- 201
- 400
- 500