Everyone

Overdue Invoices & Late Fees

How Commerce automatically marks invoices overdue, suspends services, and applies late fees.

Last updated 1776211200

Scheduled Commands

Commerce uses three scheduled Artisan commands to handle the overdue lifecycle. All run via the Laravel scheduler — ensure your cron entry is active:

* * * * * cd /opt/opterius && php artisan schedule:run >> /dev/null 2>&1

Verify all scheduled commands are registered:

php artisan schedule:list
Command Schedule What it does
commerce:generate-renewal-invoices Daily 00:00 Creates upcoming renewal invoices
commerce:mark-overdue-invoices Daily 00:30 Marks past-due invoices as overdue
commerce:check-overdue-services Daily 01:00 Suspends services past the grace period

Marking Invoices Overdue

commerce:mark-overdue-invoices runs every day at 00:30 and performs the following:

  1. Finds all invoices with status unpaid where due_date < today
  2. Sets their status to overdue
  3. Sends the overdue reminder email to the client — exactly once, controlled by the notified_at timestamp column
  4. If late fees are configured (see below), adds a late fee line item to the invoice

The notified_at guard ensures that running the command again (e.g. after a server restart at midnight) does not send duplicate overdue emails to clients.

[!IMPORTANT] If the scheduler was not running and an invoice is 10 days past due, the command will still process it correctly on the next run and send one overdue notification. It will not back-fill multiple reminders.

Grace Period

The grace period is the number of days after the due date that a client has before their service is suspended. Configure it in Admin → Settings → Billing → Grace Period (days).

Example: Due date is April 1, grace period is 5 days → suspension can occur from April 6 onwards.

commerce:check-overdue-services (runs at 01:00) finds services where:

  • The linked invoice status is overdue
  • due_date + grace_period_days < today

For each matching service, it dispatches a SuspendHostingAccountJob, which calls the server agent to suspend the cPanel/hosting account and sends the Service Suspended email to the client.

Termination Grace Period

After suspension, there is a second configurable period before the service is terminated (deleted). Configure in Admin → Settings → Billing → Termination Grace Period (days).

Example flow with default settings:

Day Event
April 1 Invoice due
April 2 Marked overdue (00:30), overdue email sent
April 6 Service suspended (01:00) — grace period 5 days
April 16 Service terminated (01:00) — termination grace 10 days

[!WARNING] Termination is permanent. The hosting account and all its data are deleted from the server. Ensure your grace period values give clients enough time to pay before you risk data loss.

Late Fees

If configured, Commerce adds a late fee line item to the invoice when it moves to overdue.

Configure in Admin → Settings → Billing → Late Fee:

Field Description
Fee type fixed (e.g. $5.00) or percentage (e.g. 2% of invoice total)
Amount The fixed amount in your default currency, or the percentage
Enable Toggle to turn late fees on or off

When a late fee is added:

  • A new line item is appended to the invoice: "Late payment fee"
  • The invoice total increases by the fee amount
  • The client must pay the full new total (original + late fee) to settle the invoice

[!TIP] Late fees apply only once — when the invoice first moves to overdue. Running commerce:mark-overdue-invoices on an already-overdue invoice does not add a second fee.

Client Experience

When a service is suspended, the client:

  1. Receives a Service Suspended email
  2. Sees a suspension banner in their client portal
  3. Can still pay the overdue invoice — on payment the service is automatically reactivated

Related Topics