Skip to content
Shahid Malla

WHMCS Hourly Billing: Native Limits, Modules and a Custom Build

Does WHMCS bill by the hour? What usage billing, billable items and credit can and cannot do, five ways to bill VPS hourly, how a custom module charges and suspends, what breaks, and a test checklist.

· Published · 10 min read · 8 steps

WHMCS hourly billing is not built in. The shortest recurring billing cycle is monthly, Usage Billing collects module metrics twice a day and bills them on the next renewal invoice, and billable items are hours that someone enters. For cloud-style hourly VPS billing from a prepaid balance, you need a commercial module or a custom hourly billing module.

I have built hourly billing for many WHMCS products, mostly cloud VPS plans and other services sold by the hour. I checked every WHMCS fact below against the official documentation on 16 October 2026. To hand the job over, see my 7-day scope near the end.

Five steps in the life of one service under a custom WHMCS hourly billing module: open the meter at creation, charge each hour once, warn on low balance, suspend at zero, then close the meter
The life of one hourly service, as the custom module in this guide handles it. Source: shahidmalla.com.

In words: CreateAccount builds the server and opens the meter. An AfterCronJob hook records each finished hour once, protected by a unique key. Low-balance emails go out at thresholds you choose, once each. At zero the module calls ModuleSuspend, and a top-up calls ModuleUnsuspend. A cancellation request or TerminateAccount closes the meter.

Does WHMCS support hourly billing natively?

No. WHMCS has no hourly billing cycle, and nothing built in measures server hours against a prepaid balance. The cycles in the pricing array of the AddProduct API run from monthly to triennially. Four features come close.

Built-in featureWhat it doesWhy it is not hourly billing
Billing cyclesA fixed price per cycle, monthly to triennially.Nothing shorter than a month.
Usage Billing (Metric Billing on the Module Settings tab)A module reports metrics, priced per unit, by total volume or graduated. The cPanel, DirectAdmin and Plesk modules report metrics already.The TenantUsageMetrics cron task updates usage twice a day, metric types are snapshot, daily or monthly, and the charge lands on the next renewal invoice. It never stops a server when money runs out.
Billable items and time billingLine items such as 3 hours at $50, added by staff or with AddBillableItem.Built for project time. Nothing measures the hours.
Credit balanceClients add funds, and Automatic Credit Use pays new invoices from the balance.Nothing deducts credit by the hour, and adding funds does not pay existing invoices.

The Usage Billing page recommends monthly cycles for metered products, because usage is captured on the Next Due Date. The billable items page presents time billing as staff time on client projects. The one official exception I found is the SolusIO addon, which bills virtual machine uptime at an hourly token rate on post-pay invoices, for SolusIO only.

What are the options for hourly billing in WHMCS?

There are five; the choice turns on whether customers pay before or after use.

OptionCustomer paysStops at zero?Fits whenMain drawback
Usage Billing with a custom metric providerAfter use, on the monthly renewal invoiceNoTrusted customers, and you write a server module anywayData refreshes twice a day
Prepaid credit with hourly deductionTops up first, then each hour is chargedYesPublic cloud VPS sign-upsCustom balance checks, alerts and suspension
Monthly postpaid with hourly usage linesAfter use, hours x rate on one monthly invoiceOnly through overdue suspensionBusiness customers with a saved cardA month of credit risk
Commercial module from the WHMCS MarketplaceWhatever it supportsCheck the moduleYour platform and pricing match itLicense fee, encoded code, its release schedule gates your upgrades
Custom moduleAny of the aboveYour ruleNothing you can buy fitsUpfront cost, and you own the upkeep

Before you buy, ask the vendor which WHMCS and PHP versions it supports, whether it suspends at zero within the hour or at the daily cron, and what the meter does when a customer cancels. A WHMCS Community thread raised that last point: a cancellation that waits for the daily cron keeps charging.

Decision flow for WHMCS hourly billing: rare start-stop means monthly cycles, a fitting module means buy it, stop-at-zero means prepaid credit, twice-daily data means Usage Billing, else monthly postpaid
The options table above as a flow. Source: shahidmalla.com, from the WHMCS documentation cited in this guide.

In words: if customers rarely start and stop resources, keep monthly or yearly cycles. If a Marketplace module fits your platform and pricing, buy it. If a server must stop when the balance reaches zero, use prepaid credit with hourly deduction. If usage data refreshed twice a day is enough, use Usage Billing with a custom metric provider. Otherwise bill monthly postpaid with hourly usage lines.

There is also a ready-made option: my Hourly Billing and Time Tracking module (I sell it) logs hours against WHMCS services at a rate per service and turns them into invoices. A custom build is still the right route when your rules go further than that.

How does a custom WHMCS hourly billing module work?

It is a server module that drives the platform, plus a usage table and a cron hook that charges each hour once. My VPS provisioning guide covers the platform side. Billing adds a job to each module function:

  • CreateAccount builds the server and opens the meter.
  • SuspendAccount and UnsuspendAccount power it off and on. Decide in writing whether a stopped server still pays for disk and IP.
  • TerminateAccount closes the last hour and destroys the server.
  • ChangePackage runs when an upgrade or downgrade is paid, for products and configurable options. It closes the open hour and starts the new rate.
  • MetricProvider, optional, reports hours to Usage Billing so clients see them on the service page, as the usage metrics docs describe.

The meter is a module table such as mod_hourly_usage: one row per service per hour, with the hour start in UTC, rate, amount and invoice ID. A unique key on service ID plus hour start makes double billing impossible.

Charging runs from an AfterCronJob hook. The cron hooks reference says it runs each time the system cron is called, after all scheduled tasks finish, and WHMCS recommends calling the cron every five minutes, so the hook must stay cheap. My hooks guide and cron guide cover setup. An outline, not production code:

add_hook('AfterCronJob', 1, function () {
    if (!hourlybill_lock()) {
        return; // an earlier cron run is still billing
    }
    foreach (hourlybill_services_with_a_finished_hour() as $svc) {
        if (!hourlybill_record_hour($svc)) {
            continue; // unique key hit: hour already charged
        }
        $hoursLeft = hourlybill_balance($svc->userid) / $svc->rate;
        if ($hoursLeft <= 0) {
            localAPI('ModuleSuspend', ['serviceid' => $svc->id, 'suspendreason' => 'Credit used up']);
        } elseif ($hoursLeft <= 24) {
            hourlybill_low_balance_notice($svc, $hoursLeft);
        }
        logActivity("hourlybill: service {$svc->id} charged {$svc->rate}");
    }
    hourlybill_release_lock();
});
  • Rounding. Charge each started hour or per minute; pick one and print it on the order page.
  • Rates. The pricing grid has no hourly column, so the module stores a rate per product and per configurable option value.
  • Time zones. Store UTC. WHMCS needs the web and cron PHP timezones to match, per System Timezone Issues.

How are the hours charged to the customer?

Through invoices, not by quietly removing credit, so each charge carries tax and shows on the client's invoices. The calls go through localAPI(), explained in my WHMCS API guide.

  • Prepaid. Available balance is the credit field from GetClientsDetails minus unbilled usage. Daily, or past a set amount, the module calls CreateInvoice with autoapplycredit, or pays it with ApplyCredit. AddCredit with type set to remove exists, but carries no tax line.
  • Postpaid. AddBillableItem with unit set to hours and invoiceaction set to nextinvoice. Its amount is the line total, not the rate.
  • Low balance. SendEmail with a custom product email at runway thresholds you choose, for example 24 and 4 hours, once each.
  • Zero. ModuleSuspend. WHMCS unsuspends after an overdue invoice is paid, and an empty balance has none, so the module calls ModuleUnsuspend when a top-up lands.
  • Cancellation. The System Cron page lists the CancellationRequests task as daily. The CancellationRequest hook fires when the client asks, so the meter stops then.
  • Mid-hour upgrades. My default is to charge the started hour at the higher rate and switch at the next boundary; the rule is configurable and stated on the order page.
  • Product price. Payment type Free stops WHMCS invoicing, but the Products page says it also removes the Next Due Date and blocks Client Area cancellation requests, so the module needs its own destroy button.

What breaks in WHMCS hourly billing?

Mostly money, and each failure has a known fix.

ProblemWhat happensPrevention
Cron overlapTwo runs charge the same hour.A database lock plus the unique key.
Clock driftHours are skipped or repeated.NTP, UTC, and hours counted from stored timestamps.
Failed platform API callSuspension fails, the server runs on, the balance goes negative.The Module Queue page says WHMCS will not retry failed actions itself, so the module retries, logs with logModuleCall() and alerts staff.
Refunds and disputesA top-up is charged back after the hours were used.Suspend on dispute, keep usage rows as evidence, refund only unused credit.
Tax on usageCredit removals escape VAT or GST.Taxed invoice lines (itemtaxedx in CreateInvoice).
No saved payment methodA postpaid month ends unpaid.A saved card for postpaid, or prepaid only.
First top-up blockedWith Require Active Order on, new clients cannot add funds before an approved order.Make the first top-up part of the first order. The Credit settings page warns that turning it off may raise fraud and chargeback risk.
AbuseStolen cards fund crypto mining for a few hours, then the payment is disputed.Fraud checks on first orders, a minimum deposit, CPU alerts and an acceptable use policy.

How do you test hourly billing before going live?

On a staging copy of WHMCS, with a test node and a gateway in test mode:

  1. Run a server for 61 minutes, then terminate. The charge matches your rounding rule.
  2. Start cron.php twice at once. One usage row per hour remains.
  3. Drain a balance. Each warning arrives once, the server stops, and a top-up restarts it.
  4. Block the platform API. The failed suspension is logged, retried and reported.
  5. Upgrade and downgrade mid-hour, then read the invoice lines.
  6. Request cancellation. The meter stops at the request.
  7. Invoice a taxed and a tax-exempt client.
  8. Refund a top-up and dispute a test payment.
  9. Reconcile a month of usage rows with invoices, to the cent.

Can a custom hourly billing module be ready in 7 days?

Yes, for a standard scope. Hire me, and a custom WHMCS hourly billing module is ready in 7 calendar days, counted from the day the written scope is signed and the platform API and staging access are ready. The speed comes from having solved these problems before. The standard scope covers:

  • One provisioning platform API.
  • One billing model: prepaid credit with hourly deduction, or monthly postpaid with hourly usage lines.
  • Hourly usage records with the double-billing protection above.
  • Low-balance emails, automatic suspension at zero and unsuspension after a top-up.
  • An admin usage report and a client-area usage view.
  • Testing on a staging copy of WHMCS before going live.
  • Two weeks of support after delivery.

Several platforms, tiered or spot pricing, and migrating balances from another system go into a phase 2 with its own date. Missing access or late answers move the date. The price is a fixed quote, or $55 to $65 per hour. See WHMCS custom module development, hire a WHMCS developer, or start a project with your platform and pricing rules.

When is hourly billing the wrong choice?

When customers rarely start and stop resources, it adds work without adding revenue.

  • Shared hosting. Nobody runs a website for six hours. Monthly and yearly cycles already work.
  • A small customer base. A few dozen VPS customers on stable plans earn the same on monthly pricing, and the module pays back slowly.
  • Support load. Hourly charges create tickets about amounts, stopped servers and vanished credit. A one-person desk should start with one hourly product.

What else do people ask about WHMCS hourly billing?

Can WHMCS bill by the minute?

Not natively; its shortest billing cycle is monthly. A custom module can charge per minute or per started hour. I pick one rule and print it on the order page.

How often does WHMCS Usage Billing update usage?

Twice a day. The TenantUsageMetrics cron task updates the metrics, and the charge lands on the next renewal invoice. WHMCS recommends monthly cycles for metered products, because usage is captured on the Next Due Date.

Can I bill a client for staff hours in WHMCS?

Yes, with billable items. Staff add line items such as 3 hours at $50, or a script adds them with AddBillableItem. That is built for project time, so nothing in it measures server hours.

Can WHMCS suspend a server when the client's credit runs out?

Not on its own. Nothing built in deducts credit by the hour, so a custom module tracks the balance and calls ModuleSuspend at zero. WHMCS unsuspends after an overdue invoice is paid, and an empty balance has no such invoice, so the module also calls ModuleUnsuspend when a top-up lands.

Last reviewed 16 October 2026. Disclosure: I sell WHMCS custom module development, including the hourly billing module described above, so I am not neutral. I founded WHMCSPilot, which sells premium WHMCS modules and themes, and I am CTO at ElySpace, a hosting company. I am not affiliated with WHMCS.

Share this article

Shahid Malla

Written by

Shahid Malla

Freelance WHMCS developer and web designer with 13+ years of client work. CTO at ElySpace, freelance developer for Marmaids LLC, and founder of WHMCSPilot and MagizAI.

Got a project like this?

Tell me what you need and I will send a written quote within one business day.