Spanish Veri*Factu Invoice Hash Validator
Validate the authenticity, format, and checksum of Spanish Veri*Factu Invoice Hash.
About Spanish Veri*Factu Invoice Hash Validation
The Veri*Factu validator inspects QR URLs printed on Spanish invoices, ensuring the official AEAT domain (`sede.agenciatributaria.gob.es`), mandatory query parameters (`nif`, `numserie`, `fecha`, `importe`, `huella`), and format compliance.
Essential for technical billing software audits, QA pipeline assertions, and tax compliance validation in staging environments.
Anatomy & Structure of Veri*Factu (AEAT)
The Spanish Veri*Factu system specifies structured query parameters for immediate tax audit verification:
| Position | Field | Length | Meaning & Rule | Example |
|---|---|---|---|---|
| nif | Issuer NIF | 9 characters | Tax ID of invoice issuer (DNI, NIE, or CIF) | B12345678 |
| numserie | Series & Invoice | Up to 60 chars | Series code and sequential invoice number | FAC-2026-1001 |
| fecha | Date | 10 chars | Date of issuance formatted as DD-MM-YYYY | 26-08-2026 |
| importe | Total Amount | Variable | Total invoice monetary amount in Euros with 2 decimal places | 150.50 |
| huella | SHA-256 Hash | 16 hex chars | Cryptographic fingerprint of previous invoice for immutable chaining | a1b2c3d4e5f67890 |
Veri*Factu Cryptographic Chaining Algorithm (SHA-256)
Invoice chain integrity and immutability are guaranteed via the SHA-256 cryptographic hash function:
Fingerprint = SHA-256(NIF + Series + Date + InvoiceType + TotalAmount + PreviousHash)
- 1. Concatenate in UTF-8 all mandatory invoice tax fields without spaces.
- 2. Include the cryptographic fingerprint of the immediately preceding invoice to form the blockchain-like link.
- 3. Execute standard SHA-256 algorithm per FIPS PUB 180-4.
- 4. Extract the first 16 hexadecimal characters to embed in the QR code URL parameters.
- 5. The generated QR URL enables instant verification on the AEAT electronic tax portal.