BR-KSA-40: Seller VAT number (BT-31): 15 digits, starting and ending with 3

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

Error: the invoice is rejectedConditional, see belowFields: BT-31

When the seller has a cac:PartyTaxScheme with TaxScheme cbc:ID 'VAT' and a cbc:CompanyID, that CompanyID (BT-31) must be exactly 15 digits, with the first and last digit both '3'.

How to fix it

Use the seller's 15-digit VAT number in cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID, with no spaces, letters or prefixes.

ZATCA's official text

[BR-KSA-40]-If it exists in the invoice, the seller VAT registration number (BT-31) must contain 15 digits. The first and the last digits are "3"..
Source: ZATCA SDK 3.4.8 · ZATCA KSA rules

Fails when (the condition ZATCA's SDK runs)

not(matches(//cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID, '^[0-9]{15}$') and starts-with(//cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID, '3') and ends-with(//cac:AccountingSupplierParty/cac:Party/cac:PartyTaxScheme/cbc:CompanyID, '3'))

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