Reviewed

ZATCA QR Code Requirements: What Must Be on Every Invoice

The nine fields, who builds the code, and how to test it before ZATCA does

Lavender illustration of an invoice with a QR code, a phone showing a check, nine field tiles, a shield and key, a server and 2026

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.

RequirementPhase 1 (generation)Phase 2 (integration)
Start date4 December 2021From 1 January 2023, by wave
Simplified tax invoices (B2C) and their notesQR code mandatoryQR code mandatory
Standard tax invoices (B2B) and their notesQR code optionalQR code mandatory, generated or updated by ZATCA at clearance
Fields in the code5 (tags 1 to 5)Up to 9 (tags 1 to 9)
Cryptographic contentNoneInvoice hash, ECDSA signature, public key and, for simplified documents, ZATCA's signature on your certificate
Who builds itYour e-invoicing solutionYour 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.

TagFieldWhere it comes from in the XMLRequired from
1Seller's nameSeller's registration name (cac:PartyLegalEntity/cbc:RegistrationName)4 Dec 2021
2Seller's VAT registration numberSeller's tax scheme company ID (cac:PartyTaxScheme/cbc:CompanyID)4 Dec 2021
3Invoice timestamp (date and time, ISO 8601)Issue date and issue time combined, for example 2022-02-21T12:13:57Z4 Dec 2021
4Invoice total including VATcac:LegalMonetaryTotal/cbc:TaxInclusiveAmount4 Dec 2021
5VAT totalcac:TaxTotal/cbc:TaxAmount (business term BT-110)4 Dec 2021
6Hash of the XML invoiceThe digest value in the invoice signaturePhase 2
7ECDSA signature of the XML hashThe signature value in the invoice signaturePhase 2
8ECDSA public keyTaken from the signing certificatePhase 2
9ZATCA's signature on the stamp certificateFrom 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:

  1. Start with the required values and an empty byte array.
  2. 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.
  3. Join all the TLV sets together with nothing between them, then encode the whole byte array in Base64.
  4. 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:

  1. Every simplified invoice, credit note and debit note prints a QR code, including POS receipts and van sales invoices.
  2. 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.
  3. 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.
  4. Check that B2B invoices print the QR code from ZATCA's clearance response, not a locally built one.
  5. Test an Arabic seller name and a large invoice total to make sure the code stays under 700 characters.
  6. 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?
Every simplified (B2C) tax invoice and its credit or debit notes has needed a QR code since 4 December 2021. Once a business is integrated in Phase 2, every type of e-invoice and e-note must carry a QR code. The code is a Base64 string of up to 700 characters built from Tag-Length-Value fields: seller name, VAT number, timestamp, total with VAT and VAT total, plus the invoice hash, ECDSA signature, public key and, for simplified documents, ZATCA's signature on the stamp certificate.
Is a QR code mandatory on B2B tax invoices in Saudi Arabia?
In Phase 1 it was optional on standard (B2B) tax invoices. In Phase 2 it is mandatory for all e-invoices and notes. For standard invoices, ZATCA generates or updates the QR code string during clearance, and the seller prints the code from the cleared invoice.
How many fields are in the ZATCA QR code?
Phase 1 codes hold five fields (tags 1 to 5). Phase 2 codes hold up to nine (tags 1 to 9). Tags 6 to 8 add the XML invoice hash, the ECDSA signature and the public key, and tag 9 applies to simplified invoices and their notes only.
What is tag 5 in the ZATCA QR code?
Tag 5 is the VAT total of the invoice, the value in business term BT-110 of the XML. ZATCA clarified this in version 1.2 of its Security Features Implementation Standards in May 2023. It is not the taxable amount and not the total including VAT, which goes in tag 4.
Who generates the QR code for standard tax invoices?
ZATCA does. Its Detailed Guidelines say the QR code string for B2B tax invoices is generated by ZATCA at clearance along with its stamp, and taxpayers only need to display it. If the seller includes its own QR code in the submission, ZATCA updates it in the clearance response.
Can the ZATCA QR code be a link to a web page?
No. ZATCA's specifications require the QR code to contain the invoice fields encoded in Tag-Length-Value format and then Base64, up to 700 characters. A URL or plain-text code does not meet the specification.
How can I check if my ZATCA QR code is valid?
Scan it with ZATCA's VAT app, which verifies the content and shows the result, or use the QR validation command in ZATCA's compliance and enablement toolbox SDK. You can also decode the Base64 string and check that each tag matches the printed invoice.
Does Raad ERP print the ZATCA QR code?
Raad's website says Raad ERP covers ZATCA Phase 1 and Phase 2 with a QR code on every invoice and receipt, and Raad POS prints ZATCA receipts with the QR code. As with any system, test sample invoices with ZATCA's tools before relying on them.

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.

Related reading