Skip to main content

Receipt Layout - TicketBAI

This page outlines the technical requirements for generating the invoice image, whether on paper or in a printable electronic format, within the TicketBAI system, based on the "Functional and Technical Specifications of the TicketBAI System 1.1" dated 09/03/2020.

Requirements

The TBAI invoicing software must generate and include a TBAI Identifier and a TBAI QR code on the invoice according to the specifications detailed below. These requirements are mandatory for both paper invoices and printable electronic formats (like PDF).

It is important to note that these specifications do not change existing invoicing regulations but establish additional obligations for the taxpayer issuing the invoice within the scope of Personal Income Tax (IRPF) and Corporate Tax (IS).

TBAI files and invoice images with TBAI requirements should not be generated in test mode; they must correspond to real transactions. Non-final invoices (e.g., proformas) must not include the TBAI identifier and/or the TBAI QR code.

A generated invoice cannot be re-issued. Duplicates must be clearly identified as "duplicado" (duplicate) according to invoicing regulations.

Identifier

The TBAI Identifier is a code that identifies the invoice within the TicketBAI system and ensures the link between the printed invoice and its corresponding TBAI file.

Format and Content
It has a fixed length of 39 characters with the following structure:

  • TBAI (4 fixed uppercase text characters)
    • (1 separator character - hyphen)
  • NNNNNNNNN (9 characters of the taxpayer's NIF, official format)
    • (1 separator character - hyphen)
  • DDMMAA (6 characters of the invoice issue date in DDMMAA format, padded with leading zeros if necessary)
    • (1 separator character - hyphen)
  • FFFFFFFFFFFFF (13 characters: the first thirteen characters of the SignatureValue field from the associated TBAI file signature)
    • (1 separator character - hyphen)
  • CRC (3 characters: the result of applying the CRC-8 algorithm to the preceding 36 characters, in decimal format, padded with leading zeros if necessary). The CRC-8 algorithm is specified in Annex 3 of the specifications document.

Legibility
The font type and size must be similar to the rest of the invoice, ensuring readability by the recipient.

Lines
If it cannot be included on a single line, multiple consecutive lines are allowed. The last character of each line, except the last one, must be the "-" separator.

Example
TBAI-NNNNNNNNN-DDMMAA-FFFFFFFFFFFFF-CRC

QR Code

The TBAI QR code allows the recipient to easily obtain tax information related to the invoice. The taxpayer is responsible for ensuring its legibility. An invoice with an unreadable QR code will not be considered valid for TicketBAI purposes.

Size
Greater than or equal to 30×30 millimeters and less than or equal to 40×40 millimeters.

Error Correction Level
M

Encoding
UTF-8

Contrast
The color contrast between the QR code and the background must be sufficiently high to ensure legibility.

Quiet Zone
A minimum of 6 millimeters of white space around all four sides of the QR code is recommended.

Content
It must contain a valid URL pointing to the TBAI web application for invoice verification of the corresponding Tax Administration, including invoice data as parameters. Invalid characters in the URL or parameters must be URL encoded.

  • Base URL (examples):
  • Parameters (key: value):
    • id: TBAI Identifier (the 39 characters defined above).
    • s: Invoice series.
    • nf: Invoice number.
    • i: Total invoice amount (including VAT), format and value equal to the ImporteTotalFactura field in the TBAI file.
    • cr: Error detection code (CRC-8) calculated on the QR content up to that point (excluding the cr parameter and the &). It is included as the last parameter in decimal format, padded with leading zeros if necessary.

Example of QR Content
See this reference

Location on the Invoice

The location of the TBAI Identifier and the TBAI QR code depends on the invoice orientation:

Vertical Orientation
They will be located at the very bottom of the invoice. The TBAI Identifier will be on a single line, followed by the TBAI QR code below it.

Horizontal Orientation
They will be located on the far right side of the invoice. The TBAI Identifier will be on a single line, followed by the TBAI QR code below it.

Receipt-Example-1

Receipt-Example-2

Receipt-Example-3

Response

Here you can see an example response for the receipt:

Example
{
"TraC": {
"SQ": 21,
"Result": {
"RC": "OK",
"UserMessage": "Sum wrong: 18.00"
},
"ESR": {
"D": "2023-07-31T11:33:5",
"T": "18.00",
"TN": "4",
"FN": "2025.1-001-1-173",
"TaxA": [
{
"_": "Tax",
"TaxG": "A",
"Prc": "21",
"Net": "7.44",
"TAmt": "1.56",
"Amt": "9.00"
},
{
"_": "Tax",
"TaxG": "B",
"Prc": "10",
"Net": "8.18",
"TAmt": "0.82",
"Amt": "9.00"
}
]
},
"Fis": {
"Tag": [
{
"Label": "",
"Value": "*** TEST MODE ***",
"Name": "Testmode"
},
{
"Label": "Factura",
"Value": "202510011/173",
"Name": "FN"
},
{
"Label": "Código TBAI",
"Value": "TBAI-123456789-310723-asMr5NfOWtam3-141",
"Name": "TBAICode"
}
],
"Code": "https://ticketbai.araba.eus/tbai/qrtbai/?id=TBAI-123456789-310723-asMr5NfOWtam3-141&s=PLD_1&nf=1656623459638440&i=18.00&cr=139",
"ES_TBAI_Code": "TBAI-123456789-080525-hosF0ih251kzi-052"
}
}
}