We are encountering an issue during the compliance check for simplified tax invoices in ZATCA. Below is the response we received:
{‘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’: , ‘errorMessages’: [{‘type’: ‘ERROR’, ‘code’: ‘QRCODE_INVALID’, ‘category’: ‘QRCODE_VALIDATION’, ‘message’: ‘Invalid QR code format, Please follow the ZATCA QR code specifications’, ‘status’: ‘ERROR’}], ‘status’: ‘ERROR’}, ‘reportingStatus’: ‘NOT_REPORTED’}
Status_code = 400
The error occurs specifically with the message: “QRCODE_INVALID – Invalid QR code format, Please follow the ZATCA QR code specifications.”
This issue appeared when performing the compliance check for simplified documents.
After internal testing, we noticed that the error happens only when the seller name is provided in Arabic.
Has anyone faced a similar issue?
Could this be related to encoding, TLV construction, or QR code generation rules for Arabic characters?
Any guidance or suggestions on how to resolve this would be greatly appreciated.
I have checked our implementation and there is no special handling for arabic/english names for QR code. Make sure that you are using the same value inside supplier.name otherwise it will not match…
I investigated the issue further and was able to identify the root cause. The problem was not with the supplier name value itself, but with how the TLV length was being calculated during QR code generation.
Originally, the code used len(string) to determine the length of each field. This works fine for English characters, but for Arabic text the UTF-8 byte length is larger than the character count. As a result, the TLV “Length” value became incorrect and ZATCA’s compliance checker returned QRCODE_INVALID.
I updated the implementation to calculate the length using:
len(value.encode("utf-8"))
which ensures the length reflects the actual UTF-8 byte size. After this adjustment, the QR code passed the compliance check successfully for both Arabic and English names.
We also had different items with generating TLV and therefore we decided to not “re-implement” the wheel and just use the ready solution. We are using uttlv library for this and since then we do not have any issues. There are few different libraries, we choose this one after some internal evaluatoin.