Skip to content

ItsYasser/Zatca-QR-Code-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ZATCA Phase 1 QR Code Generator

A client-side web application designed to generate ZATCA-compliant Phase 1 QR code Base64 strings. This tool simplifies the process of creating the required TLV (Tag-Length-Value) structure and encoding it into Base64 for E-Invoicing in Saudi Arabia.

Features

  • ZATCA Compliant: Strictly follows the Phase 1 specifications for QR code structure.
  • Client-Side Only: All processing happens locally in your browser. No data is sent to any server, ensuring privacy and security.
  • Instant Generation: Generates the Base64 string instantly as you input data.
  • User-Friendly Interface: Clean, modern dark-mode design for ease of use.
  • Copy to Clipboard: One-click button to copy the generated string.

How to Use

  1. Open index.html in any modern web browser.
  2. Fill in the required fields:
    • Seller Name: The name of the selling entity.
    • VAT Registration Number: The 15-digit VAT number.
    • Invoice Timestamp: Select the date and time from the picker. The app automatically formats it to the required ISO 8601 format.
    • Invoice Total (with VAT): The total amount of the invoice including VAT.
    • VAT Total: The total VAT amount.
  3. Click the Generate QR String button.
  4. The generated Base64 string will appear in the text box below.
  5. Click Copy to Clipboard to use the string in your E-Invoicing solution.

Technical Details

The application implements the ZATCA Phase 1 requirements using the following logic:

  1. TLV Encoding: Each of the 5 input fields is converted into a TLV (Tag-Length-Value) object.
    • Tag: A 1-byte identifier (1 to 5).
    • Length: A 1-byte indicator of the value's length in bytes.
    • Value: The UTF-8 encoded byte array of the input string.
  2. Concatenation: The TLV byte arrays for all 5 fields are concatenated in order.
  3. Base64 Encoding: The final byte array is encoded into a Base64 string.

Project Structure

  • index.html: The main HTML structure.
  • style.css: Styling and layout (Dark mode, Glassmorphism).
  • script.js: Core logic for TLV encoding and DOM interaction.

License

This project is open-source and available for personal or commercial use.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published