How to read ZATCA's answer
FATOORA, and ZATCA's SDK before it, check an invoice in steps: the UBL 2.1 schema, the EN 16931 rules as ZATCA ships them (BR-*, BR-CO-* and others), then the KSA rules (BR-KSA-*), which win where the two differ, then the QR code, the cryptographic stamp and the previous invoice hash. Each finding in the answer names its category and its code.
Errors stop the invoice: a tax invoice is not cleared, a simplified one is not reported. Warnings let it through, but ZATCA expects them fixed. The KSA rules mark the fields in their messages by their EN 16931 ids (BT-31, the seller VAT number) or by ZATCA's own (KSA-16, the invoice counter).
The errors that come up most
- BR-KSA-40: the seller VAT number has 15 digits and starts and ends with 3.
- BR-KSA-33 and BR-KSA-34: the invoice counter (ICV, KSA-16) is there and is digits only.
- BR-KSA-37 and BR-KSA-66: the national address, a building number of 4 digits and a postal code of 5.
- BR-KSA-70: the issue time, as hh:mm:ss.
- BR-KSA-EN16931-02 and BR-KSA-68: the VAT is accounted in SAR, whatever the invoice's currency.
- BR-KSA-F-06-C1 to C40: a field longer or shorter than ZATCA allows, such as a line id over 6 characters (BR-KSA-F-06-C17).
Checking an invoice before FATOORA
Open the validator with the ZATCA tax invoice profile, or the simplified one, and paste or drop the XML; a file opened picks the right profile from its invoice type. It runs the schema, the EN 16931 and KSA rules of ZATCA's SDK 3.4.6, then our checks of the stamp and the QR code: the invoice hash recomputed, the ECDSA signature against the certificate, the certificate and signed properties digests, and each tag of the QR code against the invoice. Nothing is uploaded.
What a single file can't show stays with FATOORA: that ZATCA issued the certificate of your solution (its CSID), that the previous invoice hash is that of your last invoice, that the invoice counter follows on, duplicates, and the time a simplified invoice is reported in.
Questions
What does invalid-invoice-hash mean?
That the invoice hash sent to FATOORA is not the hash of the XML it received. The XML changed after hashing, or the hash was computed over another form of it. Hash the final file, without UBLExtensions, the signature and the QR code reference, canonicalized with C14N 1.1.
What is the difference between a ZATCA error and a warning?
An error stops the invoice: a tax invoice is not cleared and a simplified invoice is not reported. A warning lets it through, but should be fixed.
Does a pass here mean FATOORA will accept the invoice?
It means the invoice passes the schema, the rules of ZATCA's SDK and our checks of the stamp and the QR code. FATOORA also checks your certificate, the chain of previous invoice hashes, the invoice counter and duplicates, which a single file can't show.
Is the invoice uploaded?
No. The check runs in your browser; only the API and URL monitors validate on our servers.