Skip to main content

QR Code Reading

Saudi invoices issued under ZATCA (Zakat, Tax and Customs Authority) Phase 1 regulations include a QR code that encodes key invoice data in a standardized format. Shaari automatically detects and reads these QR codes, giving you a reliable way to verify invoice details.

ZATCA Phase 1 QR Codes

Since December 2021, all tax invoices and simplified tax invoices issued in Saudi Arabia must include a QR code. This QR code contains a compact, machine-readable summary of the invoice's essential data, encoded in a format defined by ZATCA.

The QR code serves as a quick verification tool. Anyone scanning it can confirm the seller's identity, VAT number, and the invoice's financial totals.

Automatic QR Detection and Reading

When you upload an invoice that contains a ZATCA QR code, Shaari:

  1. Scans the document for QR codes during the upload and analysis process.
  2. Detects the ZATCA QR by identifying the standardized TLV data structure.
  3. Decodes the data and displays the extracted QR information alongside the invoice.

No manual action is needed. If a QR code is present and readable, the data is extracted automatically.

Data Extracted from QR

The ZATCA Phase 1 QR code contains five mandatory fields:

TagFieldDescription
1Seller nameThe legal name of the seller or supplier
2VAT registration numberThe seller's 15-digit VAT number
3TimestampThe date and time the invoice was issued
4Invoice totalThe total amount of the invoice including VAT
5VAT amountThe total VAT charged on the invoice

TLV Format

The data inside the QR code uses TLV (Tag-Length-Value) encoding:

  • Tag -- A single byte identifying the field (1 through 5).
  • Length -- A single byte indicating the length of the value in bytes.
  • Value -- The actual data for that field, encoded as UTF-8 text.

The entire TLV payload is Base64-encoded and embedded in the QR code. Shaari handles the decoding transparently, so you see the human-readable values directly.

note

TLV is a compact binary format. You do not need to understand its technical details to use the QR reading feature. Shaari handles all encoding and decoding automatically.

Verification of Invoice Data Against QR

One of the most valuable uses of QR reading is cross-verification. When an invoice has both AI-extracted data and QR-decoded data, Shaari can compare them:

  • Supplier name from the AI extraction vs. the seller name from the QR.
  • VAT number extracted from the document vs. the VAT number in the QR.
  • Total amount and VAT amount from the invoice body vs. the QR-encoded values.

This comparison helps catch discrepancies such as:

  • Altered or tampered invoices where the printed text does not match the QR.
  • OCR errors in the AI extraction that the QR data can correct.
  • Invoices with QR codes from a different transaction.
caution

If the data extracted from the invoice body does not match the QR code data, review the invoice carefully. A mismatch could indicate an error in the document or a problem with the source invoice.

tip

QR code reading works best when the QR code in the uploaded file is clear and undamaged. Avoid cropping the QR code out of the image, and ensure the resolution is high enough for the code to be decoded.