Skip to content

Checking the Compliance of an Invoice

Omar Bahareth edited this page Oct 16, 2023 · 4 revisions

NOTE: The credentials you should use in this API call are the ones you got from submitting the CSR.

# 1. Construct the client
username = "your_binary_security_token"
password = "your_secret"

# Make sure to set environment to either :production, :simulation, or :sandbox accordingly
client = ZATCA::Client.new(username: username, password: password, environment: :simulation)

# 2. Send the invoice to ZATCA
# Assuming you have already constructed a ZATCA::UBL::Invoice
response = client.compliance_check(
  invoice: invoice.to_base64,
  invoice_hash: invoice.generate_hash,
  uuid: invoice.uuid
)