Announcing the launch of the Saudi Zatca-2 E-Invoicing app on FrappeCloud

And for the CSR config I just use the code you’ve provided earlier. Correct?

it is sample for sanbox testing. For production and simulation, you need to put your company parameters.


@Support-at-ERPgulf please help me to solve this warnings and errors

put something in address line 1 and 2


thank you for valuable response.

i have added address line 1 and line 2 but it showing “Invoice tax categories MUST be coded using UNCL5305 code list” error message

Are you using item-tax template? So inside that there is tax category and reason. You need to give values there .

After inputting the CSR configuration. I am trying to check for compliance and keep getting this message"
image_2024-09-04_130259605

Is there an updated tutorial that reflects any changes done to the app and how it should be used? It would be greatly appreciated if we can have a documentation of some sort of the steps to follow in order to set it up properly after the updates that were made.

Thank you.

We are releasing a new tutorial video soon.

My apologies but it seems like there was an issue from my side originally in generating the Compliance CSID. I’ve managed to do so and this is the message I am getting when I generate it:

Blockquote{“requestID”:1234567890123,“dispositionMessage”:“ISSUED”,“binarySecurityToken”:“TUlJQ2N6Q0NBaHFnQXdJQkFnSUdBWkc4akFTcU1Bb0dDQ3FHU000OUJBTUNNQlV4RXpBUkJnTlZCQU1NQ21WSmJuWnZhV05wYm1jd0hoY05NalF3T1RBME1UQXhPVE16V2hjTk1qa3dPVEF6TWpFd01EQXdXakJ3TVFzd0NRWURWUVFHRXdKVFFURVlNQllHQTFVRUN3d1BNekV3TmpBeU5UVXpNVEF3TURBek1SNHdIQVlEVlFRS0RCVkZiV3RoYmlCSWIyeGthVzVuSUVOdmJYQmhibmt4SnpBbEJnTlZCQU1NSGxSVFZDMHlNRFV4TWpNd09EQTFMVE14TURZd01qVTFNekV3TURBd016QldNQkFHQnlxR1NNNDlBZ0VHQlN1QkJBQUtBMElBQkZqQndmRm10MXN3YkgvS3FaaUFldlFCLzlBNXM3emxsT0pFakxwU2dxQ0JXN1NvOFBpZ0JQcHJCaWNSTDE5bktlUGRKaHNSUTNna0ZkU0ErQWExTFoyamdmMHdnZm93REFZRFZSMFRBUUgvQkFJd0FEQ0I2UVlEVlIwUkJJSGhNSUhlcElIYk1JSFlNVHN3T1FZRFZRUUVEREl4TFZSVFZId3lMVlJUVkh3ekxXVmtNakptTVdRNExXVTJZVEl0TVRFeE9DMDVZalU0TFdRNVlUaG1NVEZsT0RjMFpqRWZNQjBHQ2dtU0pvbVQ4aXhrQVFFTUR6TXhNRFl3TWpVMU16RXdNREF3TXpFTk1Bc0dBMVVFREF3RU1URXdNREZSTUU4R0ExVUVHZ3hJT1RFNU9TQkxhVzVuSUVaaGFHRmtJR0pwYmlCQlltUjFiR0Y2YVhvZ1VtOWhaQ3dnUW1GdVpHRnlhWGxoSUVScGMzUWdNamsxTVNBdElFRnNhMmh2WW1GeUlETTBOREkwTVJZd0ZBWURWUVFQREExVVpYTjBhVzVuSUhwaGRHTmhNQW9HQ0NxR1NNNDlCQU1DQTBjQU1FUUNJRTNxY3RUeng2VWJnN0xFTEhIeDRNUE12b2JDalBObXJtWGdBdnkvZERYaUFpQk1NMnhlT1ZHLzlMYS96NkI0ckd3dThXQ2tFQVk4VGQ2TlRTOU1qQ0gzVGc9PQ==”,“secret”:“BwCMtS9u0GvRIRmaavyqiZfc9mlisZTMVphEYck+mmQ=”,“errors”:null}

Now when testing for compliance I am getting the following:

Error in compliance: {“validationResults”:{“infoMessages”:,“warningMessages”:[{“type”:“WARNING”,“code”:“BR-KSA-F-06-C9”,“category”:“KSA”,“message”:“[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.”,“status”:“WARNING”}],“errorMessages”:[{“type”:“ERROR”,“code”:“XSD_ZATCA_INVALID”,“category”:“XSD validation”,“message”:“Schema validation failed; XML does not comply with UBL 2.1 standards in line with ZATCA specifications. ERROR: org.xml.sax.SAXParseException; lineNumber: 84; columnNumber: 182; cvc-datatype-valid.1.2.1: ‘{"data": [{"company": "PD", "pih": "Z2MUlF0UMgOBHH2bdcyBlwNnocmeWR+ZWzOiHTfGyoQ="}]}’ is not a valid value for ‘base64Binary’.”,“status”:“ERROR”},{“type”:“ERROR”,“code”:“BR-CL-18”,“category”:“EN_16931”,“message”:“Invoice tax categories MUST be coded using UNCL5305 code list”,“status”:“ERROR”}],“status”:“ERROR”},“reportingStatus”:“NOT_REPORTED”,“clearanceStatus”:null,“qrSellertStatus”:null,“qrBuyertStatus”:null}

ERROR in clearance invoice, ZATCA validation: Error in compliance: {“validationResults”:{“infoMessages”:,“warningMessages”:[{“type”:“WARNING”,“code”:“BR-KSA-F-06-C9”,“category”:“KSA”,“message”:“[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.”,“status”:“WARNING”}],“errorMessages”:[{“type”:“ERROR”,“code”:“XSD_ZATCA_INVALID”,“category”:“XSD validation”,“message”:“Schema validation failed; XML does not comply with UBL 2.1 standards in line with ZATCA specifications. ERROR: org.xml.sax.SAXParseException; lineNumber: 84; columnNumber: 182; cvc-datatype-valid.1.2.1: ‘{"data": [{"company": "PD", "pih": "Z2MUlF0UMgOBHH2bdcyBlwNnocmeWR+ZWzOiHTfGyoQ="}]}’ is not a valid value for ‘base64Binary’.”,“status”:“ERROR”},{“type”:“ERROR”,“code”:“BR-CL-18”,“category”:“EN_16931”,“message”:“Invoice tax categories MUST be coded using UNCL5305 code list”,“status”:“ERROR”}],“status”:“ERROR”},“reportingStatus”:“NOT_REPORTED”,“clearanceStatus”:null,“qrSellertStatus”:null,“qrBuyertStatus”:null}

Error in Zatca invoice call: ERROR in clearance invoice, ZATCA validation: Error in compliance: {“validationResults”:{“infoMessages”:,“warningMessages”:[{“type”:“WARNING”,“code”:“BR-KSA-F-06-C9”,“category”:“KSA”,“message”:“[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.”,“status”:“WARNING”}],“errorMessages”:[{“type”:“ERROR”,“code”:“XSD_ZATCA_INVALID”,“category”:“XSD validation”,“message”:“Schema validation failed; XML does not comply with UBL 2.1 standards in line with ZATCA specifications. ERROR: org.xml.sax.SAXParseException; lineNumber: 84; columnNumber: 182; cvc-datatype-valid.1.2.1: ‘{"data": [{"company": "PD", "pih": "Z2MUlF0UMgOBHH2bdcyBlwNnocmeWR+ZWzOiHTfGyoQ="}]}’ is not a valid value for ‘base64Binary’.”,“status”:“ERROR”},{“type”:“ERROR”,“code”:“BR-CL-18”,“category”:“EN_16931”,“message”:“Invoice tax categories MUST be coded using UNCL5305 code list”,“status”:“ERROR”}],“status”:“ERROR”},“reportingStatus”:“NOT_REPORTED”,“clearanceStatus”:null,“qrSellertStatus”:null,“qrBuyertStatus”:null}

you need to put
address line 1
Address line 2
PO Box
On item-tax-tempalte - tax category and reason code

OTP expired and now every time I generate a new one and try to use it to regenerate the Compliance CSID I get the following error:

Error: OTP is not valid. {“errors”:[{“code”:“Invalid-OTP”,“message”:“The provided OTP is invalid”}]}

Error in creating CSID: Error: OTP is not valid. {“errors”:[{“code”:“Invalid-OTP”,“message”:“The provided OTP is invalid”}]}

For more clarification nothing was changed aside from the OTP and I’ve been trying with a new code every 15 minutes for over 2 hours and still the same error.

make sure you have OTP from simulation portal if you are trying simulation .
On the zatca portal verify that your VAT is matching your CSR config.

Message

After following the instructions, except for being stuck with choosing the “reason code” as I can’t find a reference on how to choose the proper one, these are the errors I am getting now.

Error in compliance: {“validationResults”:{“infoMessages”:[{“type”:“INFO”,“code”:“XSD_ZATCA_VALID”,“category”:“XSD validation”,“message”:“Complied with UBL 2.1 standards in line with ZATCA specifications”,“status”:“PASS”}],“warningMessages”:[{“type”:“WARNING”,“code”:“BR-CO-17”,“category”:“EN_16931”,“message”:“VAT category tax amount (BT-117) = VAT category taxable amount (BT-116) x (VAT category rate (BT-119) / 100), rounded to two decimals.”,“status”:“WARNING”}],“errorMessages”:[{“type”:“ERROR”,“code”:“BR-CL-18”,“category”:“EN_16931”,“message”:“Invoice tax categories MUST be coded using UNCL5305 code list”,“status”:“ERROR”}],“status”:“ERROR”},“reportingStatus”:“NOT_REPORTED”,“clearanceStatus”:null,“qrSellertStatus”:null,“qrBuyertStatus”:null}

ERROR in clearance invoice, ZATCA validation: Error in compliance: {“validationResults”:{“infoMessages”:[{“type”:“INFO”,“code”:“XSD_ZATCA_VALID”,“category”:“XSD validation”,“message”:“Complied with UBL 2.1 standards in line with ZATCA specifications”,“status”:“PASS”}],“warningMessages”:[{“type”:“WARNING”,“code”:“BR-CO-17”,“category”:“EN_16931”,“message”:“VAT category tax amount (BT-117) = VAT category taxable amount (BT-116) x (VAT category rate (BT-119) / 100), rounded to two decimals.”,“status”:“WARNING”}],“errorMessages”:[{“type”:“ERROR”,“code”:“BR-CL-18”,“category”:“EN_16931”,“message”:“Invoice tax categories MUST be coded using UNCL5305 code list”,“status”:“ERROR”}],“status”:“ERROR”},“reportingStatus”:“NOT_REPORTED”,“clearanceStatus”:null,“qrSellertStatus”:null,“qrBuyertStatus”:null}

Error in Zatca invoice call: ERROR in clearance invoice, ZATCA validation: Error in compliance: {“validationResults”:{“infoMessages”:[{“type”:“INFO”,“code”:“XSD_ZATCA_VALID”,“category”:“XSD validation”,“message”:“Complied with UBL 2.1 standards in line with ZATCA specifications”,“status”:“PASS”}],“warningMessages”:[{“type”:“WARNING”,“code”:“BR-CO-17”,“category”:“EN_16931”,“message”:“VAT category tax amount (BT-117) = VAT category taxable amount (BT-116) x (VAT category rate (BT-119) / 100), rounded to two decimals.”,“status”:“WARNING”}],“errorMessages”:[{“type”:“ERROR”,“code”:“BR-CL-18”,“category”:“EN_16931”,“message”:“Invoice tax categories MUST be coded using UNCL5305 code list”,“status”:“ERROR”}],“status”:“ERROR”},“reportingStatus”:“NOT_REPORTED”,“clearanceStatus”:null,“qrSellertStatus”:null,“qrBuyertStatus”:null}

Forgot to mention that I have 6 different “Item Tax Templates”. Not sure if that would help…

while validating Simplified Invoice I am getting below message

Error in compliance: {“validationResults”:{“infoMessages”:,“warningMessages”:,“errorMessages”:[{“type”:“ERROR”,“code”:“XSD_ZATCA_INVALID”,“category”:“XSD validation”,“message”:“Schema validation failed; XML does not comply with UBL 2.1 standards in line with ZATCA specifications. ERROR: org.xml.sax.SAXParseException; lineNumber: 84; columnNumber: 183; cvc-datatype-valid.1.2.1: ‘{"data": [{"company": "SAC", "pih": "hwzPEK0wSvY1Zu/K9UlKqHA4tLykFZAxKdL4mAeBhJ8="}]}’ is not a valid value for ‘base64Binary’.”,“status”:“ERROR”}],“status”:“ERROR”},“reportingStatus”:“NOT_REPORTED”,“clearanceStatus”:null,“qrSellertStatus”:null,“qrBuyertStatus”:null}

I am getting following error for item line.when I checked XML I found out difference
<cbc:BaseAmount currencyID=“SAR”>0.0</cbc:BaseAmount> instead of 0 this must be item price.
What changes I need to make to avoid such error

{“validationResults”:{“infoMessages”:[{“type”:“INFO”,“code”:“XSD_ZATCA_VALID”,“category”:“XSD validation”,“message”:“Complied with UBL 2.1 standards in line with ZATCA specifications”,“status”:“PASS”}],“warningMessages”:[{“type”:“WARNING”,“code”:“BR-KSA-37”,“category”:“KSA”,“message”:“The seller address building number must contain 4 digits.”,“status”:“WARNING”}],“errorMessages”:[{“type”:“ERROR”,“code”:“BR-KSA-EN16931-07”,“category”:“KSA”,“message”:“[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.”,“status”:“ERROR”}],“status”:“ERROR”},“clearanceStatus”:“NOT_CLEARED”,“clearedInvoice”:null}

1- he seller address building number must contain 4 digits. - On your company address. On address line-2 , you give 4 digit building number. this warning will go.
2-You can not give discount on gross-total. You can give discount on net-total only. The reason is gross-amount calculated after tax.

There is no discount in the invoice.we just entered the rate and tax.following are the excerpts from the XML file.

cac:Delivery

cbc:ActualDeliveryDate2024-10-20</cbc:ActualDeliveryDate>

</cac:Delivery>

cac:PaymentMeans

cbc:PaymentMeansCode30</cbc:PaymentMeansCode>

</cac:PaymentMeans>

cac:AllowanceCharge

cbc:ChargeIndicatorfalse</cbc:ChargeIndicator>

cbc:AllowanceChargeReasonDiscount</cbc:AllowanceChargeReason>

<cbc:Amount currencyID=“SAR”>0.00</cbc:Amount>

cac:TaxCategory

cbc:IDS</cbc:ID>

cbc:Percent15.00</cbc:Percent>

cac:TaxScheme

cbc:IDVAT</cbc:ID>

</cac:TaxScheme>

</cac:TaxCategory>

</cac:AllowanceCharge>

cac:TaxTotal

<cbc:TaxAmount currencyID=“SAR”>0.15</cbc:TaxAmount>

</cac:TaxTotal>

cac:TaxTotal

<cbc:TaxAmount currencyID=“SAR”>0.15</cbc:TaxAmount>

cac:TaxSubtotal

<cbc:TaxableAmount currencyID=“SAR”>1.0</cbc:TaxableAmount>

<cbc:TaxAmount currencyID=“SAR”>0.15</cbc:TaxAmount>

cac:TaxCategory

cbc:IDS</cbc:ID>

cbc:Percent15.00</cbc:Percent>

cac:TaxScheme

cbc:IDVAT</cbc:ID>

</cac:TaxScheme>

</cac:TaxCategory>

</cac:TaxSubtotal>

</cac:TaxTotal>

cac:LegalMonetaryTotal

<cbc:LineExtensionAmount currencyID=“SAR”>1.0</cbc:LineExtensionAmount>

<cbc:TaxExclusiveAmount currencyID=“SAR”>1.0</cbc:TaxExclusiveAmount>

<cbc:TaxInclusiveAmount currencyID=“SAR”>1.15</cbc:TaxInclusiveAmount>

<cbc:AllowanceTotalAmount currencyID=“SAR”>0.0</cbc:AllowanceTotalAmount>

<cbc:PayableAmount currencyID=“SAR”>1.15</cbc:PayableAmount>

</cac:LegalMonetaryTotal>

cac:InvoiceLine

cbc:ID1</cbc:ID>

<cbc:InvoicedQuantity unitCode=“PCS”>1.0</cbc:InvoicedQuantity>

<cbc:LineExtensionAmount currencyID=“SAR”>1.0</cbc:LineExtensionAmount>

cac:TaxTotal

<cbc:TaxAmount currencyID=“SAR”>0.15</cbc:TaxAmount>

<cbc:RoundingAmount currencyID=“SAR”>1.15</cbc:RoundingAmount>

</cac:TaxTotal>

cac:Item

cbc:NamePS5 CONSOLE SLIM DIGITAL</cbc:Name>

cac:ClassifiedTaxCategory

cbc:IDS</cbc:ID>

cbc:Percent15.00</cbc:Percent>

cac:TaxScheme

cbc:IDVAT</cbc:ID>

</cac:TaxScheme>

</cac:ClassifiedTaxCategory>

</cac:Item>

cac:Price

<cbc:PriceAmount currencyID=“SAR”>1.000000</cbc:PriceAmount>

<cbc:BaseQuantity unitCode=“PCS”>1</cbc:BaseQuantity>

cac:AllowanceCharge

cbc:ChargeIndicatorfalse</cbc:ChargeIndicator>

cbc:AllowanceChargeReasondiscount</cbc:AllowanceChargeReason>

<cbc:Amount currencyID=“SAR”>0.0</cbc:Amount>

<cbc:BaseAmount currencyID=“SAR”>0.0</cbc:BaseAmount>

</cac:AllowanceCharge>

</cac:Price>

</cac:InvoiceLine>