TicketBAI & Factura-e Code Generator (Basque Country / Spain)
Generate TicketBAI (TBAI) identifier codes, hash chaining, and QR Code URLs for Basque Tax Authorities (Araba, Bizkaia, Gipuzkoa).
Waiting for generation...
About the TicketBAI System (Spain)
TicketBAI is the mandatory anti-fraud tax compliance system instituted by the Basque Government and Provincial Treasuries of Araba, Bizkaia (Batuz), and Gipuzkoa.
Each invoice generates a digitally signed XML chained to the preceding invoice, a unique 37-character TBAI code, and a verification QR Code.
Anatomy & Structure of TicketBAI Code (Basque Country)
The TicketBAI (TBAI) identifier consists of 5 regulatory alphanumeric segments established by Basque tax authorities:
| Position | Field | Length | Regulatory Meaning | Example |
|---|---|---|---|---|
| Block 1 | Prefix | 4 letters | Mandatory regulatory prefix 'TBAI'. | TBAI |
| Block 2 | Issuer NIF | 9 chars | Tax identification number with provincial code (48=Bizkaia, 20=Gipuzkoa, 01=Álava). | B48159227 |
| Block 3 | Issue Date | 6 digits | Invoice date in DDMMYY format. | 240826 |
| Block 4 | CRC Signature | 8 hex chars | First 8 hex characters of the certified electronic signature. | D156961E |
| Block 5 | Check Digits | 2 digits | Modulo 97 checksum over the ASCII representation of the signature. | 65 |
TicketBAI Check Digit Calculation Algorithm (Modulo 97)
The 2-digit control segment validates the integrity of the invoice signature:
CheckDigit = (Σ ASCII(CRC8[i])) % 97
- 1. Signature Extraction: isolate the 8 hexadecimal characters of the signature segment.
- 2. ASCII Byte Sum: sum the ASCII code point values of all 8 characters.
- 3. Modulo 97: divide the sum by 97 to obtain the remainder.
- 4. Two-Digit Formatting: format the remainder with a leading zero (00 to 96) to produce the control digit.