Dunning
When an invoice payment fails, Subscribd automatically retries the charge according to a configurable dunning schedule. Subscriptions that exhaust all retries without a successful payment are markedexpired and access is revoked.
Default retry schedule
Out of the box, Subscribd retries failed payments at:- 24 hours after initial failure
- 72 hours after initial failure
- 168 hours (7 days) after initial failure
expired and the SubscriptionExpired event is fired.
Configuration
retry_after array defines when retries are attempted, in hours after the first failure. You can add or remove entries to suit your billing cycle. For example, a weekly billing cycle might use [24, 96, 240].
How dunning works
- Payment fails — gateway fires
invoice.payment_failed(or equivalent). The subscription moves topast_due. - Retry job scheduled — a
RetryInvoicejob is queued for each interval inretry_after. - Retry succeeds — the invoice is marked
paid, the subscription returns toactive, andInvoicePaidis fired. - Retry fails —
PaymentRetryFailedis fired if the current hour matches anotify_atthreshold. - All retries exhausted — if
cancel_on_failistrue(default), the subscription is markedexpiredandSubscriptionExpiredis fired.
Custom dunning strategy
ImplementPixelworxio\Subscribd\Contracts\DunningStrategy to replace the built-in schedule with custom logic:
config/subscribd.php:
Notifying customers during dunning
Listen toPaymentRetryFailed to send reminder emails or in-app notifications:
AppServiceProvider::boot():
Manually retrying an invoice
Retry a specific invoice immediately, bypassing the dunning schedule:Invoice model. If the charge succeeds, the subscription returns to active.
Grace period
When a subscription enterspast_due, the billable retains access for grace_days (default: 3) before the subscription is expired. Configure this globally or per plan:
config/subscribd.php:
Updating payment methods
When a customer updates their payment method during apast_due period, trigger an immediate retry:
Checking dunning status
Next steps
- Hooks and Events — Events fired during the dunning cycle
- Webhooks — Receiving payment failure events from gateways