BR-KSA-31: Simplified invoices cannot be self-billed (KSA-2 position 7 = 0)

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

Error: the invoice is rejectedSimplified invoices (B2C)Fields: KSA-2

For InvoiceTypeCode @name starting '02' (simplified), the check requires characters 3 to 6 of @name to each be '0' or '1' and character 7 (self-billing) to be '0'. So a value such as '0200001' fails, as does any non-binary flag in positions 3–6.

How to fix it

Set the 7th character of the InvoiceTypeCode name attribute to 0, e.g. <cbc:InvoiceTypeCode name="0200000">388</cbc:InvoiceTypeCode>; self-billing is not allowed on simplified invoices.

ZATCA's official text

[BR-KSA-31]- For Simplified Tax Invoices and associated credit notes and debit notes (KSA-2, position 1 and 2 = 02), transaction types "self-billing" (KSA-2, position 7 = True) is not allowed.
Source: ZATCA SDK 3.4.8 · ZATCA KSA rules

Fails when (the condition ZATCA's SDK runs)

not( (substring(./@name, 3,1) = '1' or substring(./@name, 3,1) = '0') and (substring(./@name, 4,1) = '1' or substring(./@name, 4,1) = '0') and (substring(./@name, 5,1) = '1' or substring(./@name, 5,1) = '0') and (substring(./@name, 6,1) = '1' or substring(./@name, 6,1) = '0') and (substring(./@name, 7,1) = '0'))

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