ZATCA QR Code: E-Invoice Requirements for Phase 1 and Phase 2

What the QR code on Saudi e-invoices contains, which invoices need it, how Phase 2 adds hash and signature fields, how customers verify it, and the mistakes that break it.

ZATCA QR Code: E-Invoice Requirements for Phase 1 and Phase 2

This article is general guidance, not legal or tax advice. Technical specifications are updated from time to time, so always check the latest e-invoicing documents on the ZATCA e-invoicing (Fatoora) portal before building or changing an invoicing system.

What is the ZATCA QR code?

The ZATCA QR code is the square barcode printed on electronic invoices in Saudi Arabia. It is not a link to a website. It carries a compact, encoded copy of key invoice data that anyone can scan to confirm who issued the invoice, when, and how much VAT it includes. ZATCA introduced it with the first phase of e-invoicing (the "Generation" phase) on 4 December 2021, and expanded its content in the second phase (the "Integration" phase), which has been rolled out to taxpayers in waves since 1 January 2023.

For a business, the QR code is one of the most visible signs of e-invoicing compliance. A customer, an auditor or a ZATCA inspector can check it in seconds, so a wrong or unreadable code is easy to spot.

Which invoices need a QR code?

  • Simplified tax invoices (mainly B2C sales, such as receipts from a shop, restaurant or pharmacy POS) and their credit and debit notes: the QR code has been mandatory since Phase 1.
  • Standard tax invoices (mainly B2B and B2G sales) and their notes: the QR code was optional in Phase 1. ZATCA's invoicing guideline lists it as a required element of standard invoices from January 2023, in line with Phase 2.

In Phase 2, standard invoices must be cleared by ZATCA before they are shared with the buyer, while simplified invoices are reported to ZATCA within 24 hours of issue. The QR code must match the final, signed invoice in both cases. Our ZATCA Phase 2 guide explains clearance and reporting in more detail.

What a Phase 1 QR code contains

A Phase 1 QR code holds five fields:

TagFieldExample value
1Seller's nameExample Store
2Seller's VAT registration number300000000000003
3Invoice date and time (timestamp)2026-11-09T14:25:00Z
4Invoice total including VAT1150.00
5VAT total150.00

How TLV and Base64 encoding work

The fields are not written as plain text. Each one is encoded as TLV (Tag-Length-Value): one byte for the tag number, one byte for the length of the value in bytes, then the value itself in UTF-8. The TLV blocks are joined with no separators, and the whole byte string is converted to Base64. That Base64 text is what the QR image stores.

In the example above, tag 1 has a length of 13 bytes, tag 2 has 15, tag 3 has 20, tag 4 has 7 and tag 5 has 6. The resulting Base64 string is:

AQ1FeGFtcGxlIFN0b3JlAg8zMDAwMDAwMDAwMDAwMDMDFDIwMjYtMTEtMDlUMTQ6MjU6MDBaBAcxMTUwLjAwBQYxNTAuMDA=

Note that length is counted in bytes, not characters. An Arabic seller name uses two bytes per letter in UTF-8, so a four-letter Arabic name has a length of 8. Getting this wrong is a common reason a code fails to decode.

Extra fields in a Phase 2 QR code

Once a business is integrated with ZATCA's Fatoora platform, its e-invoicing solution must produce a signed XML invoice, and the QR code gains cryptographic fields that tie it to that XML:

TagFieldPurpose
6Hash of the XML invoiceProves the QR belongs to this exact invoice
7ECDSA signatureThe invoice's digital signature from the seller's solution
8ECDSA public keyLets a verifier check the signature
9ZATCA's signature of the cryptographic stamp's public keyApplies to simplified invoices and their notes; links the device certificate to ZATCA

The cryptographic stamp is issued to each invoicing device or solution during onboarding with ZATCA. Because the hash and signature are calculated from the final XML, the QR code must be generated after the invoice is signed, and the printed invoice must not be changed afterwards. Any correction is made with a credit or debit note, which gets its own QR code.

How customers verify the QR code

ZATCA provides an official mobile app (search for the ZATCA app on Google Play or the App Store) with an e-invoice verification service. ZATCA's verify e-invoice service page describes the steps:

  1. Open the app and go to the Zakat, Tax and Customs services section.
  2. Choose the e-invoice verification service.
  3. Scan the QR code on the printed or PDF invoice.
  4. Compare the decoded details (seller, VAT number, date, totals) with what is printed on the invoice.

If the details do not match, or the code cannot be read, the customer has a reason to question the invoice. That is why retailers and restaurants should test codes with the app on their real printers before going live.

Common QR code mistakes to avoid

  • Encoding a URL or plain text instead of TLV data in Base64.
  • Writing tag and length as text characters (for example "01") instead of single bytes.
  • Counting characters instead of bytes, which breaks Arabic seller names.
  • Totals that do not match the invoice because of rounding differences between line items and the grand total.
  • A seller name or VAT number that differs from the details registered with ZATCA.
  • Wrong timestamp format, or the time of printing instead of the time of issue.
  • Generating the Phase 2 QR before signing, so the hash and signature do not match the XML.
  • Codes printed too small or faded on thermal receipts, so phones cannot scan them.
  • Using a free QR generator instead of a compliant e-invoicing solution once Phase 2 applies to you.

Quick self-check

Scan five of your recent receipts with the ZATCA app: one cash sale, one card sale, one with a discount, one credit note and one with an Arabic customer name. If all five decode and match, your setup is in good shape.

Generate compliant QR codes automatically

The safest approach is to let your billing system build the QR code from the same data that produces the invoice, so the totals, VAT and signatures can never drift apart. AxoOne Cloud POS issues ZATCA Phase 2 simplified and standard invoices with the QR code generated by the system, and works with AxoOne Inventory & Accounting for your books and VAT reports. Restaurants can also see our restaurant POS.

Want invoices your customers can verify with confidence? Explore AxoOne Cloud POS or book a free demo with our Riyadh team.

Frequently asked questions

What data does the ZATCA QR code contain?

In Phase 1 it holds the seller's name, VAT registration number, invoice timestamp, invoice total including VAT and VAT total, encoded as TLV and Base64. In Phase 2 it also carries the invoice hash, the ECDSA signature, the public key and, for simplified invoices, ZATCA's signature of the stamp's public key.

Is a QR code mandatory on B2B invoices in Saudi Arabia?

In Phase 1 the QR code was mandatory only on simplified (B2C) invoices and optional on standard invoices. ZATCA's invoicing guideline lists the QR code as a required element of standard tax invoices from January 2023 under Phase 2. Check the latest ZATCA guidance for your integration wave.

Can I use a free online QR code generator for ZATCA invoices?

A generic generator usually encodes plain text or a link, which is not valid. Phase 1 codes need TLV data in Base64, and Phase 2 codes need a hash and signature from a ZATCA-onboarded solution. Use a compliant e-invoicing or POS system instead.

How can a customer check if an e-invoice QR code is valid?

Download ZATCA's official app, open the e-invoice verification service and scan the QR code. The app shows the encoded details, which the customer should compare with the seller name, VAT number, date and totals printed on the invoice.

Why does my ZATCA QR code show wrong or unreadable data?

Typical causes are tag and length written as text instead of bytes, length counted in characters rather than bytes for Arabic names, totals that do not match the invoice after rounding, or a Phase 2 code generated before the invoice was signed.

Let’s get your project started

Talk to our Riyadh team about software, ZATCA e-invoicing or your next app. We reply within one working day. تواصل معنا الآن — فريقنا في الرياض جاهز لخدمتك