ZATCA e-invoice validation errors and how to fix them

When FATOORA or ZATCA's SDK rejects an invoice, each problem comes with a code: BR-KSA-40 for a seller VAT number that isn't 15 digits, BR-KSA-33 for a missing invoice counter, invalid-invoice-hash for a hash that doesn't match the XML. Here is every KSA rule of the SDK with ZATCA's message and a page on the fix, and FATOORA's hash and QR code errors explained. The validator runs the same rules on your file, in your browser

KSA rules of ZATCA's SDK and our stamp and QR code checks

  • 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. Details →
  • BR-KSA-04 The document issue date (BT-2) must be less or equal to the current date. Details →
  • BR-KSA-05 The invoice type code (BT-3) must be equal to one of value from the subset of UN/CEFACT code list 1001, D.16B agreed for KSA electronic invoices. Please refer paragraph 11.2.1 of XML implementation Standards. Details →
  • BR-KSA-06 The invoice transaction code (KSA-2) must exist and respect the following structure: NNPNESBCG where NN (positions 1 and 2) = invoice subtype: - 01 for tax invoice - 02 for simplified tax invoice P (position 3) = 3rd Party invoice transaction, 0 for false, 1 for true; N (position 4) = Nominal invoice transaction, 0 for false, 1 for true; E (position 5) = Exports invoice transaction, 0 for false, 1 for true; S (position 6) = Summary invoice transaction, 0 for false, 1 for true; B (position 7) = Self billed invoice transaction, 0 for false, 1 for true; C (position 8) = Continuous Supply invoice transaction, 0 for false, 1 for true; G (position 9) = B2G invoice transaction, 0 for false, 1 for true Details →
  • BR-KSA-07 Self billing is not allowed (KSA-2, position 7 cannot be "1") for export invoices (KSA-2, position 5 = 1). Details →
  • BR-KSA-08 The seller identification (BT-29) must exist only once with one of the scheme ID (BT-29-1) (CRN, MOM, MLS, SAG, OTH, 700) and must contain only alphanumeric characters. Commercial Registration number with "CRN" as schemeID. MOMRAH license with "MOM" as schemeID. MHRSD license with "MLS" as schemeID. 700 Number with "700" as schemeID. MISA license with "SAG" as schemeID. Other ID with "OTH" as schemeID. In case of multiple commercial registrations, the seller should fill the commercial registration of the branch in respect of which the Tax Invoice is being issued. In case multiple IDs exist then one of the above must be entered following the sequence specified above. warning Details →
  • BR-KSA-09 Seller address must contain street name (BT-35), building number (KSA-17), postal code (BT-38), city (BT-37), district (KSA-3), country code (BT-40). For more information please access this link: https://splonline.com.sa/en/national-address-1/ warning Details →
  • BR-KSA-10 Where the Buyer Country Code (BT-55) is other than 'SA' Buyer address must contain a street (BT-50), city (BT-52), country code (BT-55). This rule does not apply on the simplified tax invoices and associated credit notes and debit notes (KSA-2, position 1 and 2 = 02). warning Details →
  • BR-KSA-11 An Invoice line (BG-25) where the VAT category code (BT-151) is "Not subject to VAT", an invoiced item VAT rate (BT-152) shall be 0 (zero), if exist. Details →
  • BR-KSA-12 A Document level allowance (BG-20) where VAT category code (BT-95) is "Not subject to VAT", a Document level allowance VAT rate (BT-96) shall be 0 (Zero), if exist. warning Details →
  • BR-KSA-13 A Document level charge (BG-21) where the VAT category code (BT-102) is "Not subject to VAT", a Document level charge VAT rate (BT-103) shall be 0 (zero), if exist. warning Details →
  • BR-KSA-14 The buyer identification (BT-46), required only if buyer is not VAT registered, then the buyer identification (BT-46) must be provided with one of the scheme IDs (BT-46-1) (TIN, CRN, MOM, MLS, 700, SAG, NAT, GCC, IQA, PAS, OTH) and must contain only alphanumeric characters. Tax Identification Number "TIN" as schemeID ;Commercial registration number with "CRN" as schemeID ;MOMRAH license with "MOM" as schemeID ;MHRSD license with "MLS" as schemeID ;700 Number with "700" as schemeID ;MISA license with "SAG" as schemeID ;National ID with "NAT" as schemeID ;GCC ID with "GCC" as schemeID ;Iqama Number with "IQA" as schemeID ;Passport ID with "PAS" as schemeID ;Other ID with "OTH" as schemeID. ;In case of multiple commercial registrations, the seller should fill the commercial registration of the branch in respect of which the Tax Invoice is being issued. In case multiple IDs exist then one of the above must be entered following the sequence specified above Details →
  • BR-KSA-15 The tax invoice ((invoice type code (BT-30) = 388) and (invoice transaction code (KSA-2) has "01" as first 2 digits)) must contain the supply date (KSA-5). warning Details →
  • BR-KSA-16 Payment means code (BT-81) in an invoice exist, then it must contain one of the values from subset of UNTDID 4461 code list warning Details →
  • BR-KSA-17 Debit and credit note (invoice type code (BT-3) is equal to 383 or 381) must contain the reason (KSA-10) for this invoice type issuing. Details →
  • BR-KSA-18 VAT category code must contain one of the values (S, Z, E, O). Details →
  • BR-KSA-19 Each Document level charge (BG-21) shall have a code for the reason for document level charge (BT-105). warning Details →
  • BR-KSA-20 Each Invoice line charge (BG-28) shall have a code for the reason for invoice line charge (BT-145). warning Details →
  • BR-KSA-21 Each Document level charge (BG-21) shall have a Reason for document level charge (BT-104). warning Details →
  • BR-KSA-22 Each Invoice line charge (BG-28) shall have a Reason for invoice line charge (BT-144). warning Details →
  • BR-KSA-23 A VAT breakdown (BG-23) with VAT Category code (BT-118) 'Exempt from VAT' shall have a VAT exemption reason code (BT-121). warning Details →
  • BR-KSA-24 A VAT breakdown (BG-23) with VAT Category code (BT-118) 'Not subject to VAT' shall have a VAT exception reason code (BT-121) warning Details →
  • BR-KSA-25 If it is a simplified tax invoice or an associated credit note or a debit note (KSA-2, position 1 and 2 = 02) and the tax exemption reason code (BT-121) is equal with VATEX-SA-EDU or VATEX-SA-HEA, then buyer name (BT-44) is mandatory. warning Details →
  • BR-KSA-26 If the invoice contains the previous invoice hash (KSA-13), this hash must be base64 encoded SHA256. The hash shall be computed using the following method as described in the ds:transforms block in the XML Invoice Specifications: 1. Remove the <Invoice><ext:UBLExtensions/> block 2. Remove the <Invoice><cac:AdditionalDocumentReference/> block where <cbc:ID/> = QR 3. Remove the <Invoice><cac:Signature/> block 4. Canonicalize the Invoice using the C14N11 standard 5. Hash the resulting string using SHA256 to a binary object 6. Base64 encode the binary object to generate the digest value For the first invoice, the previous invoice hash is "NWZlY2ViNjZmZmM4NmYzOGQ5NTI3ODZjNmQ2OTZjNzljMmRiYzIzOWRkNGU5MWI0NjcyOWQ3M2EyN2ZiNTdlOQ==", the equivalent for base64 encoded SHA256 of "0" (zero) character. warning Details →
  • BR-KSA-27 The document must contain a QR code (KSA-14), and this code must be base64Binary. warning Details →
  • BR-KSA-28 If the cryptographic stamp (KSA-15) exists in the invoice, this cryptographic stamp (KSA-15) must contain the exact "urn:oasis:names:specification:ubl:signature:1" value for signature information ID. Details →
  • BR-KSA-29 If the cryptographic stamp (KSA-15) exists in the invoice, this cryptographic stamp (KSA-15) must contain the exact "urn:oasis:names:specification:ubl:signature:Invoice" value for referenced signature ID and signature ID. warning Details →
  • BR-KSA-30 The document cryptographic stamp (KSA-15) must contain the exact "urn:oasis:names:specification:ubl:dsig:enveloped:xades" value for signature method. Details →
  • 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. Details →
  • BR-KSA-33 Each invoice must have an invoice counter value (KSA-16). Details →
  • BR-KSA-34 The invoice counter value (KSA-16) contains only digits. Details →
  • BR-KSA-35 If the invoice contains a supply end date (KSA-24), then the invoice must contain a supply date (KSA-5). warning Details →
  • BR-KSA-36 If the invoice contains a supply end date (KSA-24), then this date must be greater than or equal to the supply date (KSA-5). warning Details →
  • BR-KSA-37 The seller address building number must contain 4 digits. warning Details →
  • BR-KSA-39 The invoice must contain the seller VAT registration number or seller group VAT registration number (BT-31). Details →
  • 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".. Details →
  • BR-KSA-42 The buyer name (BT-44) must be present in the tax invoice and associated credit notes and debit notes (KSA-2, position 1 and 2 = 01). warning Details →
  • BR-KSA-44 If it exists in the invoice,the buyer VAT registration number or buyer group VAT registration number (BT-48) must contain 15 digits. The first digit and the last digit is "3". Details →
  • BR-KSA-49 If the tax exemption reason code (BT-121) is equal to VATEX-SA-EDU or VATEX-SA-HEA, then the other buyer ID (BT-46) is mandatory and must be national ID (BT-46-1 = NAT). Details →
  • BR-KSA-51 The line amount with VAT (KSA-12) must be Invoice line net amount (BT-131) + Line VAT amount (KSA-11). warning Details →
  • BR-KSA-52 The line VAT amount (KSA-11) is mandatory for tax invoice and associated credit notes and debit notes (KSA-2, position 1 and 2 = 01). Details →
  • BR-KSA-53 The line amount with VAT (KSA-12) is mandatory for tax invoice and associated credit notes and debit notes (KSA-2, position 1 and 2 = 01). Details →
  • BR-KSA-56 For credit notes ((BT-3) has the value of 381) and debit notes ((BT-3) has the value of 383), the billing reference ID (BT-25) is mandatory. warning Details →
  • BR-KSA-60 Cryptographic stamp (KSA-15) must exist in simplified tax invoices and associated credit notes and debit notes (KSA-2, position 1 and 2 = 02). warning Details →
  • BR-KSA-61 Previous invoice hash (KSA-13) must exist in an invoice. warning Details →
  • BR-KSA-63 If the buyer country code (BT-55) is "SA", then these fields are mandatory:street name (BT-50), building number (KSA-18), postal code (BT-53), city (BT-52), District (KSA-4), country code (BT-55).For more information please access this link:https://splonline.com.sa/en/national-address-1/ warning Details →
  • BR-KSA-66 Seller postal code (BT-38) must be 5 digits. warning Details →
  • BR-KSA-67 If the buyer country code (BT-55) is "SA", then the Buyer postal code(BT-53) must be 5 digits. warning Details →
  • BR-KSA-68 Tax currency code (BT-6) must exist in an invoice. Details →
  • BR-KSA-69 A VAT breakdown (BG-23) with VAT Category code (BT-118) 'Zero rated' shall have a VAT exception reason code (BT-121). warning Details →
  • BR-KSA-70 The invoice must contain Invoice Issue Time (KSA-25). This value should be in the format: hh:mm:ss for time expressed in local time (eg 19:20:30) or hh:mm:ssZ for time expressed in UTC (eg 19:20:30Z)."The invoice must contain Invoice Issue Time (KSA-25). This value should be in the format: hh:mm:ss for time expressed in local time (eg 19:20:30) or hh:mm:ssZ for time expressed in UTC (eg 19:20:30Z). Details →
  • BR-KSA-71 If the Invoice is a simplified invoice type and is a summary invoice (KSA-2, position 1 and 2 = 02, position 6 = 1),then the buyer name must be present. warning Details →
  • BR-KSA-72 If the Invoice is a simplified invoice type and is a summary invoice (KSA-2, position 1 and 2 = 02, position 6 = 1), then a supply date (KSA-5) and supply end date (KSA-24) must be present Details →
  • BR-KSA-73 If Pre-Paid amount (BT-113) is provided, then the following data is mandatory to provide as additional invoice line(s) -Prepayment ID (KSA-26) -Sequential invoice number (BT-1) of the prepayment invoice(s)-Prepayment Issue Date (KSA-28) -Issue date (BT-2) of the prepayment invoice(s) Prepayment Issue Time (KSA-29) - Issue time (KSA-25) of the prepayment invoice(s) Prepayment Document Type Code (KSA-30)- Invoice type code (BT-3) must be 386. warning Details →
  • BR-KSA-74 Prepayment Document Type Code (KSA-30) for the Invoice line document reference must be '386'. Details →
  • BR-KSA-75 If Prepayment Document Type code (KSA-30) is provided in an Invoice Line, then the following data is mandatory to provide in that invoice line - Prepayment VAT category Taxable Amount (KSA-31) - Sum total of taxable amounts subject to specific VAT Category code of the prepayment invoice(s); Prepayment VAT Category Tax Amount (KSA-32) - Sum total of tax amounts subject to specific VAT Category code of the prepayment invoice(s); Prepayment VAT category code (KSA-33) - the VAT category code of the associated Prepayment invoice(s); Prepayment VAT rate (KSA-34) - VAT rate of the specific VAT Category code of the prepayment invoice(s) warning Details →
  • BR-KSA-76 An Invoice line (BG-25) where the Prepayment VAT category code (KSA-33) is "Zero rated" the Prepayment VAT rate (KSA-34) shall be 0 (zero). warning Details →
  • BR-KSA-77 An Invoice line (BG-25) where the Prepayment VAT category code (KSA-33) is "Exempt from VAT" the Prepayment VAT rate (KSA-34) shall be 0 (zero). warning Details →
  • BR-KSA-78 An Invoice line (BG-25) where the Prepayment VAT category code (KSA-33) is "Not subject to VAT" the Prepayment VAT rate (KSA-34) shall be 0 (zero). warning Details →
  • BR-KSA-79 The Prepayment VAT Category Tax Amount (KSA-32) must be Prepayment VAT category Taxable Amount( (KSA-31) x Prepayment VAT rate (KSA-34) /100). warning Details →
  • BR-KSA-80 The Pre-Paid amount (BT-113) must be equal to the sum total of the Prepayment VAT category Taxable Amount (KSA-31) and the Prepayment VAT Category Tax Amount (KSA-32). warning Details →
  • BR-KSA-81 The other Buyer ID (BT-46) must present in the tax invoice and associated debit notes and credit notes (KSA-2, position 1 and 2 = 01), where the buyer VAT registration number or buyer group VAT registration number (BT-48) is not provided. warning Details →
  • BR-KSA-82 An Invoice line (BG-25) where Prepayment Document Type Code (KSA-30) is provided, then Item net price (BT-146); Invoice line allowance amount (BT-136); Invoice line charge amount (BT-141); Item line net amount (BT-131); line VAT amount (KSA-11); and line amount with VAT (KSA-12) for that line shall be 0 (Zero), if exist. Details →
  • BR-KSA-83 A VAT breakdown (BG-23) with VAT Category code (BT-118) 'Exempt from VAT' or 'Zero rated' or 'Not subject to VAT' shall have a VAT exemption (or exception) reason text (BT-120) with one of the values from paragraph 11.2.4 of XML implementation standards on Tax exemption (or exception) reason text - specific to Saudi Arabia. warning Details →
  • BR-KSA-84 The Document level allowance VAT rate (BT-96), Document level Charge VAT rate (BT-103), VAT category rate(BT-119), Invoiced item VAT rate (BT-152), Prepayment VAT rate(KSA-34) must be limited to one of the following values (5 or 15) when the relevant Document level allowance VAT category code (BT-95), Document level Charge VAT category code(BT-102), VAT category code(BT-118), Invoiced item VAT category code(BT-151), Prepayment VAT Category Code (KSA-33) is "S"- "Standard rated". In other words, for Standard Rate VAT Category the rate can either be 15% or 5%. Details →
  • BR-KSA-85 The Buyer's contact phone number (BT-57) shall start with "0" or "+", followed by a maximum of 15 number and minimum 4 character after the "+" or "0" , if exist. warning Details →
  • BR-KSA-87 If the tax exchange rate (KSA-36) exists, then Source Currency Code (KSA-37), Target Currency Code (KSA-38) and Calculation Rate (KSA-39) shall be provided warning Details →
  • BR-KSA-88 If exist, Source Currency Code (KSA-37) must be the same as Invoice currency code (BT-5) Details →
  • BR-KSA-89 If exists, Target Currency Code (KSA-38) must be the same as the Tax currency code (BT-6) Details →
  • BR-KSA-90 If exists, the allowed maximum number of digits for the Tax Exchange Rate (KSA-39) is 14. Details →
  • 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). Details →
  • BR-KSA-93 An Invoice line (BG-25) where the Prepayment VAT category code (KSA-33) is "Zero-rated" the Prepayment VAT exception reason code (KSA-41) should be provided. warning Details →
  • BR-KSA-94 An Invoice line (BG-25) where the Prepayment VAT category code (KSA-33) is " Exempt from VAT " the Prepayment VAT exemption reason code (KSA-41) should be provided. warning Details →
  • BR-KSA-95 An Invoice line (BG-25) where the Prepayment VAT category code (KSA-33) is " Not subject to VAT " the Prepayment VAT exception reason code (KSA-41) should be provided. warning Details →
  • BR-KSA-96 An Invoice line (BG-25) with the Prepayment VAT category code (KSA-33) 'Exempt from VAT' or 'Zero rated' or 'Not subject to VAT' shall have a Prepayment VAT exemption(or exception) reason text (KSA-42) with one of the values from paragraph 11.2.4 of XML implementation standards on Tax exemption (or exception) reason text - specific to Saudi Arabia. warning Details →
  • BR-KSA-97 If the Document Currency Code (BT-5) is different from "SAR", then the value in "Invoice total VAT amount (BT-110)" cannot be the same as the value in "Invoice total VAT amount in accounting currency (BT-111)". warning Details →
  • BR-KSA-98 The simplified invoice should be submitted within 24 hours of issuing the invoice. warning Details →
  • BR-KSA-99 If it exists in the invoice, the buyer VAT registration number or buyer group VAT registration number (BT-48) should not be left empty in the tax invoice and associated credit notes and debit notes (KSA-2, position 1 and 2 = 01). warning Details →
  • BR-KSA-CL-01 Currency code (BT-5) must be according to ISO 4217:2005 Details →
  • BR-KSA-CL-02 All currencyID attributes (BT-5) must have the same value as the invoice currency code (BT-5), except for the invoice total VAT amount in accounting currency (BT-111). Details →
  • BR-KSA-CL-03 Mime code must be according to subset of IANA code list. Details →
  • BR-KSA-CL-04 If VAT category Code (BT-118) is 'Z', or 'E', VAT exemption (or exception) reason code (BT-121) must exist with one of the values from paragraph 11.2.4 of XML implementation standards on Tax exemption (or exception) reason code - specific to Saudi Arabia. warning Details →
  • BR-KSA-CL-06 Code for the reason for document level charge (BT-105) and the code for the reason for invoice line charge (BT-145) MUST be coded using UNTDID 7161 code list. https://unece.org/fileadmin/DAM/trade/untdid/d16b/tred/tred7161.htm warning Details →
  • BR-KSA-CL-07 If the Prepayment VAT Category Code(KSA-33) is 'Z', or 'E' or 'O', the Prepayment VAT exemption (or exception) reason code(KSA-41) must exist with one of the values from paragraph 11.2.4 of XML implementation standards on Tax exemption (or exception) reason code - specific to Saudi Arabia. warning Details →
  • BR-KSA-DEC-01 The allowance percentage values (BT-94, BT-138) must be from 0.00 to 100.00, with maximum two decimal places. Only numerals are accepted, the percentage symbol (%) is not allowed. Details →
  • BR-KSA-DEC-02 The VAT rates (BT-96, BT-103, BT-119, BT-152, KSA-34) must be from 0.00 to 100.00, with maximum two decimals.Only numerals are accepted, the percentage symbol (%) is not allowed. Details →
  • BR-KSA-DEC-03 VAT amount at line level (KSA-11) must have a maximum two decimals. warning Details →
  • BR-KSA-DEC-04 Amount with VAT at line level (KSA-12) must have a maximum two decimals. warning Details →
  • BR-KSA-DEC-06 Prepayment VAT category Taxable Amount (KSA-31) and Prepayment VAT Category Tax Amount (KSA-32) must have a maximum two decimals. warning Details →
  • BR-KSA-EN16931-01 Business process (BT-23) must be "reporting:1.0". Details →
  • BR-KSA-EN16931-02 VAT accounting currency code (BT-6) must be "SAR". Details →
  • BR-KSA-EN16931-03 Allowance/Charge amount (BT-92, BT-99, BT-136, BT-141) must equal base amount (BT-93, BT-100, BT-137, BT-142) * percentage (BT-94, BT-101, BT-138, BT-143) / 100 if base amount and percentage exists. warning Details →
  • BR-KSA-EN16931-04 Allowance/Charge base amount (BT-93, BT-100, BT-137, BT-142) must be provided when allowance/Charge percentage (BT-94, BT-101,BT-138, BT-143) is provided. warning Details →
  • BR-KSA-EN16931-05 Allowance/Charge percentage (BT-94, BT-101, BT-138, BT-143) must be provided when the allowance/Charge base amount (BT-93, BT-100, BT-137, BT-142) is provided. warning Details →
  • BR-KSA-EN16931-06 Charge on price level (BG-29) is not allowed. The value of Indicator should be 'false'. Details →
  • BR-KSA-EN16931-07 Item net price (BT-146) must equal (Item Gross price (BT-148) - Allowance amount (BT-147)) when gross price is provided. Details →
  • BR-KSA-EN16931-08 Only one tax total (BG-22) with tax subtotals must be provided.Refer to Calculation of VAT. warning Details →
  • BR-KSA-EN16931-09 Only one tax total (BG-22) without tax subtotals (BG-23) must be provided when tax currency code is provided . warning Details →
  • BR-KSA-EN16931-11 Invoice line net amount (BT-131) must equal (Invoiced quantity (BT-129) * (Item net price (BT-146) / item price base quantity (BT-149))-) + Sum of invoice line charge amount (BT-141) - Sum of invoice line allowance amount (BT-136). warning Details →
  • BR-KSA-EN16931-12 Base quantity (BT-149) must be a positive number above zero. Details →
  • BR-KSA-F-01 A date MUST be formatted YYYY-MM-DD, in accordance to the "Calendar date complete representation" as specified by ISO 8601:2004, format YYYY-MM-DD. Details →
  • BR-KSA-F-02 Allowance/Charge Indicator value MUST equal to 'false'/’True’ respectively. Details →
  • BR-KSA-F-04 All the document amounts and quantities must be positive, unless specified otherwise. Details →
  • BR-KSA-F-05 Prepayment Issue Time (KSA-29) must be in the format: hh:mm:ss for time expressed in local time or hh:mm:ssZ for time expressed in UTC.(eg 19:20:30) warning Details →
  • BR-KSA-F-06-C1 Field character limits for Invoice number field (BT-1) have not been met. The minimum limit is 1 character and the maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C2 Field character limits for Invoice note field (BT-22) have not been met. The maximum limit is 1000 characters. warning Details →
  • BR-KSA-F-06-C3 Field character limits for Purchase order ID field (BT-13) have not been met. The maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C4 Field character limits for the Seller Address - Street field (BT-35) have not been met. The minimum limit is 1 character and the maximum limit is 1000 characters. warning Details →
  • BR-KSA-F-06-C5 Field character limits for Contract ID field (BT-12) have not been met. The maximum limit is 127 characters . warning Details →
  • BR-KSA-F-06-C6 Field character limits for the Seller Address - Additional street field (BT-36) have not been met. The maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C7 Field character limits for the Seller Address - City field (BT-37) have not been met. The minimum limit is 1 character and the maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C8 Field character limits for the Seller Address - Province/State field (BT-39) have not been met. The maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C9 Field character limits for the Seller Address - District field (KSA-3) have not been met. The minimum limit is 1 character and the maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C10 Field character limits for Seller name field (BT-27) have not been met. The minimum limit is 1 character and the maximum limit is 1000 characters. warning Details →
  • BR-KSA-F-06-C11 Field character limits for the Buyer Address - Additional street field (BT-51) have not been met. The maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C12 Field character limits for Buyer name field (BT-44) have not been met. The minimum limit is 1 character and the maximum limit is 1000 characters. warning Details →
  • BR-KSA-F-06-C13 Field character limits for Reasons for issuance of credit / debit note field (KSA-10) have not been met. The minimum limit is 1 character and the maximum limit is 1000 characters . warning Details →
  • BR-KSA-F-06-C14 Field character limits for Payment terms field (KSA-22) have not been met. The maximum limit is 1000 characters. warning Details →
  • BR-KSA-F-06-C15 Field character limits for Payment account identifier field (BT-84) have not been met. The maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C16 Field character limits for VAT exemption reason text field (BT-120) have not been met. The minimum limit is 1 character and the maximum limit is 1000 characters. warning Details →
  • BR-KSA-F-06-C17 Field character limits for Invoice line identifier field (BT-126) have not been met. The minimum limit is 1 character and the maximum limit is 6 characters. Details →
  • BR-KSA-F-06-C18 Field character limits for Invoiced quantity unit of measure field (BT-130) have not been met. The maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C19 Field character limits for Item name field (BT-153) have not been met. The minimum limit is 3 character and the maximum limit is 1000 characters. warning Details →
  • BR-KSA-F-06-C20 Field character limits for Item standard identifier field (BT-157) have not been met. The maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C21 Field character limits for Item price base quantity unit code field (BT-150) have not been met. The maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C22 Field character limits for Billing reference ID field (BT-25) have not been met. The minimum limit is 1 character and the maximum limit is 5000 characters. Details →
  • BR-KSA-F-06-C23 Field character limits for the Buyer Address - Street field (BT-50) have not been met. The minimum limit is 1 character and the maximum limit is 1000 characters. warning Details →
  • BR-KSA-F-06-C24 Field character limits for the Buyer Address - Street field (BT-50) have not been met. The maximum limit is 1000 characters. warning Details →
  • BR-KSA-F-06-C25 Field character limits for the Buyer Address - City field (BT-52) have not been met. The minimum limit is 1 character and the maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C26 Field character limits for the Buyer Address - City field (BT-52) have not been met. The maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C27 Field character limits for the Buyer Address - Province/State field (BT-54) have not been met. The maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C28 Field character limits for the Buyer Address - District field (KSA-4) have not been met. The minimum limit is 1 character and the maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C29 Field character limits for the Buyer Address - District field (KSA-4) have not been met. The maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C30 Field character limits for Item Buyer's identifier field (BT-156) have not been met. The maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C31 Field character limits for Item Seller's identifier field (BT-155) have not been met. The maximum limit is 127 characters. warning Details →
  • BR-KSA-F-06-C32 Field character limits for Buyer name field (BT-44) have not been met. The maximum limit is 1000 characters. warning Details →
  • BR-KSA-F-06-C33 Field character limits for Reason for the document level charge (BT-104) have not been met. The maximum limit is 1,000 characters. warning Details →
  • BR-KSA-F-06-C34 Field character limits for Reason for invoice line charge (BT-144) have not been met. The maximum limit is 1,000 characters. warning Details →
  • BR-KSA-F-06-C35 Field character limits for Reason for the document level allowance (BT-97) have not been met. The maximum limit is 1,000 characters. warning Details →
  • BR-KSA-F-06-C36 Field character limits for Reason for the invoice line allowance (BT-139) have not been met. The maximum limit is 1,000 characters. warning Details →
  • BR-KSA-F-06-C37 Field character limits for the contact name - Buyer's contact point field (BT-56) have not been met. The maximum limit is 1000 characters. warning Details →
  • BR-KSA-F-06-C38 Field character limits for the contact note - Buyer's Contact Note field (KSA-35) have not been met. The maximum limit is 1000 characters. warning Details →
  • BR-KSA-F-06-C39 Field character limits for the Prepayment VAT exemption reason text (KSA-42) have not been met. The maximum limit is 1000 characters. warning Details →
  • BR-KSA-F-06-C40 Field character limits for Invoice transaction code (KSA-2) have not been met. The minimum limit is 7 characters and the maximum limit is 9 characters. warning Details →
  • BR-KSA-F-07 The value provided in Other Buyer ID (BT-46) for scheme ID 'TIN' appears to be incorrect. Please recheck the value to avoid non-compliance. warning Details →
  • BR-KSA-F-08 The value provided in Other Seller ID (BT-29) or Other Buyer ID (BT-46) for the scheme ID 'CRN' appears to be incorrect. Please recheck the value to avoid non-compliance. warning Details →
  • BR-KSA-F-09 The value provided in Other Seller ID (BT-29) or Other Buyer ID (BT-46) for the scheme ID '700' appears to be incorrect. Please recheck the value to avoid non-compliance. warning Details →
  • BR-KSA-F-10 The value provided in Other Buyer ID (BT-46) for the scheme ID 'NAT' appears to be incorrect. Please recheck the value to avoid non-compliance. warning Details →
  • BR-KSA-F-11 The value provided in Other Buyer ID (BT-46) for the scheme ID 'IQA' appears to be incorrect. Please recheck the value to avoid non-compliance. warning Details →
  • BR-KSA-F-12 The Other Seller/Buyer schema ID (BT-29-1 or BT-46-1) contains spaces. Please recheck the attribute and remove the empty space to avoid non-compliance. warning Details →
  • BR-KSA-F-13 Please recheck Other Seller/Buyer ID (BT-29 or BT-46) as it contains an invalid value. warning Details →
  • BR-KSA-F-C-01 Please recheck Item Description (BT-153). Providing unclear description violates the requirements specified in Article 53 of VAT Regulations. warning Details →
  • XV-SA-01 The invoice hash in the signature (DigestValue of the invoiceSignedData reference, …) is not the hash of the invoice (…): the invoice changed after it was signed, or the hash was made over another form of it. Details →
  • XV-SA-02 The signature (ds:SignatureValue) does not verify with the public key of the certificate in the signature over the invoice hash it states. Details →
  • XV-SA-03 The certificate digest in the signed properties (xades:CertDigest, …) is not that of the certificate in the signature (…). Details →
  • XV-SA-04 The digest of the signed properties in the signature (…) is not that of xades:SignedProperties (…). Details →
  • XV-SA-05 The QR code can't be read: …. Details →
  • XV-SA-06 The QR code is … characters long; ZATCA's standard allows up to 700. warning Details →
  • XV-SA-07 The QR code lacks tag …: it must carry tags 1 to 8…. Details →
  • XV-SA-08 The seller's name in the QR code (tag 1, …) is not the seller's RegistrationName (…). Details →
  • XV-SA-09 The VAT number in the QR code (tag 2, …) is not the seller's (…). Details →
  • XV-SA-10 The time stamp in the QR code (tag 3, …) is not the invoice's issue date and time (…). Details →
  • XV-SA-11 The total with VAT in the QR code (tag 4, …) is neither the invoice's TaxInclusiveAmount (…) nor, after prepayments, its PayableAmount (…). Details →
  • XV-SA-12 The VAT total in the QR code (tag 5, …) is not the invoice's VAT total (…). Details →
  • XV-SA-13 The invoice hash in the QR code (tag 6, …) is not the hash of the invoice (…). Details →
  • XV-SA-14 The signature in the QR code (tag 7) is not the invoice's ds:SignatureValue. Details →
  • XV-SA-15 The public key in the QR code (tag 8) is not that of the certificate in the signature. Details →
  • XV-SA-16 The certificate signature in the QR code (tag 9) is not that of the certificate in the signature. Details →

FATOORA's hash and QR code errors

  • invalid-invoice-hash

    The invoice hash API body does not match the (calculated) Hash of the XML

    The invoiceHash sent with the API request is not the hash FATOORA computes from the XML: the SHA-256 of the invoice without ext:UBLExtensions, cac:Signature and the QR code's AdditionalDocumentReference, canonicalized with C14N 1.1, in Base64. Any change to the XML after hashing breaks it, a reformat or a changed line ending included, so hash the file exactly as you send it and send the hash that is in its signature. The validator recomputes the hash and compares it with the signature's: XV-SA-01

  • invoiceHash_QRCODE_INVALID

    Invoice xml hash does not match with qr code invoice xml hash

    Tag 6 of the QR code holds another hash than the invoice's, usually because the QR code was made before a last change to the invoice. Make the QR code after signing, from the same file. The validator reads every tag of the QR code and compares it with the invoice and its stamp: XV-SA-13

  • signed-properties-hashing

    Invalid signed properties hashing, SignedProperties with id='xadesSignedProperties'

    The digest of xades:SignedProperties in the signature is not the one FATOORA computes. ZATCA's SDK digests the signed properties in a fixed serialization and writes the digest as the Base64 of the hex SHA-256, not of its bytes; a signing time, namespace declarations or whitespace changed after the digest break it. The validator recomputes it the SDK's way: XV-SA-04

How to read ZATCA's answer

FATOORA, and ZATCA's SDK before it, check an invoice in steps: the UBL 2.1 schema, the EN 16931 rules as ZATCA ships them (BR-*, BR-CO-* and others), then the KSA rules (BR-KSA-*), which win where the two differ, then the QR code, the cryptographic stamp and the previous invoice hash. Each finding in the answer names its category and its code.

Errors stop the invoice: a tax invoice is not cleared, a simplified one is not reported. Warnings let it through, but ZATCA expects them fixed. The KSA rules mark the fields in their messages by their EN 16931 ids (BT-31, the seller VAT number) or by ZATCA's own (KSA-16, the invoice counter).

The errors that come up most

  • BR-KSA-40: the seller VAT number has 15 digits and starts and ends with 3.
  • BR-KSA-33 and BR-KSA-34: the invoice counter (ICV, KSA-16) is there and is digits only.
  • BR-KSA-37 and BR-KSA-66: the national address, a building number of 4 digits and a postal code of 5.
  • BR-KSA-70: the issue time, as hh:mm:ss.
  • BR-KSA-EN16931-02 and BR-KSA-68: the VAT is accounted in SAR, whatever the invoice's currency.
  • BR-KSA-F-06-C1 to C40: a field longer or shorter than ZATCA allows, such as a line id over 6 characters (BR-KSA-F-06-C17).

Checking an invoice before FATOORA

Open the validator with the ZATCA tax invoice profile, or the simplified one, and paste or drop the XML; a file opened picks the right profile from its invoice type. It runs the schema, the EN 16931 and KSA rules of ZATCA's SDK 3.4.6, then our checks of the stamp and the QR code: the invoice hash recomputed, the ECDSA signature against the certificate, the certificate and signed properties digests, and each tag of the QR code against the invoice. Nothing is uploaded.

What a single file can't show stays with FATOORA: that ZATCA issued the certificate of your solution (its CSID), that the previous invoice hash is that of your last invoice, that the invoice counter follows on, duplicates, and the time a simplified invoice is reported in.

Questions

What does invalid-invoice-hash mean?

That the invoice hash sent to FATOORA is not the hash of the XML it received. The XML changed after hashing, or the hash was computed over another form of it. Hash the final file, without UBLExtensions, the signature and the QR code reference, canonicalized with C14N 1.1.

What is the difference between a ZATCA error and a warning?

An error stops the invoice: a tax invoice is not cleared and a simplified invoice is not reported. A warning lets it through, but should be fixed.

Does a pass here mean FATOORA will accept the invoice?

It means the invoice passes the schema, the rules of ZATCA's SDK and our checks of the stamp and the QR code. FATOORA also checks your certificate, the chain of previous invoice hashes, the invoice counter and duplicates, which a single file can't show.

Is the invoice uploaded?

No. The check runs in your browser; only the API and URL monitors validate on our servers.

Sources