ZATCA e-invoice validator (FATOORA)

Check a tax invoice or a simplified tax invoice before your system sends it to FATOORA: the UBL 2.1 schema, the EN 16931 rules as ZATCA adapts them and the KSA rules, with every finding on its line. Nothing is uploaded.

E-invoicing in Saudi Arabia in short

Saudi e-invoicing (FATOORA) started on 4 December 2021 with its first phase: businesses subject to VAT stopped issuing handwritten invoices and generate them electronically. The second phase, integration, has connected their systems to ZATCA's FATOORA platform since 1 January 2023, in waves by revenue; ZATCA notifies each wave at least six months ahead. Wave 25 covers businesses whose revenue subject to VAT exceeded SAR 187,500 in any year from 2022 to 2025, which integrate by 1 February 2027.

Invoices are UBL 2.1 XML. A tax invoice, usually between businesses, is cleared by ZATCA before it reaches the buyer; a simplified tax invoice, usually to a consumer, is reported within 24 hours. The name of the InvoiceTypeCode tells them apart (0100000 for a tax invoice, 0200000 for a simplified one), and the code says whether it is an invoice (388), a credit note (381), a debit note (383) or a prepayment (386).

How to check a ZATCA invoice

  1. Open the validator with the ZATCA tax invoice profile, or the simplified one. A file opened or pasted picks the right one from its invoice type.
  2. Paste the XML or drop the file, then press Validate.
  3. Click a rule id for what it checks.

What is checked

ZATCA validates an invoice in three steps: the UBL 2.1 schema, a subset of the EN 16931 rules, then the KSA rules, which win where they differ. We run the stylesheets of ZATCA's SDK 3.4.6 for the last two. The KSA rules check the seller's VAT number of 15 digits (BR-KSA-40), the invoice transaction code in the type's name (BR-KSA-06), the invoice counter (BR-KSA-33), the buyer's identifiers (BR-KSA-14), the address with its four digit building number (BR-KSA-37), and the presence of the QR code and the cryptographic stamp (BR-KSA-27, BR-KSA-60).

The SDK also checks the signature, the QR code's content and the invoice hash, and FATOORA clears or reports the invoice; those are not done here. The UBL schema here reads the certificate serial number of the signature as an integer of any length, as ZATCA's certificates have serial numbers longer than libxml2 reads as integers.

Profiles to check with

Rules invoices break most

Each one has a page with what it checks, its test and, for many, how to fix it.

  • BR-KSA-40: If it exists in the invoice, the seller VAT registration number (BT-31) must contain 15 digits. The first and the last digits are "3"..
  • BR-KSA-06: The invoice transaction code (KSA-2) must exist and respect the following structure: NNPNESBCG where NN (positions 1 and 2) = invoice subtype: - 01 for tax invo...
  • BR-KSA-33: Each invoice must have an invoice counter value (KSA-16).
  • BR-KSA-14: The buyer identification (BT-46), required only if buyer is not VAT registered, then the buyer identification (BT-46) must be provided with one of the scheme ID...
  • BR-KSA-37: The seller address building number must contain 4 digits.
  • BR-KSA-27: The document must contain a QR code (KSA-14), and this code must be base64Binary.
  • BR-KSA-60: Cryptographic stamp (KSA-15) must exist in simplified tax invoices and associated credit notes and debit notes (KSA-2, position 1 and 2 = 02).

Questions

Is the invoice uploaded?

No. The schema check and the rules both run in your browser. Only the API and URL monitors validate on our servers.

Does a valid result mean FATOORA will accept the invoice?

It means it passes the schema and the rules of ZATCA's SDK. FATOORA also checks the signature, the hash chain and the certificate of your system, which this check does not.

Why does the simplified example get a warning?

BR-KSA-98 warns when a simplified invoice is more than 24 hours old at the time of the check. The example dates from 2022, so the warning shows.

Can I check invoices from code?

Yes: the API and the command-line client with --schema sa-zatca-tax-invoice, or --schema auto for a folder of mixed invoices.

Official sources

Other countries