Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/josemmo/Verifactu-PHP/llms.txt

Use this file to discover all available pages before exploring further.

VERIFACTU is a Spanish tax regulation established by Royal Decree RD 1007/2023 that mandates the use of certified billing software (a Sistema Informático de Facturación, or SIF) to record summarized information about every invoice issued. Rather than replacing the invoice itself, VERIFACTU creates a tamper-proof chain of billing records whose goal is, in the law’s own words, to “guarantee the integrity, conservation, accessibility, readability, traceability, and unalterability” of those records. By chaining each record to the previous one via a SHA-256 hash, the regulation makes retroactive manipulation of billing history detectable — directly targeting VAT fraud through off-the-books accounting.

Who is affected

The obligation to comply with VERI*FACTU applies to all individuals and legal entities that are subject to any of the following Spanish tax regimes and have their fiscal domicile under Spain’s common fiscal regime (régimen común):
  • IRPF (personal income tax) arising from economic activity
  • Impuesto de Sociedades (corporate income tax)
  • IRNR (non-resident income tax) through a permanent establishment in Spain
Two categories are explicitly exempt from this requirement:
  1. Businesses already enrolled in SII (Suministro Inmediato de Información), which submit invoice data to the AEAT daily through a separate mechanism.
  2. Operations that do not legally require an invoice, or that operate under special billing authorizations granted by the tax authority.
If your business already files through the SII system, you are not required to implement VERI*FACTU. Check with your tax advisor if you are unsure which regime applies to you.

Two compliance modes

Businesses that must comply with VERI*FACTU can choose between two valid implementation modes. Both require the SIF to maintain a hash-chained record log, but they differ in whether records are proactively sent to the AEAT.
In VERI*FACTU mode, the SIF must transmit each registration record to the AEAT’s Electronic Headquarters immediately after the invoice is issued. Sending is automatic and near-real-time — the AEAT receives a copy of every billing record as it is created.Key characteristics:
  • Each RegistrationRecord is submitted to the AEAT right after issuance.
  • The AEAT acknowledges receipt and returns a status response.
  • Records must still be hash-chained before submission.
  • No electronic signature of individual records is required beyond the AEAT web service authentication.
This is the simpler operational model for most businesses because the AEAT always has an up-to-date copy, removing the need to respond to on-demand requirements.

What a billing record contains

A VERI*FACTU billing record is not a full electronic invoice. It is a lightweight, structured summary that contains just enough information for the AEAT to verify the integrity of the billing chain. A typical registration record includes:
FieldDescription
Invoice identifierIssuer NIF, invoice series/number, and issue date
Issuer nameLegal name or trading name of the invoice issuer
Invoice typeClassification code (e.g., standard, simplified, corrective)
Tax breakdownFor each applicable tax: taxable base amount, tax rate, and tax amount
TotalsTotal tax amount (CuotaTotal) and total invoice amount (ImporteTotal)
Previous record hashFirst 64 hex characters of the SHA-256 hash of the preceding record
Own hashSHA-256 hash of this record’s key fields, linking it into the chain
Generation timestampDate, time, and timezone offset when the record was created (FechaHoraHusoGenRegistro)
The breakdown does not list individual invoice lines — only the aggregated base and tax amounts per tax type and regime.

How this library fits in

Verifactu-PHP is a PHP 8.2+ library that handles the low-level mechanics of VERI*FACTU compliance:

Record creation

Provides typed model classes (RegistrationRecord, CancellationRecord, BreakdownDetails, …) so you can construct billing records with IDE autocompletion and type safety.

Hash chaining

Implements the exact SHA-256 payload format required by the AEAT spec. Call calculateHash() and the library computes the correct chain hash for you.

Validation

Every model exposes a validate() method backed by Symfony Validator. Catch InvalidModelException before submitting to the AEAT to surface any constraint violations early.

AEAT submission

Serialises records to the AEAT-specified XML schema and handles the web service communication, returning a parsed AeatResponse object.
Verifactu-PHP is a building block for SIF developers — it takes care of record formatting and submission, but it does not make decisions about when to issue invoices, store business data, or manage the event log. You integrate it into your own billing or ERP system.
Verifactu-PHP is not itself a certified SIF. Developers who build a SIF on top of this library are responsible for completing the AEAT’s self-certification process for their own software product, ensuring it meets all technical and operational requirements of RD 1007/2023.

Build docs developers (and LLMs) love