zatca

A library for generating QR Codes for the e-invoice standard by ZATCA in Saudi Arabia.


Keywords
e-invoicing, fatoora, qrcode, ruby, saudi-arabia, taxes, zatca
License
MIT
Install
gem install zatca -v 0.1.2

Documentation

zatca

A Ruby library for generating QR Codes for the e-invoice standard by ZATCA in Saudi Arabia.

Validated to have the same output as ZATCA's SDK as of 12 November 2021.

Installation

Rubygems

gem install zatca

Bundler

bundle add zatca

Usage

require "zatca"

tags = {
  seller_name: "Mrsool",
  vat_registration_number: "310228833400003",
  timestamp: "2021-10-20T19:29:32+03:00",
  vat_total: "15",
  invoice_total: "115",
}

ZATCA.render_qr_code(tags)
# => data:image/png;base64,...
# Hint (Try pasting the above into your web browser's address bar)

If you'd like to customize the size of the QR Code you can manually use the generator like so:

require "zatca"

tags = ZATCA::Tags.new({
  seller_name: "Mrsool",
  vat_registration_number: "310228833400003",
  timestamp: "2021-10-20T19:29:32+03:00",
  vat_total: "15",
  invoice_total: "115",
})

generator = ZATCA::QRCodeGenerator.new(tags)
generator.render(size: 512)