Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Eseperio/verifactu-php/llms.txt
Use this file to discover all available pages before exploring further.
What Is VERI*FACTU?
VERI*FACTU is Spain’s mandatory digital invoice control system, established by Real Decreto 1007/2023. It requires businesses and self-employed individuals using invoicing software to submit cryptographically signed, hash-chained invoice records to the Spanish Tax Agency (AEAT — Agencia Estatal de Administración Tributaria) in real time. The regulation is part of Spain’s broader effort to combat tax fraud by creating an auditable, tamper-evident chain of all invoices generated by a computer system. The name itself — VERI*FACTU — is derived from verificable factura (“verifiable invoice”).The VERI*FACTU obligation has been delayed. The current timeline is 2027 for companies and 1 July 2027 for
self-employed individuals. Despite the delay, integrators building invoicing software should prepare now, as the
homologation process with AEAT takes time.
Who Is Affected?
The regulation applies to:- Spanish companies (sociedades) that use computer systems to issue invoices
- Self-employed individuals (autónomos) who use invoicing software
- Software providers who develop or distribute invoicing applications used in Spain (they must register their system with AEAT)
Key Legal Concepts
Understanding these terms from the regulation will help you work with the library correctly.| Term | Description |
|---|---|
| RegistroAlta | An invoice registration record. Submitted when a new invoice is issued. |
| RegistroAnulación | An invoice cancellation record. Submitted when a previously registered invoice is cancelled. |
| SistemaFacturacion | The computer invoicing system — the software that generates invoices. Each system must be registered with AEAT. |
| Huella | The SHA-256 hash of an invoice record. Each record includes the hash of the previous one, forming a chain. |
| CSV | Código Seguro de Verificación — a verification code returned by AEAT after a successful submission. Printed on the invoice. |
| QR Code | A QR code printed on every invoice, encoding a URL that allows recipients to verify the invoice on the AEAT portal. |
| Encadenamiento | The chaining block inside each record that links it to the previous invoice via its hash. |
What This Library Handles
Theeseperio/verifactu-php library covers the full submission lifecycle:
- Invoice registration (
RegistroAlta) — submitting new invoices to AEAT - Invoice cancellation (
RegistroAnulación) — cancelling previously registered invoices - Querying submitted invoices from the AEAT registry
- Hash (huella) generation — calculating the SHA-256 hash using the official AEAT field ordering
- XML serialisation — building the XML structures that strictly match the AEAT XSDs
- Digital signing — XAdES Enveloped signature using your PFX/P12 certificate
- SOAP transport — communicating with AEAT’s SOAP web service with certificate-based authentication
- QR code generation — producing AEAT-compliant QR codes for printing on invoices
- Error translation — mapping AEAT numeric error codes to human-readable messages
What It Does Not Handle
- Non-VERI*FACTU signed transactions (e.g. invoices issued outside of invoicing software)
- SII (Suministro Inmediato de Información) — a separate VAT reporting obligation
- Invoice PDF generation or printing
This library supports verifactu transactions only. For non-verifactu signed transactions, such as those required
when not using invoicing software, you will need a different library.
Environments
AEAT provides two environments for VERI*FACTU:| Environment | Purpose |
|---|---|
| Production | Real submissions to AEAT. CSVs returned are legally valid. |
| Sandbox (Homologation) | Testing and certification. Submissions are not legally binding. |
SOAP Endpoints
The library automatically selects the correct SOAP endpoint based on your certificate type and environment. The four endpoint constants defined inVerifactu.php are:
| Constant | URL |
|---|---|
Verifactu::URL_PRODUCTION | https://www1.agenciatributaria.gob.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP |
Verifactu::URL_PRODUCTION_SEAL | https://www10.agenciatributaria.gob.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP |
Verifactu::URL_TEST | https://prewww1.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP |
Verifactu::URL_TEST_SEAL | https://prewww10.aeat.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP |
Verifactu::config().
See Certificates for details on certificate types and how they affect endpoint selection.