ZATCA QR Code Fields Explained
The QR code on a ZATCA-compliant invoice encodes a TLV (Tag-Length-Value) data structure in Base64. It's not a simple URL — it's a cryptographically verifiable summary of the invoice. Here's what each field contains.
What is TLV encoding?
TLV is a compact binary format. Each piece of data is stored as:
- Tag — 1 byte identifying the field
- Length — 1 byte indicating how many bytes the value occupies
- Value — the actual data (UTF-8 string for most fields)
The entire TLV structure is then Base64-encoded to produce the QR code string.
The six TLV fields
| Tag | Field | Content | Example |
|---|---|---|---|
| 0x001 | Seller Name | Legal business name in Arabic or English | Riyadh Gadgets Trading Co. |
| 0x002 | VAT Number | 15-digit VAT registration number | 310000000000006 |
| 0x003 | Timestamp | Invoice date and time (ISO 8601) | 2024-01-15T10:30:00Z |
| 0x004 | Invoice Total (inc. VAT) | Total payable in invoice currency | 1725.00 |
| 0x005 | VAT Amount | Total VAT in SAR | 225.00 |
| 0x006 | Hash | SHA-256 hash of the signed invoice XML | Base64-encoded bytes |
Tag 05 — VAT Amount is always in SAR
Even if your invoice is in a foreign currency (e.g. USD), Tag 05 must contain the VAT amount converted to SAR. This is because ZATCA needs to aggregate VAT figures across all filings in the Saudi national currency. Saudi VAT Pro automatically reads the SAR-denominated TaxTotal from the XML to populate this tag correctly.
Tag 06 — the cryptographic hash
Tag 06 is what makes the QR code tamper-evident. It contains a SHA-256 hash of the canonicalized, signed invoice XML. Anyone with the ZATCA verification app can scan the QR code and verify that the printed invoice matches what ZATCA has on record. If the document has been altered after signing, the hash won't match.
Note: Tag 06 is only present on Standard (cleared) invoices. Simplified invoices may omit the signature-based hash but must still include Tags 01–05.
Related: ZATCA Phase 2 Overview
Understand how clearance, signing, and the ICV/PIH hash chain work together before the QR code is generated.
QR codes generated automatically
Saudi VAT Pro builds and embeds the correct TLV-encoded QR code on every invoice — no manual encoding needed.
Decoding a QR code yourself
To inspect a ZATCA QR code:
- Scan the QR code to get the Base64 string
- Decode from Base64 to get the raw binary TLV bytes
- Parse each TLV triplet: read 1 byte tag, 1 byte length, then N bytes value
- Interpret each value as a UTF-8 string (except Tag 06 which is raw bytes)