Jump to content

credit management according to european fiscal law - a project


Remitur

Recommended Posts

The way WHMCS currently manages user credit is disrespectful of general European fiscal laws (and IMHO the way that WHMCS manages the credit is crazy and far from any logic).

In this thread I'm looking to find the best way to fix this problem, interfering as little as possible with current WHMCS automations.
Any idea and any suggestion will be welcome.

The way it currently works:

- The user pays 100 as credit; no invoice is issued, no VAT is charged, the user has 100 as credit in its account
- the user makes an order of 10 + VAT 22%, and pays it using credit
- the system issues the following invoice:
amount:       10
VAT               2,20
total:            12,20
credit:          -12,20
grand total:    0
and removes 12,20 from the user’s credit
- the user has an invoice with no reference to the payment he did in the past, and a credit of 100-12,20 = 87,80

How it should works:

- the user pays 100 as credit; the system issues an invoice for 81,97 + VAT 22%, the user has 81,97 as credit
- the user makes an order of 10 + VAT 22%, and pays it using credit
- the system issues the following invoice:
amount:       10
credit:         -10
subtotal:        0
VAT               0
total:             0
- the system removes 10,00 from the user’s credit
- the user has the original invoice for his payment, and a second zero-value invoice for the operation he did
- the user has a credit of 81,97 - 10 = 71,97

There may be a few variations, according to national laws:
- the zero-amount invoice may be not issued, or issued just like a “proforma invoice”, or as an internal receipt 
- the zero-amount invoice may be issued, but may be not registered

How to manage it? (loud thinking and brainstorming: your ideas will be appreciated)

Credit payment:
Bypassing all current WHMCS credit payment process (disabling the original one), and creating an add-on module that allows the creation of a service named “credit”.
The base price of this service is (i.e.) 10,00, and the user can order multiple items (up to, ie. 100)
The system issues an invoice, the user pays it, and the module at the activation of the order adds the credit to the user's account

Credit usage:
When a user pays an invoice using credit, a hook (  maybe InvoicePaidPreEmail: https://developers.whmcs.com/hooks-reference/invoices-and-quotes/#invoicepaidpreemail 😞
- check if credit has been used
- check if the user is subjected to VAT
- if subjected to VAT: correct the invoice as required, and credit to the user credit the VAT amount that WHMCS wrongly subtracted; thi can be done using AddCredit API (https://developers.whmcs.com/api-reference/addcredit/ )

Special case: invoice paid partly with credit, and partly with a different gateway
(I guess the best fix could be not allow such kind of operations: a user can pay using credit only if he has sufficient available credit to pay the invoice in full with credit)


 

 

Edited by Remitur
Link to comment
Share on other sites

  • 1 year later...

Seems 16 years after the issue was originally raised for any EU customer, which till now could fix that manually, the problem still remains, 1 month before digital invoicing comes into practice.
I've reinforced the problem with support who appears to be an excellent developer but to have noclue on the EU fiscal legislation. And this WILL bring some user to get fines, because WHMCS will start pushing illegal invoices directly into the tax agency archives.

Below is a copy of the ticket with references and legislation quotes:

Let’s focus on the core problem: the invoice. The report is a minor issue — we can easily pull the subtotal instead of the total. The real issue is that the final invoice (HTML/PDF) WHMCS generates is incorrect.

 

 

Scenario recap


The client has an uninvoiced credit of 10€.
An invoice for 10€ is generated.
The invoice is marked as paid using the credit.
WHMCS produces a “final” invoice showing a total of 0€.
That’s not just wrong; it’s illegal in Spain and much of Europe. WHMCS has been told about this for 16years, yet it persists.

Prior discussions (evidence that it’s an old, known problem)


Case1 – “Credit management according to European fiscal law” – posted on 22 Aug 2024: https://whmcs.community/topic/339796-credit-management-according-to-european-fiscal-law-a-project/. The user clearly explains why zerototal invoices violate EU law and how to fix it, but there was no followup from WHMCS.
Case2 – “Account prefunding credits” – 7 Feb 2008: https://whmcs.community/topic/34693-account-pre-funding-credits/. Users complained that credit zeroes out invoices and makes them look like free services.
Case3 – “Paid invoices showing zero balance” – 2009: https://whmcs.community/topic/89177-paid-invoices-showing-zero-balance/. Users report that invoices show zero once paid.
Case4 – “Credit into the invoice – paid but appears in 0” – 24 Sep 2007: https://whmcs.community/topic/22777-credit-into-the-invoice-paid-but-appears-in-0/. WHMCS staff responded that the invoice was “paid by credit,” implying it can show zero. This thread highlights the confusion and legal concerns caused by WHMCS treating creditfunded invoices as zerovalue invoices.
Case5 – “Tax on credits” – 2008: https://whmcs.community/topic/37369-tax-on-credits/. Users from the EU explain that failing to invoice credits and showing services as free is illegal. VAT must be charged on the credit invoice; subsequent invoices paid from credit should show the amount and 0€ due, but WHMCS doesn’t do this.
Case6 – Feature request “Invoices for 0.00 are illegal for many WHMCS users” – 2010: https://requests.whmcs.com/idea/invoices-for-0-00-are-illegal-for-many-whmcs-users. Users explicitly ask WHMCS to stop generating 0.00 invoices. If the service total really is 0, there should be no invoice.
Why it is illegal
Under EU and Spanish law:

Every sale or service requires an invoice showing the taxable base, VAT, and total. Even if the VAT is zero, the “Total factura” must equal the base.
Advance payments must be invoiced. The Spanish tax authority (Agencia Tributaria) states: “los empresarios y profesionales… deben expedir factura en los supuestos de pagos anticipados”. A credit on account is an advance payment, so there must be a proper invoice for it, with VAT.
Zerovalue invoices are allowed only when there is a 100 % discount or return. Paying with credit isn’t a discount; it’s the settlement of a debt using funds already invoiced. Therefore, a zerototal invoice misrepresents the transaction and can be treated as a null invoice by the tax authorities.
Digital invoicing (e.g., Spain’s SII) will reject zerovalue invoices unless they meet those strict exceptions. Sending invoices with a total of 0€ to the Spanish tax agency will mark the income as zero — effectively tax evasion.
Why WHMCS must fix this
If WHMCS continues to issue invoices showing 0€ when the real service cost is >0€, every EU client using WHMCS 9.0 for digital invoicing is going to push illegal invoices into government systems. This is not a minor bug; it’s a compliance failure. WHMCS is exposing its customers to fines and even criminal liability for issuing fraudulent invoices.

I’ve been running companies in Italy and Spain since 2005, so this isn’t an academic complaint. You need to bring in a European tax expert and fix the invoicing logic immediately.

Issue a proper invoice when credit is added, showing the taxable base, VAT and total.
On the service invoice, show the service price and VAT, and then indicate that it’s paid via credit. The invoice can show a remaining balance of 0€, but it must not zero out the value of the service.
Sending digital invoices with zero totals is a direct invitation to tax authorities to classify the transaction as void and accuse your clients of tax evasion. That’s unacceptable.

WHMCS needs to address this now.

Here are the primary legal and regulatory sources referenced above:

AgenciaTributaria – Obligación de facturar (Spain) – Official guidance from the Spanish tax agency stating that businesses must issue invoices for all supplies of goods or services and must also issue invoices for advance payments
sede.agenciatributaria.gob.es
.
https://sede.agenciatributaria.gob.es/Sede/iva/facturacion-registro/facturacion-iva/obligacion-facturar.html

AgenciaTributaria – Libro registro de facturas expedidas (IVA) y de ventas e ingresos (IRPF) – FAQs clarifying that even operations exempt from VAT must be recorded, and the invoice’s “Total factura” must match the base amount
sede.agenciatributaria.gob.es
.
https://sede.agenciatributaria.gob.es/Sede/iva/facturacion-registro/preguntas-frecuentes/libro-registro-facturas-expedidas-iva-irpf.html

Ley 37/1992 del Impuesto sobre el Valor Añadido (Spanish VAT Law) – The consolidated text of the law, including Article 80 (reductions of the tax base) and related provisions on discounts and corrections.
https://www.boe.es/buscar/act.phpid=BOE-A-1992-28740

SAP SII tip – Invoices with zero amounts in Spain – A professional summary referencing Article 164.Uno.3.º, Article 78.Tres.2º and Article 80 of Spain’s VAT law, explaining that zeroamount invoices are only valid for 100% discounts or returns
community.sap.com
.
https://community.sap.com/t5/enterprise-resource-planning-blog-posts-by-sap/sii-tip-for-spain-6-invoices-with-zero-amounts-in-sii-due-to-full-discounts/ba-p/14228706



Dear WHMCS developers, hire somebody who knows what he talks about to take care of this, not a php developer. I love the software but this requires fixing.
 

thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated