Best Tweaks & Optimizations to Improve WHMCS Billing

Best Tweaks & Optimizations to Improve WHMCS Billing

Back   Posted on 1 september 2018 / Updated on 25 october 2020
Reading time 5 minutes

Details Make a Big Difference

We know that things like WHMCS monthly invoice and cash flow statement for WHMCS attract the attention of many as they provide solutions to long-standing problems and needs. In this article we focus on small but relevant details.

If you are not ready to dive deep into details, you could keep exploring features included in Billing Extension:

We stop here but there are many more features accessible from the sidebar on the left. Let's go now.

On WHMCS Tax ID, VIES and Tax Rules

Starting from WHMCS 7.7 (11th February 2019), there's a new field named Tax ID that is used to contain the client VAT number. It took more than 10 years to WHMCS team to realize this was needed. So what's the problem excluding a decade of wait?

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

In our module we started to take invoicing seriously well ahead of time compared to WHMCS. We did a lot of research to get where we are now. Judging from WHMCS decisions on invoicing, they don't put the same effort into research and tests.

That being said, for certain things like Tax ID, VIES and Tax Rules we refuse to rely on WHMCS job as over the years they kept randomly ruining things believing that they could improve the situation.

That's why we implemented alternatives like our own VIES checker. We don't want to share too many details but in short, the VIES integrated in WHMCS doesn't work as it should. Same story for Tax ID and Tax Rules. Here's a recap of WHMCS features we don't use.

Feature Replacement
Tax ID

Client Custom Field only in the following countries/federations:

  • Europe Addons > Billing Extension > Settings > VIES > VAT Custom Field
  • Italy Addons > Billing Extension > Settings > Electronic Invoicing > Partita IVA
  • Slovenia Addons > Billing Extension > Settings > Electronic Invoicing > Registration Number
  • Australia Addons > Billing Extension > Settings > Australian Toolkit > ABN Custom Field

Except for VIES, other components need to be installed from Addons > Billing Extension > Settings > +.

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

Don't get us wrong. No one likes reinventing the wheel. We would have liked not to create alternatives and use existing features of WHMCS. More than once we tried to use them but after years of inexplicable decisions and changes made by WHMCS team, we split from them.

The straw that broke the camel's back was when they changed tax calculation method causing thousands of invoices with wrong amounts. That was one of the worst week of 2017 for our customers.

We simply can't base serious stuff like electronic invoicing and ABN Lookup on such poor foundations. Hopefully, this clears up any doubts about on why we ignore some features of WHMCS.

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.

Reset Invoice Numering for a New Year

In some countries invoice sequential numbering is required to start from 1 for a new year. This extends also to credit notes. Unless you want to make it manually every 31st of December at 00:00 o'clock, continue reading.

The module is capable of resetting invoice number automatically. No manual intervention is required. Visit Addons > Billing Extension > Settings > Billing Preferences and enable Reset Invoice Numbers.

Be aware of the fact that it is highly recommended to run WHMCS Daily Cron Job at 00:00am. If you don't do that and run cron at say 03:00pm, invoices issued from 00:00am to 02:59pm still use the numbering of the previous year.

Comments (0)

Speak Your Mind Cancel Reply