BR-KSA-27: Simplified invoices must carry a QR code (KSA-14)

Explained by Matheel from ZATCA's rule text and the condition SDK 3.4.8 executes · Updated

Warning: accepted with a warningSimplified invoices (B2C)Fields: KSA-14

Requires a cac:AdditionalDocumentReference with cbc:ID 'QR' whose cac:Attachment has a non-empty cbc:EmbeddedDocumentBinaryObject with mimeCode='text/plain'. Although the official text says every document, the check only runs for simplified invoices and their notes (InvoiceTypeCode @name starting '02').

How to fix it

Add <cac:AdditionalDocumentReference><cbc:ID>QR</cbc:ID><cac:Attachment><cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">…</cbc:EmbeddedDocumentBinaryObject></cac:Attachment></cac:AdditionalDocumentReference> with the base64 QR content.

ZATCA's official text

[BR-KSA-27]-The document must contain a QR code (KSA-14), and this code must be base64Binary.
Source: ZATCA SDK 3.4.8 · ZATCA KSA rules

Fails when (the condition ZATCA's SDK runs)

not((cac:AdditionalDocumentReference[normalize-space(cbc:ID) = 'QR'] and exists(cac:AdditionalDocumentReference[normalize-space(cbc:ID) = 'QR']/cac:Attachment/cbc:EmbeddedDocumentBinaryObject) and (normalize-space(cac:AdditionalDocumentReference[cbc:ID = 'QR']/cac:Attachment/cbc:EmbeddedDocumentBinaryObject) != '') and (cac:AdditionalDocumentReference[cbc:ID = 'QR']/cac:Attachment/cbc:EmbeddedDocumentBinaryObject[normalize-space(@mimeCode) = 'text/plain'])) )

Related rules

Validate your invoice against ZATCA's rules

Paste the XML and see every error and warning. It runs in your browser; the invoice goes nowhere.

Validate an invoice or try Matheel