ZATCA QR code requirements decide whether a Saudi e-invoice can be checked in seconds or gets flagged. Every simplified (B2C) invoice has needed a QR code since Phase 1 started on 4 December 2021, and once a business joins Phase 2 the QR code must appear on every invoice and note, carry nine encoded fields and match a cryptographic stamp. This guide explains what goes into the code, who generates it, how the encoding works and the mistakes that make it fail.
The short answer
- Phase 1 (from 4 December 2021): a QR code is mandatory on simplified tax invoices and their notes, and optional on standard tax invoices, according to ZATCA's Phase 1 preparation page. It holds five fields: seller name, VAT number, timestamp, invoice total with VAT, and VAT total.
- Phase 2 (from 1 January 2023, in waves): ZATCA's E-Invoicing Implementation Resolution makes the QR code mandatory for all types of e-invoices and e-notes, with up to nine fields including the invoice hash, an ECDSA signature and a public key.
- Who generates it: for simplified invoices, your own e-invoicing solution builds and stamps the QR code. For standard (B2B) invoices, ZATCA generates or updates it during clearance, and your system prints what comes back.
- How it is built: each field is encoded as Tag-Length-Value (TLV) bytes, the bytes are Base64-encoded into a string of up to 700 characters, and that string becomes the QR image.
What Is the ZATCA QR Code For?
The Resolution describes the QR code as a machine-readable matrix barcode that lets anyone with a QR scanner or phone camera do a basic validation of an e-invoice or e-note. ZATCA's Detailed Guidelines explain that customers can scan the code with ZATCA's VAT app, which checks that the content is compliant and shows the result.
In practice the QR code does two jobs. It lets a buyer confirm who issued the invoice and how much VAT was charged. In Phase 2 it also ties the printed invoice to its signed XML, so tampering is easier to spot.
Phase 1 vs Phase 2 QR Code Requirements
The QR code changed between the two phases. If your wave has not yet started integration, the Phase 1 rules still apply to you. If you want the wider picture first, read ZATCA Phase 1 vs Phase 2.
| Requirement | Phase 1 (generation) | Phase 2 (integration) |
|---|---|---|
| Start date | 4 December 2021 | From 1 January 2023, by wave |
| Simplified tax invoices (B2C) and their notes | QR code mandatory | QR code mandatory |
| Standard tax invoices (B2B) and their notes | QR code optional | QR code mandatory, generated or updated by ZATCA at clearance |
| Fields in the code | 5 (tags 1 to 5) | Up to 9 (tags 1 to 9) |
| Cryptographic content | None | Invoice hash, ECDSA signature, public key and, for simplified documents, ZATCA's signature on your certificate |
| Who builds it | Your e-invoicing solution | Your solution for simplified documents; ZATCA's platform for cleared standard documents |
The Phase 1 and Phase 2 fields come from Annex 1 of the Resolution, and the tag numbers and enforcement dates come from ZATCA's Security Features Implementation Standards (version 1.2, 19 May 2023).
The Nine QR Code Fields (Tags 1 to 9)
Here is what each tag holds and where your software finds it in the UBL XML invoice, based on section 6 of ZATCA's Detailed Technical Guideline.
| Tag | Field | Where it comes from in the XML | Required from |
|---|---|---|---|
| 1 | Seller's name | Seller's registration name (cac:PartyLegalEntity/cbc:RegistrationName) | 4 Dec 2021 |
| 2 | Seller's VAT registration number | Seller's tax scheme company ID (cac:PartyTaxScheme/cbc:CompanyID) | 4 Dec 2021 |
| 3 | Invoice timestamp (date and time, ISO 8601) | Issue date and issue time combined, for example 2022-02-21T12:13:57Z | 4 Dec 2021 |
| 4 | Invoice total including VAT | cac:LegalMonetaryTotal/cbc:TaxInclusiveAmount | 4 Dec 2021 |
| 5 | VAT total | cac:TaxTotal/cbc:TaxAmount (business term BT-110) | 4 Dec 2021 |
| 6 | Hash of the XML invoice | The digest value in the invoice signature | Phase 2 |
| 7 | ECDSA signature of the XML hash | The signature value in the invoice signature | Phase 2 |
| 8 | ECDSA public key | Taken from the signing certificate | Phase 2 |
| 9 | ZATCA's signature on the stamp certificate | From the cryptographic stamp certificate (simplified documents only) | Phase 2 |
Two details are easy to miss. First, the Resolution says tag 7 is generated by your solution for simplified documents but by ZATCA's platform for standard documents that are integrated with ZATCA. Second, tag 8 is your solution's public key for simplified documents, while for cleared standard documents it is optional and holds ZATCA's public key. Tag 9 applies only to simplified invoices and their notes.
Tag 5 means the VAT total, not the taxable amount
The Security Features standard was updated in May 2023 specifically to clarify that tag 5 is the value in business term BT-110 of the XML: the total VAT amount. Mixing it up with the amount before VAT, or with a line-level figure, gives a code that does not match the invoice.
Who Generates the QR Code: Simplified vs Standard Invoices
This is where Phase 2 changes the workflow the most, and it follows the same split as simplified vs standard tax invoices.
Simplified tax invoices (B2C)
Your e-invoice generation solution (EGS) signs the XML with its own cryptographic stamp, builds the nine-tag QR code and prints or shares the invoice with the customer straight away. The Detailed Guidelines say the solution must stamp the XML using the CSID issued by ZATCA and include a QR code compliant with Phase 2 (nine tags in TLV Base64 format). The invoice is then reported to ZATCA within 24 hours. ZATCA's Technical Guideline is clear that the seller must include its stamp and QR code in the submission, because the Fatoora platform does not stamp simplified documents.
If you do not yet have a production CSID, the code cannot be completed, because tags 6 to 9 depend on the certificate. See What Is a CSID? for how onboarding works.
Standard tax invoices (B2B)
Standard invoices must be cleared before the buyer receives them. In the Detailed Guidelines FAQ, ZATCA says that for B2B tax invoices it generates the QR code string at clearance, along with its stamp, and taxpayers only need to display the code based on the string they receive. The Technical Guideline adds that you may include your own stamp and QR code in the submission, in which case ZATCA adds its stamp and updates the QR code in its response.
The practical rule: never print a B2B invoice with a QR code built before clearance. Print the cleared version that ZATCA returns.
POS terminals that cannot sign
The Technical Guideline allows a setup where basic POS terminals send invoices to a central server. In that case the server must stamp the invoices and apply the QR code before the customer receives the receipt, and the CSID can sit on that server instead of each till.
How the QR Code Is Encoded (TLV and Base64)
ZATCA does not want a plain text QR code or a URL. The Security Features standard sets out the order of operations:
- Start with the required values and an empty byte array.
- For each value, write one byte for the tag number, one byte for the length of the value in bytes, then the value itself encoded in UTF-8.
- Join all the TLV sets together with nothing between them, then encode the whole byte array in Base64.
- Create the QR image from that Base64 string, which must be no longer than 700 characters.
In ZATCA's own worked example in the Technical Guideline, the seller name "Ahmed Mohamed AL Ahmady" is 23 bytes long, so tag 1 starts with the bytes 01 (tag) and 17 (23 in hexadecimal), followed by the name's UTF-8 bytes.
You can check a code with the validation command in ZATCA's compliance and enablement toolbox SDK, which also includes a command to generate a compliant QR code from an invoice XML.
Common ZATCA QR Code Mistakes
ZATCA's Technical Guideline lists common mistakes in building the code. Combined with the field rules above, these are the ones to test for:
- Writing the length as text. Tag and length are binary values. A length of 21 must be stored as the single byte 0x15, not as the characters "2" and "1".
- Not encoding Arabic text as UTF-8. Arabic seller names take more bytes than characters, so the length must count bytes.
- Adding separators or padding between TLV sets. There should be none.
- Using the wrong amount in tag 4 or tag 5. Tag 4 is the total including VAT, tag 5 is the VAT total (BT-110).
- A timestamp that does not match the invoice. Tag 3 must combine the XML issue date and issue time.
- Printing a pre-clearance code on B2B invoices instead of the one ZATCA returns.
- A code that points to a web page or contains anything other than the Base64 TLV string.
- Credit and debit notes without a QR code. The rules cover notes as well as invoices.
Missing the QR code is also a listed violation. In ZATCA's official violations table it starts with a warning and a 60-day period to fix it before cash fines apply; see our guide to ZATCA e-invoicing penalties.
A QR Code Checklist for Your ERP or POS
Use this list when you test a new system, onboard a new device or review existing invoices:
- Every simplified invoice, credit note and debit note prints a QR code, including POS receipts and van sales invoices.
- Scan a sample with a QR reader, decode the Base64 and check that tags 1 to 5 match the printed seller name, VAT number, date and time, total and VAT.
- If you are in Phase 2, confirm tags 6 to 9 are present on simplified documents and that the code passes ZATCA's SDK validation.
- Check that B2B invoices print the QR code from ZATCA's clearance response, not a locally built one.
- Test an Arabic seller name and a large invoice total to make sure the code stays under 700 characters.
- Re-test after CSID renewal, a software update or adding new devices.
If you are still lining up Phase 2, our ZATCA Phase 2 requirements checklist covers the full onboarding process.
How Raad ERP Helps
Raad ERP is a cloud ERP for trading, van sales, retail and manufacturing businesses in the GCC. For Saudi Arabia it covers ZATCA Phase 1 and 2: a QR code on every invoice and receipt, and Phase 2 invoices sent to ZATCA automatically in the background. Invoices can be raised in Arabic and English.
Supermarkets and grocery stores can add Raad POS, which prints ZATCA receipts with the QR code on 80mm and 110mm paper and feeds every sale into Raad ERP. Whatever system you use, test real invoices with ZATCA's tools rather than relying on a vendor's word.
Frequently Asked Questions
What are the ZATCA QR code requirements?
Is a QR code mandatory on B2B tax invoices in Saudi Arabia?
How many fields are in the ZATCA QR code?
What is tag 5 in the ZATCA QR code?
Who generates the QR code for standard tax invoices?
Can the ZATCA QR code be a link to a web page?
How can I check if my ZATCA QR code is valid?
Does Raad ERP print the ZATCA QR code?
Not Sure Your Invoices Pass? WhatsApp Us
Send us a photo of a recent invoice or receipt and tell us your ZATCA phase, and we will walk you through what to check.
WhatsApp "ZATCA" to +971 56 102 1565 and we'll reply quickly.
Selling in the UAE too? UAE e-invoicing works differently, through accredited service providers. Read UAE E-Invoicing 2027 Made Simple.
This article is general information only and is not legal, tax or professional advice. Regulations, including ZATCA, UAE Ministry of Finance and FTA requirements, change often, and this content may be incomplete, out of date or contain errors. Before you act on it, check with the official authority (ZATCA in Saudi Arabia, or the Ministry of Finance or Federal Tax Authority in the UAE) or a qualified tax adviser. Raad ERP makes no warranties about the accuracy or completeness of this content and accepts no liability for any loss arising from reliance on it. Links to third-party websites are provided for convenience and are not endorsements.
