Skip to content
forked from mrsool/zatca

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

License

Notifications You must be signed in to change notification settings

arkhitech/zatca

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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",
  digital_signature: "1234",
  public_key: "145345",
  certificate_signature: "3452345"
}

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",
  digital_signature: "1234",
  public_key: "145345",
  certificate_signature: "3452345"
})

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

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 99.1%
  • Shell 0.9%