Best Tweaks & Optimizations to Improve WHMCS Billing

Back   Posted on 1 september 2018 / Updated on 21 february 2023
Reading time 12 minutes

Details Make a Big Difference

You probably started using Billing Extension attracted by one of the following features:

We stop here with the list but there's more under the surface. In this article we focus on small things that make a big difference.

On WHMCS Tax ID, VIES and Tax Rules

Starting from version 7.7 (11th February 2019) WHMCS introduced Tax ID field in clients' profiles that is supposed to store VAT numbers. It took them more than 10 years to realize this field was needed but the sad reality is that this field can't be used.

As we say in our MUST read before launching a WHMCS site, over the years WHMCS kept messing up with invoicing. Sometimes it looks like they have no idea of what they're doing.

As opposed to WHMCS team, we take invoices very seriously. We spend weeks doing lot of research and tests before launching a new feature. On this premise Billing Extension never relies on standard Tax ID, VIES and Tax Rules of WHMCS.

We implemented alternatives like our own VIES checker. It's a really long story, but to keep things short, the VIES integrated in WHMCS doesn't work as it should. Same goes for Tax ID and Tax Rules. They don't work 100% of the times therefore we developed replacements as follows.

WHMCS Billing Extension Replacement
Tax ID

Create a Client Custom Field to replace the default Tax ID of WHMCS. Once done, depending on your country/federation, visit the following pages and use the provided dropdowns to connect the newly created field to Billing Extension:

  • For Europe: Addons > Billing Extension > Settings > VIES > VAT Custom Field
  • For Italy when Italian Electronic Invoicing plugin is in use: Addons > Billing Extension > Settings > Electronic Invoicing > Partita IVA
  • For Slovenia when Slovene Electronic Invoicing plugin is in use: Addons > Billing Extension > Settings > Electronic Invoicing > Registration Number
  • For Australia when Australian Toolkit plugin is in use: Addons > Billing Extension > Settings > Australian Toolkit > ABN Custom Field

Plugins can be installed from Addons > Billing Extension > Settings > +.

Tax Rules Custom Tax Rules page in Addons > Billing Extension > Settings > Tax Rules
VIES Custom VIES checker

We would have liked to rely on standard features of WHMCS but as we said earlier such features are not reliable. After years of disasters caused by poor decisions of WHMCS team, there was no other choice to get things done.

As a reference in 2017 WHMCS unilaterally changed tax calculation method causing thousands of invoices having wrong amounts. They even had the nerve to say it was all running as expected.

Moreover their VIES doesn't comply to EU regulations and due to a couple of bugs it could mark legit VAT numbers as invalid. It's not funny when you have to manually fix months of incorrect invoices and refund VAT to angry customers.

In conclusion we can't base serious concepts like electronic invoicing, ABN Lookup and taxes on such poor foundations whose manager is a company that changes things from day to night without knowing anything about billing.

WHMCS Replacements

In Billing Extension our primary goal is reducing workload and providing accurate information. As we said earlier, the problem with WHMCS is that some settings, features and pages are more or less out of focus. Not to say totally wrong.

Over the years we have been forced to replace or rebuild from scratch some of these components for the better to offer an improved experience. Keep reading to learn more.

General Settings

As soon as you install Billing Extension, the following alert appears in Setup > General Settings.

In a nutshell, some settings have been removed from the page and integrated directly in the module. This to avoid having the need to change analogous settings from two different places. Below there's an exhaustive list of settings we moved to Addons > Billing Extension > Settings:

  • Setup > General Settings > Localisation > Default Country
  • Setup > General Settings > Invoices > Store Client Data Snapshot
  • Setup > General Settings > Invoices > Enable Proforma Invoicing
  • Setup > General Settings > Invoices > Sequential Paid Invoice Numbering
  • Setup > General Settings > Invoices > Sequential Invoice Number Format
  • Setup > General Settings > Invoices > Next Paid Invoice Number
  • Setup > General Settings > Credit > Enable/Disable

Tax Rules

The default Tax Rules page of WHMCS has limitations. For example there's no way to enter tax name for each country. Moreover settings are scattered on multiple pages and some actions require your manual intervention in database.

With Billing Extension we replace Tax Rules of WHMCS with an improved version from which you can have everything under control. Take a look at the image below and focus on numbers inside circles:

  • 1 - Basic settings
  • 2 - Click on images to filter countries by continent
  • 3 - Easily enter tax names and rates including level 2 taxes
  • 4 - Set state-based tax rules by clicking on the icon

In regard to state-based tax rules, we point out that Billing Extension brings the concept of VAT exemption to states or regions. As you probably know, there's a big difference between 0% VAT and Tax Exempt.

This feature is particularly useful in Europe to handle regions like Las Palmas and Santa Cruz De Tenerife. They're both Spanish territories but they must go with Tax Exempt status.

Late Fees

Like Tax Rules, also Late Fees of WHMCS has limitations. This time Billing Extension doesn't replace anything unless you expressly request it. The module comes with an advanced late fees system that can be used in place of the default one.

If you decide to rely on our system, Billing Extension removes all settings listed below. This is necessary as using two late fees systems simultaneously is not possible:

  • Setup > General Settings > Invoices > Late Fee Type
  • Setup > General Settings > Invoices > Late Fee Amount
  • Setup > General Settings > Invoices > Late Fee Minimum

Invoices page

As we discuss in another article, the problem with WHMCS tables is real. What you see on screen is just a tiny fraction of the available data. That being said, an important page like Billing > Invoices needs more than 8 columns of data.

To this end, in Billing Extension there's an equivalent page that offers almost 40 columns of data. That's enough for pretty much anything. If you are more into our version of the page (why shouldn't you?), you could consider enabling Addons > Billing Extension > Settings > Admin Interface > Page Replacement.

By doing this, the module automatically replaces all links listed in Billing > Invoices menu with their counterparts in Billing Extension. This way you can comfortably access the enhanced features we have to offer.

Invoice Restrictions

We all know that an invoice once issued can't be changed. Even a small change requires that your customer agree on that change. Apparently it seems that only WHMCS doesn't know this rule. That's why we've been forced to implement things like:

But we didn't stop here. In Addons > Billing Extension > Settings > Admin Interface > Invoice Restrictions there is the following dropdown menu. Let us explain you what is the purpose of very option.

Merge and Mass Pay Invoices

Merge is a WHMCS feature that allows to combine multiple proformas into a single proforma. Even though the idea of merging proformas seems pretty fine, the action can be performed also on real invoices! This is a big problem since WHMCS doesn't draw a clear distinction between proforma, invoice and credit note.

Merging invoices results into billing errors. When you merge 4 invoices, WHMCS deletes 3 and "moves" them into the 4th invoice - the most recent. This is wrong in many ways as you are not allowed to:

  • Delete or change existing invoices
  • Have gaps in invoice number sequence.

Mass Pay faces a similar fate. It enables customers and administrators to pay multiple proformas at once. The bad news is that the action can be performed also on Paid invoices which makes no sense. Secondly Mass Pay creates a new invoice that is unnecessary.

In conclusion both features can't be used in most of the cases as they are known to cause billing errors. The thing is that WHMCS doesn't take invoicing too seriously. That's how it ends up messing it but that's another story for another time.

To avoid having someone on your team who inadvertently use Merge or Mass Pay, use Invoice Restrictions to remove both options from interface. If you are looking for something that eases invoice processing without breaking rules, take a look at WHMCS monthly invoicing.

Delete and Edit Invoices

As the name suggests, Delete ensures no one can inadvertently delete an existing invoice or credit note. As you can see from the image below, "delete" is available only for proformas. The other documents in the image are respectively an invoice and a credit note. You can distinguish them by the icon in use in the first column.

Similarly Edit ensures no one accidentally changes invocies. Editing an invoice requires you to press Enable Edit (1 in the image below). Without it you can't access invoice options (2) nor edit/add invoice items (3).

Display 0% Tax Rate and Zero Amount

Some countries require that tax always appear on invoices even when it shows 0% rate and zero amount. This feature can be enabled from Addons > Billing Extension > Settings > Billing Preferences > Tax Displaying. Here's the result.

VAT Calculation on Credit

When you apply tax on credit, WHMCS performs weird calculations on tax. Let's suppose we configured the system to charge 20% VAT (inclusive). We start with an invoice of 12 € that has been partially paid with 6 € of credit.

The customer has already paid VAT the moment he added funds to his account but here WHMCS is charging VAT a second time. Billing Extension detects this problem making sure customers are not charged VAT twice. Here's the correct version of the invoice.

However this solution comes with two downsides that sadly can't be avoided as WHMCS' design doesn't allow it.

First this fix triggers only when the proforma becomes paid turning into an invoice. Secondly, when the proforma is still unpaid, WHMCS still asks customers to pay VAT on credit but don't worry about it. Billing Extension automatically "refunds" the amount that was not due.

Tax Rounding Problem

We learned the hard way how silly is WHMCS when it comes the four basic mathematical operations (addition, subtraction, multiplication, division). Correcting numbers took us an incredible amount of code.

We could write a book about the nonsensical calculations made by WHMCS but it would be boring to read. If you want a taste of it, you can take a look at the following threads on WHMCS forum:

That said, here we don't want to annoy you with details so let's just jump to the core of the issue. WHMCS can cause billing errors due to inaccurate calculations in many ways (amounts, rates, coupon codes, overpayments, credit etc.).

To make things easier to understand, we show you an example. We have a WHMCS with inclusive tax and tax rate set to 22%. Let's create an invoice for an item that costs 14 €. Here's how WHMCS performs calculations:

  • Amount: 14 €
  • Subtotal: 11.48 €
  • 22% tax: 2.52 €
  • Total due: 14 €

We have 2.52 € of tax. Let's double check if it's correct. 22% of 11.48 € equals to 2.5256 € that WHMCS rounds down to 2.52 € but tax must always be rounded up.

Billing Extension automatically solves the problem by updating tax to 2.53 € and deducting 0.0044 € as a "full cent" (0.01 €) from invoice amount. This way you're not breaking any rule.

New Year, New Invoice Number

In some countries you are required to "start over" from 1 at the beginning of each new year. Unless you want to reset invoice number manually on January 1st at 00:00 o'clock, continue reading.

Billing Extension has a feature that automatically resets invoice number on January 1st at 00:00 o'clock a moment before WHMCS starts issuing invoices. This also applies to credit notes. No manual intervention is required.

You can enable this feature from Addons > Billing Extension > Settings > Billing Preferences > Reset Invoice Numbers. Keep in mind that the effectiveness of this feature depends on what version of Billing Extension you are running.

For version 2.2.145 and earlier, the only requirement is that your WHMCS cron runs at least every hour on the hour (eg. 00:00, 01:00, 02:00 etc.). If you are running it every 5 or 10 minutes it is still fine as long as it triggers at 00:00 o'clock.

For older versions, requirements are more restrictive. You must run WHMCS Daily Cron Job at 00:00am. If you don't do that and your cron runs at say 03:00pm, invoices issued from 00:00am to 02:59pm will still go with the numbering of the previous year.

Keep in mind that this doesn't cover invoices that gets automatically paid by WHMCS with credit. That's why we invite you to update Billing Extension to 2.2.145 and earlier. This way you don't have to worry about anything. Happy new year!

Invoice Status Fixer

From time to time WHMCS fails to update invoice status when invoice is being paid. This can happen with both credit balance and real payments. As result, you end up with a proforma that looks like follows.

This has nothing to do with faulty payment gateways, callback scripts or IPN. It just happens out of nowhere for reasons that I never managed to spot in more than a decade. You can find several threads on WHMCS forum describing this issue plus a couple of hooks like this one that try to solve it.

I am pretty sure this is a bug of WHMCS but it occurs so rarely that debugging and reproducing it is not an option. According to my experience, it happens less than 1% of times with credit balance.

Having paid invoices that remain unpaid may lead to bigger problems when automatic payments are involved. In essence WHMCS allows the overpayment of such faulty invoices giving causing a complex billing trouble to solve.

Starting from Billing Extension 2.2.162, the module incorporates a feature that automatically detects invoices left in this sort of limbo and fix them by triggering the "mark paid" event so that overpaymens can't do you any harm.

Comments (0)

Speak Your Mind Cancel Reply