We Support E-invoice Zatca 2nd phase integration
Request Demo

Ready to transform?

Drop your details below and our experts will reach out to you.

QuickDice Insights

How to Generate a ZATCA Compliant QR Code for an E-Invoice in Saudi Arabia

How to Generate a ZATCA Compliant QR Code for an E-Invoice in Saudi Arabia
By Quickdice 13 min read

Creating a ZATCA Compliant QR Code is an important part of electronic invoicing in Saudi Arabia. Businesses should make sure that QR codes include necessary invoice details are structured in a proper TLV and can be read when scanned. Saudi arabia zatca software can be used to simplify the process of generating and encoding QR codes, validating them and integrating them and minimize manual errors and facilitate e-invoicing processes.

An effective QR code will enable rapid access to crucial invoice information and enable proper digital records. Before issuing invoices businesses should know the information that is required in the fields of data and TLV encoding, Base64 conversion and validation. Quickdice can facilitate organized digital invoicing and workflows that focus on compliance.

What Is a ZATCA-Compliant QR Code?

Role of QR Codes in Saudi Arabian E-Invoicing

A ZATCA Compliant QR Code is machine readable invoice data which can be scanned off an electronic invoice or a printed invoice. It assists users in retrieving important information about the seller, VAT number, invoice date, the total value, VAT in an efficient manner during verification.

Why ZATCA Requires QR Codes on E-Invoices

QR codes facilitate the simplification of access to key invoice data and enhance Saudi e-invoicing transparency. They enable compatible scanners to decode encoded data effectively and enable business, customers and authorities to check the significant invoice specifications without manually examining all the fields.

Difference Between a Standard QR Code and a ZATCA QR Code

A standard QR code can store many types of information, including URLs or plain text. A ZATCA Compliant QR Code conforms to a set of Saudi e-invoicing information and encoding standards such as required information fields, TLV-based encoding prior to Base64 representation.

What Information Is Required in a ZATCA QR Code?

Seller’s Name

The invoice is issued by a business whose legal or registered name is the one of the seller. It must be compatible with the data that is stored in the invoicing system, assisting customers and verification in linking the QR code to the appropriate supplier.

Seller’s VAT Registration Number

The taxable business recognized by the Saudi VAT regulations is identified by the seller by his VAT registration number. The entry should be accurate as with the wrong, wrong or miss typed number, the QR code and invoice may have inconsistencies.

Invoice Date and Time

The invoice time is a record of the time when the transaction was issued. The invoicing system should capture the date and time correctly and encode the information as per the format needed by scanners to be able to decipher the data properly.

Invoice Total Including VAT

The total of the invoice, including the VAT, should be included in the QR code. This needs to be equal to the final invoice value created by the accounting or invoicing system to avoid differences when scanning, reconciling or checking of compliance.

Total VAT Amount

The amount of VAT is a sum of tax to be paid in the invoice. When invoices have more than one taxable item or tax rate, businesses must make sure that the encoded figure is equal to the VAT calculation displayed on the invoice.

Additional QR Code Data Requirements for E-Invoices

Additional information might be necessary in the QR structure depending on the e-invoicing phase and type of invoice involved. The current relevant ZATCA technical specifications should be adhered to by businesses instead of using old templates and assumptions.

ZATCA QR Code Requirements for E-Invoices

QR Code Requirements for Tax Invoices

  • Include required seller identification data
  • Add VAT registration number of the seller
  • Encode invoice date and time correctly
  • Include total invoice value including VAT
  • Include total VAT amount
  • Adhere to the structure of encoding given
  • Ensure the QR code remains readable

QR Code Requirements for Simplified Tax Invoices

  • Include the seller’s name
  • Add VAT registration number of the seller
  • Include invoice date and time
  • Include total invoice amount including VAT
  • Include total VAT amount
  • Apply the necessary TLV coding
  • Provide consistent QR readability

TLV Encoding and Data Structure

A ZATCA Compliant QR Code is TLV encoded to structure the information in invoices into structured tags. A tag, length and value are found in each field to form a predictable data that is easily decoded by systems to verify and process.

QR Code Format and Readability Requirements

  • Use a valid QR code format
  • Maintain sufficient resolution for scanning
  • Avoid excessive distortion or compression
  • Keep adequate spacing around the code
  • Ensure sufficient contrast between code and background
  • Test scanning after invoice generation
  • Keep the QR code unobstructed

Arabic and Unicode Data Considerations

Saudi invoices may contain Arabic characters, making correct character encoding important. Unicode data should be supported in the system in such a way that names of sellers and other relevant text will be correct in TLV encoding, Base64 conversion, QR generation and scanning.

How to Generate a ZATCA-Compliant QR Code

Step 1: Collect the Required Invoice Information

Start with gathering the identification details and invoice information of the seller required. verify the VAT registration number, invoice date, and total with VAT, VAT amount and any additional fields that are necessary to the appropriate ZATCA e-invoicing situation.

Step 2: Encode the Data Using TLV Format

Transform all the values needed into the desired TLV format. Give the correct tag, compute the correct length of a byte and add the value. The correct processing of bytes is of particular concern when the information in the invoice includes Arabic or Unicode characters.

Step 3: Convert the TLV Data to Base64

Once you have developed the TLV byte sequence, transform the bit of data into Base64 representation. The output of the Base64 gives the encoded message that can then be utilized to generate the QR code on the electronic invoice.

Step 4: Generate the QR Code

Create a QR code using the resulting Base64 payload with compatible invoicing software or a suitable library to create QR-codes. Use settings to give a clear scannable image without altering, or chopping off the encoded information.

Step 5: Add the QR Code to the E-Invoice

Insert the created QR code in the suitable position in the invoice to be scanned by the customers. Make sure that the formatting of the invoices, their printing, conversion to PDFs or their display on the computer screen does not decrease the readability of the code.

Step 6: Test and Validate the QR Code

Use a compatible scanner and scan the completed QR code and compare the information which is decoded with the original invoice. Look at all key areas, such as seller details, VAT number, time and date, invoice amount, VAT amount and encoded structure.

ZATCA QR Code TLV Encoding Explained

What Is TLV Encoding?

TLV refers to Tag, Length and Value. The tag recognizes a given data field, the length shows the number of bytes that the value takes and the value itself holds the information. This systematic approach is a way of systematizing invoice information to be processed by machine.

How TLV Tags Work

A particular tag is used to represent each element of the QR data, which then has a length and a value. The tags are in a sequence to make a complete payload. The systems can then determine individual fields reading the tag that corresponds to it and its length.

ZATCA QR Code Tags Explained

The QR tags mentioned are the ones related to key information of an invoice, including the name of the seller, VAT registration number, the date of invoice, the invoice sum and VAT, and the sum of VAT. Additional applicable tags should be implemented according to current technical requirements.

Example of ZATCA TLV Data Structure

A simplified structure can be thought of as a sequence of tag, length and value elements. As an illustration, a tag will be the seller name, followed by its byte length and value and then other tags will be the other needed invoice information.

Converting TLV Data Into a Scannable QR Code

After assembling all the relevant TLV elements, the resulting sequence of bytes is then encoded in Base64. The Base64-value is then sent to a QR-generation process and results in the scannable image which is printed on the invoice.

How to Validate a ZATCA QR Code

Scan the QR Code Using a Compatible QR Scanner

Begin validation is the process of scanning the QR code with an appropriate scanner or testing application. The scanner must be able to read the code and give out the coded information without any errors, truncation or unwanted characters.

Verify Seller and VAT Information

Check the decoded name of the seller and VAT registration number with the official business records and invoice. The reason is that any discrepancy must be addressed by researching prior to issuing the invoice since inaccurately determined data may compromise the data consistency.

Check Invoice Date, Total, and VAT Amount

Compare the values on the invoice with the values of the decoded invoice timestamp, total with VAT and VAT amount. Any amount and time must be up to the minute with the source invoice created by the business system.

Common QR Code Validation Errors

Missing tags, invalid length, output of invalid Base64, wrong VAT numbers, inaccurate totals, unsupported characters and damaged QR images are some of the common issues. Determining the error aids the developers or finance teams to rectify the process of generating the invoices.

Tools and Methods for Testing QR Code Compliance

QR code can be tested by businesses with compatible scanners, automated validation programs, libraries of development and controlled invoice test cases. The decoded values should be checked with the source data and ensure that the created QR is readable.

Common ZATCA QR Code Errors and How to Fix Them

Incorrect VAT Registration Number

The main cause of an incorrect VAT registration number is normally due to manual entry, old information about the company or configuration error. Businesses ought to have centralized master information, verify the number prior to making invoices and avoid reentry of the data by the user.

Incorrect Invoice Date or Time

Errors with the timestamps may be caused by the wrong settings of the system, timezone settings, or application logic. Organizations ought to match clocks of the system, set the right Saudi Arabia time zone and, where feasible, they need to automatically record the time of invoice issuance.

Incorrect VAT or Invoice Total

Inappropriate totals can be caused by errors in calculations, round-offs, discounts or uneven tax logic. The values to be inputted into the QR-generation process should be those of the final invoice and not based on calculations done separately.

Invalid TLV Encoding

Invalid TLV data may arise when the tags, lengths, values or the calculation of the bytes are compiled in a wrong way. Each component program should be programmatically validated and then the entire sequence of bytes should be tested before being transformed into Base64.

Incorrect Base64 Encoding

Base64 issues can occur due to misconversion of the TLV bytes, or encoding of text with an inappropriate set of characters. The system must Base64- encode the precise TLV sequence of bytes and not change the output.

QR Code Cannot Be Scanned

A QR code can break down due to low resolution, low contrast, over compression, distortion, lack of spacing or lost printing. The companies also need to create sufficient-quality photo images and test online and printed invoices.

Missing or Incorrect Required Tags

Missing tags tend to point to incomplete configuration or obsolete implementation logic. Businesses are advised to map all requirements to any given field, filter possible requirements before generation and periodically assess their implementation against existing technical requirements.

How Businesses Can Automate ZATCA QR Code Generation

Using E-Invoicing Software

E-invoicing software can automatically capture invoice information, apply required encoding rules, generate QR codes, and attach them to invoices. This eliminates monotonous manual processes and limits the amount of errors when entering data to create an invoice.

Using an Invoice API

An invoice API is able to integrate business apps with automated QR creation. It sends data about invoices, generates structured payloads, sends QR data, and enables a uniform processing of various applications, branches, and sales channels.

Integrating QR Code Generation Into ERP Systems

QR generation can be a part of the routine invoicing process and can be facilitated through ERP integration. After invoice finalization, the system can automatically collect required information, encode the data, generate the QR code, and store records.

Automating QR Code Validation

Fields, data formats, TLV formats, Base64 output and invoice values can be checked by automated validation before release. This assists companies in determining the mistakes earlier and lessening the manual checks that are repetitive in invoices.

Maintaining Accurate Invoice Data

Automation requires a correct source information. Corporations are advised to have stable VAT, customer, product, tax, and accounting files in order to create QR codes based on the same data and do not have to correct it many times manually.

Best Practices for ZATCA-Compliant QR Codes

Use Accurate Invoice Information

Create QR data based on the records of finalized invoices and check the seller information, VAT numbers, time-stamps, taxable amounts, VAT calculations and totals. Proper source data will assist in avoiding discrepancies between invoice details and the information that is encoded.

Follow ZATCA Data-Encoding Requirements

TLV structure, calculations of bytes, character encoding, conversion of Base64, and relevant fields of data should be properly implemented by businesses. Implementation should be regularly reviewed by technical teams against current ZATCA requirements and relevant e-invoicing requirements.

Maintain QR Code Quality and Readability

The QR codes must be of a good resolution, proper size, good contrast and there should be enough space around the code. Readability should be tested by businesses after making PDFs, displaying them digitally, printing, and compressing them to guarantee effective scanning.

Test QR Codes Before Issuing Invoices

The accuracy of data as well as QR readability should be validated through testing. To verify the decoded information with the source records, businesses are expected to scan sample invoices, compare, test various amounts and Arabic text, dates, VAT, and invoice format.

Keep E-Invoice Systems Updated With ZATCA Requirements

Technical requirements and specifications as set by ZATCA can be modified over time. Businesses are advised to keep track of relevant updates, scan software setups and update integrations where needed and regularly test invoice outputs to confirm ongoing compliance.

Conclusion

Generating a ZATCA Compliant QR Code requires more than placing ordinary text inside a QR image. Companies need to gather the correct data in invoices, use the correct TLV framework, properly transform the data, create a legible code, and verify the end product. Thoughtful deployment minimizes data anomalies, scanning errors and unnecessary compliance issues and provides a more reliable electronic invoicing process.

The automation can simplify the whole process and integrate invoice data, encoding, QR creation, and validation into a single workflow. Companies that keep proper documentation and constantly check their e-invoicing setup are able to generate credible QR-codes and assist with e-invoicing. It is still important to follow the relevant ZATCA requirements as the electronic invoicing systems are being developed.

Frequently Asked Questions

1. What is a ZATCA QR code?

ZATCA QR code has vital invoice information that is machine readable.

2. Is a QR code mandatory on Saudi e-invoices?

Yes, Saudi e-invoices can only be applicable according to the requirements of ZATCA QR codes.

3. What information must a ZATCA QR code contain?

It contains the seller information, VAT number, the time of invoice, total and VAT.

4. How do I generate a ZATCA QR code?

Get invoice information, TLV encode the information and base 64 encode the information and create the QR code.

5. Can I use a standard QR code generator for a ZATCA e-invoice?

No the data has to be initially encoded in the necessary ZATCA format.

6. How can I check whether my ZATCA QR code is valid?

Scan the code and compare the information which was decoded with the information on the invoice.

7. What happens if a ZATCA QR code is incorrect?

It can result in failure to scan or generation of invoice data and compliance problems.

8. Can ZATCA QR code generation be automated?

QR code generation and validation can be automated with software, APIs and ERP.

Share this article

Quickdice

Written by

Quickdice