hey there,
i write this code for building QR Code:
// build QR (using TVL) for 5 things below
// (Seller’s name "it is name of branch", VAT registration number of the seller "BranchVatID", Time stamp of the invoice (date and time) in accordance with ISO 8601 (example 2022 - 02 - 21T12: 13:57Z), Invoice total (with VAT), VAT total)
var tag1 = $"{(char)1}{(char)Encoding.UTF8.GetByteCount("test")}{"test"}";
var tag2 = $"{(char)2}{(char)Encoding.UTF8.GetByteCount("300000000000003")}{"300000000000003"}";
var tag3 = $"{(char)3}{(char)Encoding.UTF8.GetByteCount(new DateTime(2022, 8, 17, 17, 41, 08).ToString("yyyy-MM-ddTHH:mm:ss"))}{new DateTime(2022, 8, 17, 17, 41, 08).ToString("yyyy-MM-ddTHH:mm:ss")}";
var tag4 = $"{(char)4}{(char)Encoding.UTF8.GetByteCount("231.15")}{"231.15"}";
var tag5 = $"{(char)5}{(char)Encoding.UTF8.GetByteCount("30.15")}{"30.15"}";
var tag6 = $"{(char)6}{(char)Encoding.UTF8.GetByteCount(invoiceHash1)}{invoiceHash1}";
var tag7 = $"{(char)7}{(char)Encoding.UTF8.GetByteCount(digitalSignature)}{digitalSignature}";
// The hex string
string PublicKey1 = "BFz+SYnoXtzpHzlD436/oCTo/CzuBXJcItxmjV4qROWxnRUY0jy2qZIVp86kWF+irTEceJ1yc0QlOx61prXUZFA=";
var tag8 = $"{(char)8}{(char)Encoding.UTF8.GetByteCount(PublicKey1)}{PublicKey1}";
// The hex string
string hexSignature = "MEQCIFZ3j/8M0PYE4FVoalmWpMLCsy5GJe+Qe7jq9BOC1BE8AiBV4gp04LJkgBSFLjLThY0B7PAoU6OFiWPjvm+dEGG4hA==";
var tag9 = $"{(char)9}{(char)Encoding.UTF8.GetByteCount(hexSignature)}{hexSignature}";
var TLV1 = tag1 + tag2 + tag3 + tag4 + tag5 + tag6 + tag7 + tag8 + tag9;
// convert TLV object to string base 64
var fQR = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(TLV1));
the response from api is:
{
“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”,
“clearanceStatus”: null,
“qrSellertStatus”: null,
“qrBuyertStatus”: null
}