BR-KSA-92: B2G invoices must include a contract ID

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

Error: the invoice is rejectedConditional, see belowFields: KSA-2, BT-12

When cbc:InvoiceTypeCode/@name (KSA-2) is 9 characters long, starts with 01 or 02 and has 1 as its 9th character (B2G), cac:ContractDocumentReference/cbc:ID (BT-12) must be present and non-empty. The message mentions only tax invoices (01), but the executed check also covers 02.

How to fix it

Add <cac:ContractDocumentReference><cbc:ID>...</cbc:ID></cac:ContractDocumentReference> with the contract number.

ZATCA's official text

[BR-KSA-92]-If it's a B2G invoice transaction type (KSA 2, position 9 = 01), then the Contract ID (BT-12) must be present in a tax invoice and associated credit notes and debit notes (KSA-2, position 1 and 2 = 01).
Source: ZATCA SDK 3.4.8 · ZATCA KSA rules

Fails when (the condition ZATCA's SDK runs)

not(exists(cac:ContractDocumentReference/cbc:ID) and (normalize-space(cac:ContractDocumentReference/cbc:ID) != ''))

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