Configure Dunning
BillHive provides a fully configurable dunning system that lets you control retry behavior, dunning duration, and final actions when payment recovery is exhausted. All settings are managed through the Dunning Settings page in the BillHive UI.
Dunning Settings Page
Access dunning configuration via Settings > Dunning in the BillHive dashboard. Changes apply to all new dunning processes started after the configuration is saved. Active dunning processes continue with the settings that were in effect when they started.
General Settings
Enable Dunning
A master toggle that enables or disables the automated dunning process for your tenant.
| Setting | Details |
|---|---|
| Toggle | Enable / Disable |
| Default | Enabled |
When disabled, failed payments will not trigger the dunning recovery workflow. Existing active dunning processes will continue to completion.
High-Value Threshold
Invoices with a due amount above this threshold are classified as high-value and escalated to manual review during the Escalation phase.
| Setting | Details |
|---|---|
| Default | 10,000 (in the subscription’s currency) |
High-value accounts receive additional attention and are flagged for manual review before any final actions are taken.
Retry Configuration
Retry Schedule
The days, counted from the first failed payment, on which the payment is retried. The schedule decides everything about timing:
- Number of retries: one per day in the schedule.
- Dunning period: the final action is taken after the last day in the schedule.
| Setting | Range | Default |
|---|---|---|
| Retry Schedule | Days 1–90, one or more | Day 1, 3, 5, 7, 14, 17, 21 |
| Soft Retry Count | 0–5 | 3 |
| Soft Retry Interval | 5–1440 minutes | 30 minutes |
Use recommended schedule fills in days 1, 3, 5, 7, 14, 17 and 21, based on payment industry practice. You can then add, remove or change days. The screen shows the result, for example “7 retries over 21 days”.
Soft retries are rapid retries attempted immediately after the initial failure (Day 0) to catch transient gateway errors. They run before the retry schedule begins.
Example
| Phase | Retries | When | Window |
|---|---|---|---|
| Soft retry | Up to 3 | Every 30 minutes | Day 0 |
| Retries 1–4 | 4 | Day 1, 3, 5, 7 | Day 1–7 |
| Retries 5–7 | 3 | Day 14, 17, 21 | Day 14–21 |
| Total | 7 scheduled | — | Final action after day 21 |
Earlier versions had separate Dunning Period, Max Retries and Retry Mode settings. They were removed because the schedule already decides all three; saving them through the API returns an error.
Final Actions
Configure what happens when the dunning period expires and all retries are exhausted.
Subscription Final Action
| Option | Description |
|---|---|
| Cancel (default) | Subscription is cancelled. Customer receives a cancellation email with a reactivation link. |
| Retain Active | Subscription remains active. No service interruption. Useful for high-trust customers. |
| Pause | Subscription is paused. Can be resumed when payment is collected. |
Invoice Final Action
| Option | Description |
|---|---|
| Write Off (default) | Invoice is marked as uncollectible and written off. |
| Mark Not Paid | Invoice is marked as “Not Paid” but remains on record. |
| Void | Invoice is voided and removed from the billing ledger. |
| Reverse with Credit Note | Invoice is reversed and a credit note is issued for the full amount. |
Communication Schedule
Notification emails and SMS are sent at key points during the dunning process. The schedule adapts to your configured dunning period.
| Day | SMS | |
|---|---|---|
| 0 | Payment Failed | — |
| 3 | Payment Reminder | — |
| 5 | Urgent Notice | Yes |
| 7 | Final Warning | — |
| 10 | Account Restricted | — |
| 14 | Final Notice | — |
| 14 | Account Suspended | — |
| End of dunning period | Cancellation / Final Action | — |
| 30 | Win-Back Offer | — |
Note: When the dunning period is customized, the communication schedule is proportionally distributed across the configured period. Days shown above reflect the default 21-day dunning period.
Notification Templates
Dunning emails use the following business event types, which should be configured in the notification template settings:
| Business Event | Dunning Stage |
|---|---|
Payment Failed | Initial failure notification |
Dunning Payment Reminder | Day 3 reminder |
Dunning Urgent Notice | Day 5 urgent notice |
Final Payment Failure | Day 7 final warning |
Dunning Account Restricted | Day 10 restriction notice |
Dunning Final Notice | Day 14 last chance |
Dunning Account Suspended | Day 14 suspension notice |
Dunning Subscription Cancelled | End of dunning period — final action |
Dunning Win-Back Offer | Day 30+ reactivation offer |
Each template receives the following replacement data:
subscription.productName,subscription.planName,subscription.subscriptionIdaccount.name,account.emaildunning.stage,dunning.paymentUpdateLink
Dunning Workflow (BPMN)
The dunning recovery process is implemented as a Camunda 7 BPMN workflow: dunning-recovery-workflow.bpmn. It is started automatically when any subscription enters dunning status.
The workflow now uses dynamic process variables loaded from the tenant’s dunning configuration at startup. This means changes to dunning settings are reflected in all newly started dunning processes without modifying the BPMN definition.
Input Variables
| Variable | Type | Description |
|---|---|---|
subscriptionId | String | The subscription in dunning |
invoiceId | String | The overdue invoice |
orderId | String | The associated order |
accountId | String | The customer account |
tenantId | String | Tenant identifier |
correlationId | String | Tracking ID for the dunning process |
paymentMethodType | String | Payment method type (card, mandate, etc.) |
failureReason | String | Gateway failure reason code |
dueAmount | Number | Amount due on the invoice |
currency | String | Currency code |
dunningPeriodDays | Number | Configured dunning period (from settings) |
retryMode | String | smart or custom (from settings) |
maxRetries | Number | Max retry attempts (from settings) |
softRetryCount | Number | Soft retry count (from settings) |
softRetryInterval | Number | Soft retry interval in minutes (from settings) |
retryIntervals | String | Comma-separated retry day intervals (from settings) |
subscriptionFinalAction | String | cancel, retain_active, or pause (from settings) |
invoiceFinalAction | String | write_off, not_paid, void, or reverse_credit_note (from settings) |
highValueThreshold | Number | High-value account threshold (from settings) |
Service Task Topics
The workflow uses the following external task topics, each handled by a dedicated service:
| Topic | Purpose |
|---|---|
classify-decline | Determine soft vs hard decline |
retry-payment | Attempt payment collection |
check-dunning-payment-status | Check if invoice was paid |
send-dunning-email | Send stage-appropriate email |
send-dunning-sms | Send SMS notification |
generate-payment-update-link | Create self-serve payment URL |
restrict-subscription-features | Restrict premium features |
escalate-to-manual-review | Flag high-value accounts |
cancel-dunning-subscription | Cancel after exhausting retries |
mark-invoice-uncollectible | Write off invoice |
execute-final-subscription-action | Execute configured subscription final action |
execute-final-invoice-action | Execute configured invoice final action |
trigger-win-back-sequence | Start post-cancellation campaign |
Dunning Configuration API
Dunning settings are managed via the following REST API endpoints.
GET /dunning-config
Retrieve the current dunning configuration for the tenant.
Response:
{
"enabled": true,
"dunningPeriodDays": 21,
"highValueThreshold": 10000,
"retryMode": "smart",
"customRetry": {
"maxRetries": 10,
"retryIntervals": [1, 3, 5, 7, 14, 17, 21],
"softRetryCount": 3,
"softRetryIntervalMinutes": 30
},
"finalActions": {
"subscription": "cancel",
"invoice": "write_off"
}
}PUT /dunning-config
Update the dunning configuration for the tenant.
Request body: Same schema as the GET response. All fields are optional — only include fields you want to update.
Validation rules:
| Field | Rule |
|---|---|
dunningPeriodDays | 1–90 |
retryMode | smart or custom |
customRetry.maxRetries | 1–12 |
customRetry.softRetryCount | 0–5 |
customRetry.softRetryIntervalMinutes | 5–1440 |
customRetry.retryIntervals | Array of day numbers, length must match maxRetries - softRetryCount |
finalActions.subscription | cancel, retain_active, or pause |
finalActions.invoice | write_off, not_paid, void, or reverse_credit_note |
Response: The full updated configuration object.
Related Topics
- How Dunning Works — Step-by-step flow explanation
- Dunning for Payment Types — Payment-type-specific behavior
- Pending Features — Planned enhancements