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.

SettingDetails
ToggleEnable / Disable
DefaultEnabled

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.

SettingDetails
Default10,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.
SettingRangeDefault
Retry ScheduleDays 1–90, one or moreDay 1, 3, 5, 7, 14, 17, 21
Soft Retry Count0–53
Soft Retry Interval5–1440 minutes30 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

PhaseRetriesWhenWindow
Soft retryUp to 3Every 30 minutesDay 0
Retries 1–44Day 1, 3, 5, 7Day 1–7
Retries 5–73Day 14, 17, 21Day 14–21
Total7 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

OptionDescription
Cancel (default)Subscription is cancelled. Customer receives a cancellation email with a reactivation link.
Retain ActiveSubscription remains active. No service interruption. Useful for high-trust customers.
PauseSubscription is paused. Can be resumed when payment is collected.

Invoice Final Action

OptionDescription
Write Off (default)Invoice is marked as uncollectible and written off.
Mark Not PaidInvoice is marked as “Not Paid” but remains on record.
VoidInvoice is voided and removed from the billing ledger.
Reverse with Credit NoteInvoice 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.

DayEmailSMS
0Payment Failed—
3Payment Reminder—
5Urgent NoticeYes
7Final Warning—
10Account Restricted—
14Final Notice—
14Account Suspended—
End of dunning periodCancellation / Final Action—
30Win-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 EventDunning Stage
Payment FailedInitial failure notification
Dunning Payment ReminderDay 3 reminder
Dunning Urgent NoticeDay 5 urgent notice
Final Payment FailureDay 7 final warning
Dunning Account RestrictedDay 10 restriction notice
Dunning Final NoticeDay 14 last chance
Dunning Account SuspendedDay 14 suspension notice
Dunning Subscription CancelledEnd of dunning period — final action
Dunning Win-Back OfferDay 30+ reactivation offer

Each template receives the following replacement data:

  • subscription.productName, subscription.planName, subscription.subscriptionId
  • account.name, account.email
  • dunning.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

VariableTypeDescription
subscriptionIdStringThe subscription in dunning
invoiceIdStringThe overdue invoice
orderIdStringThe associated order
accountIdStringThe customer account
tenantIdStringTenant identifier
correlationIdStringTracking ID for the dunning process
paymentMethodTypeStringPayment method type (card, mandate, etc.)
failureReasonStringGateway failure reason code
dueAmountNumberAmount due on the invoice
currencyStringCurrency code
dunningPeriodDaysNumberConfigured dunning period (from settings)
retryModeStringsmart or custom (from settings)
maxRetriesNumberMax retry attempts (from settings)
softRetryCountNumberSoft retry count (from settings)
softRetryIntervalNumberSoft retry interval in minutes (from settings)
retryIntervalsStringComma-separated retry day intervals (from settings)
subscriptionFinalActionStringcancel, retain_active, or pause (from settings)
invoiceFinalActionStringwrite_off, not_paid, void, or reverse_credit_note (from settings)
highValueThresholdNumberHigh-value account threshold (from settings)

Service Task Topics

The workflow uses the following external task topics, each handled by a dedicated service:

TopicPurpose
classify-declineDetermine soft vs hard decline
retry-paymentAttempt payment collection
check-dunning-payment-statusCheck if invoice was paid
send-dunning-emailSend stage-appropriate email
send-dunning-smsSend SMS notification
generate-payment-update-linkCreate self-serve payment URL
restrict-subscription-featuresRestrict premium features
escalate-to-manual-reviewFlag high-value accounts
cancel-dunning-subscriptionCancel after exhausting retries
mark-invoice-uncollectibleWrite off invoice
execute-final-subscription-actionExecute configured subscription final action
execute-final-invoice-actionExecute configured invoice final action
trigger-win-back-sequenceStart 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:

FieldRule
dunningPeriodDays1–90
retryModesmart or custom
customRetry.maxRetries1–12
customRetry.softRetryCount0–5
customRetry.softRetryIntervalMinutes5–1440
customRetry.retryIntervalsArray of day numbers, length must match maxRetries - softRetryCount
finalActions.subscriptioncancel, retain_active, or pause
finalActions.invoicewrite_off, not_paid, void, or reverse_credit_note

Response: The full updated configuration object.