WHMCS guide

Find the clients WHMCS suspended after they paid.

WHMCS suspends by the next due date on the service, not by the invoice. When a payment closes the invoice without moving that date, the daily cron suspends a client who paid. When the open invoice is gone, a suspended client has nothing to pay to get back online.

DMS.S2 — Before you start

Before you run anything.

Read only

Every query below is a SELECT. It changes nothing. Run it in phpMyAdmin or the mysql client, on a copy of the database if you have one.

Fix the date before you unsuspend

If you unsuspend first, the service still carries the old due date and the next cron run suspends it again. Correct the next due date, then use Unsuspend.

Tested on sample rows

We ran each query on a test database with one row that should match and rows that should not: a suspension for abuse, a payment from yesterday, a free account. Neither of our two live installs has a suspended service today, so all three return nothing there.

DMS.S3 — The queries

Three ways to find them.

Suspended for non-payment, but paid until a future date

The service says it is paid up and is still off. Usually the date was fixed after the suspension and nobody clicked Unsuspend.

SELECT id, userid, domain, nextduedate, suspendreason
FROM tblhosting
WHERE domainstatus = 'Suspended' AND suspendreason LIKE 'Overdue%'
  AND nextduedate >= CURDATE();

Paid, but the due date did not move

The suspension that is coming: the invoice for the current due date is Paid, yet the service still points at that date. Payments from the last two days are left out so a cron that has not run yet does not show up.

SELECT h.id, h.userid, h.domain, h.nextduedate, i.id AS invoice_id, i.datepaid
FROM tblinvoiceitems ii
JOIN tblinvoices i ON i.id = ii.invoiceid
JOIN tblhosting h ON h.id = ii.relid
WHERE ii.type = 'Hosting' AND i.status = 'Paid' AND ii.duedate = h.nextduedate
  AND h.domainstatus IN ('Active', 'Suspended')
  AND h.billingcycle NOT IN ('Free Account', 'One Time')
  AND i.datepaid < CURDATE() - INTERVAL 2 DAY;

Suspended with no open invoice to pay

Overdue and suspended, but no Unpaid invoice for the service, so the client area offers nothing to pay. Often the invoice was cancelled.

SELECT h.id, h.userid, h.domain, h.nextduedate
FROM tblhosting h
WHERE h.domainstatus = 'Suspended' AND h.nextduedate > '1000-01-01' AND h.nextduedate < CURDATE()
  AND h.billingcycle NOT IN ('Free Account', 'One Time')
  AND NOT EXISTS (SELECT 1 FROM tblinvoiceitems ii JOIN tblinvoices i ON i.id = ii.invoiceid
                  WHERE ii.type = 'Hosting' AND ii.relid = h.id
                    AND i.status IN ('Unpaid', 'Payment Pending', 'Overdue'));

DMS.S4 — The addon

Or get the list inside the WHMCS admin.

Brasa Billing Audit runs these three checks with the rest of its billing checks, links each finding to the service and e-mails admins when a new one appears. It never changes a service, an invoice or a payment.

Brasa Billing Audit screen in the WHMCS admin, with sample data

Brasa Billing Audit

$39 per year

Finds the billing records that do not add up.

  • Payment booked twice, and more money than the invoice was worth
  • Credit with no money behind it, and invoices marked Paid with nothing allocated or with every payment refunded
  • Client billed twice for one period, and a period that will never be billed
  • Suspended but paid up, a domain set to renew at 0 on a paid extension, a next due date after the registrar expiry, a late fee charged before the due date, a payment booked to no invoice or to a deleted one, a payment dated before its invoice was created, 48 checks in all
First run in 16 seconds, on sample data: the summary, then each finding with what to do about it. Brasa Billing Audit on the WHMCS Marketplace
Buy for $39

DMS.S5 — Questions

Bringing a paid client back.

Why did WHMCS suspend a client who already paid?

The cron reads the next due date on the service. WHMCS moves it only when the payment runs its own paid-invoice step. An invoice flipped to Paid another way (by hand, by the UpdateInvoice API or by a gateway module that closes it after removing a late fee) stays Paid while the service keeps the old date, so the cron still sees it as overdue.

How do I fix a service that was suspended by mistake?

Open the service under the client, set the next due date to the end of the period that was paid and save. Then click Unsuspend under Module Commands so the server account comes back. In the other order, the next cron run suspends it again.

A suspended client has no invoice to pay. What now?

If the period was already paid, move the next due date and unsuspend. If it was not, the invoice was usually cancelled: set it back to Unpaid on the invoice page so the client can pay it, and the payment moves the due date.