BR-KSA-03: Every invoice needs a UUID

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

Error: the invoice is rejectedAll invoicesFields: KSA-1

The document must have a non-empty cbc:UUID (KSA-1). The executed regex '^[\w.-]+' only checks that the value starts with a letter, digit, underscore, dot or dash, so it is looser than the official text's 'only letters, digits and dashes'.

How to fix it

Generate a standard UUID and add it near the top of the document, e.g. <cbc:UUID>3cf5ee18-ee25-44ea-a444-2c37ba7f28be</cbc:UUID>.

ZATCA's official text

[BR-KSA-03]-The invoice must contain a unique identifier ("UUID") (KSA-1) given by the unit that issued the document (unique message identifier for interchange process). This value must contain only letters, digits, and dashes.
Source: ZATCA SDK 3.4.8 · ZATCA KSA rules

Fails when (the condition ZATCA's SDK runs)

not(exists(cbc:UUID) and (cbc:UUID) != '' and matches(cbc:UUID, '^[\w.-]+'))

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