# \[ERROR\] Invalid QR code format, Please follow the ZATCA QR code specifications

**URL:** <https://zatca1.discourse.group/t/error-invalid-qr-code-format-please-follow-the-zatca-qr-code-specifications/6356>\
**Category:** QR code\
**Created:** [March 25, 2025, 8:33am UTC](https://zatca1.discourse.group/t/error-invalid-qr-code-format-please-follow-the-zatca-qr-code-specifications/6356 "2025-03-25T08:33:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahmedShaker](https://avatars.discourse-cdn.com/v4/letter/a/c67d28/32.png) [@ahmedShaker](https://zatca1.discourse.group/u/ahmedShaker)\
**Post date:** [March 25, 2025, 8:33am UTC](https://zatca1.discourse.group/t/error-invalid-qr-code-format-please-follow-the-zatca-qr-code-specifications/6356/1 "2025-03-25T08:33:11Z")

</div>

I get this error in _ **Compliance invoice API** _:

```auto
[ERROR] Invalid QR code format, Please follow the ZATCA QR code specifications

```

**Before signing the invoice is this:**

```auto
<?xml version="1.0"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2">
    <cbc:elementToRemoved></cbc:elementToRemoved>
    <cbc:ProfileID>reporting:1.0</cbc:ProfileID>
    <cbc:ID>1-257</cbc:ID>
    <cbc:UUID>50cc36a7-732b-492a-a482-8d39216932f6</cbc:UUID>
    <cbc:IssueDate>2025-03-24</cbc:IssueDate>
    <cbc:IssueTime>21:38:50</cbc:IssueTime>
    <cbc:InvoiceTypeCode name="0200000">388</cbc:InvoiceTypeCode>
    <cbc:DocumentCurrencyCode>SAR</cbc:DocumentCurrencyCode>
    <cbc:TaxCurrencyCode>SAR</cbc:TaxCurrencyCode>
    <cac:AdditionalDocumentReference>
        <cbc:ID>ICV</cbc:ID>
        <cbc:UUID>1</cbc:UUID>
    </cac:AdditionalDocumentReference>
    <cac:AdditionalDocumentReference>
        <cbc:ID>PIH</cbc:ID>
        <cac:Attachment>
            <cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">X+zrZv/IbzjZUnhsbWlsecLbwjndTpG0ZynXOif7V+k=</cbc:EmbeddedDocumentBinaryObject>
        </cac:Attachment>
    </cac:AdditionalDocumentReference>
    <cbc:elementToRemoved></cbc:elementToRemoved>
    <cbc:elementToRemoved></cbc:elementToRemoved>
    <cac:AccountingSupplierParty>
        <cac:Party>
            <cac:PartyIdentification>
                <cbc:ID schemeID="CRN">1010216483</cbc:ID>
            </cac:PartyIdentification>
            <cac:PostalAddress>
                <cbc:StreetName>صلبوخ حي الوادي</cbc:StreetName>
                <cbc:BuildingNumber>1520</cbc:BuildingNumber>
                <cbc:PlotIdentification>6980</cbc:PlotIdentification>
                <cbc:CitySubdivisionName>Riyadh</cbc:CitySubdivisionName>
                <cbc:CityName>Riyadh</cbc:CityName>
                <cbc:PostalZone>11461</cbc:PostalZone>
                <cac:Country>
                    <cbc:IdentificationCode>SA</cbc:IdentificationCode>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cbc:CompanyID>300207668900003</cbc:CompanyID>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>مؤسسة فهد عبدالله الهويشان للتجارة</cbc:RegistrationName>
            </cac:PartyLegalEntity>
        </cac:Party>
    </cac:AccountingSupplierParty>
    <cac:AccountingCustomerParty>
        <cac:Party>
            <cac:PartyIdentification>
                <cbc:ID schemeID="NAT"></cbc:ID>
            </cac:PartyIdentification>
            <cac:PostalAddress>
                <cbc:StreetName></cbc:StreetName>
                <cbc:BuildingNumber></cbc:BuildingNumber>
                <cbc:PlotIdentification></cbc:PlotIdentification>
                <cbc:CitySubdivisionName></cbc:CitySubdivisionName>
                <cbc:CityName></cbc:CityName>
                <cbc:PostalZone></cbc:PostalZone>
                <cac:Country>
                    <cbc:IdentificationCode>SA</cbc:IdentificationCode>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>الشركة السعودية للتحكم التقني والأمني الشامل المحدوده - TAHAKOM</cbc:RegistrationName>
            </cac:PartyLegalEntity>
        </cac:Party>
    </cac:AccountingCustomerParty>
    <cac:Delivery>
        <cbc:ActualDeliveryDate>2025-03-24</cbc:ActualDeliveryDate>
    </cac:Delivery>
    <cac:PaymentMeans>
        <cbc:PaymentMeansCode>10</cbc:PaymentMeansCode>
    </cac:PaymentMeans>
    <cac:AllowanceCharge>
        <cbc:ID>1</cbc:ID>
        <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
        <cbc:AllowanceChargeReason>discount</cbc:AllowanceChargeReason>
        <cbc:Amount currencyID="SAR">0.00</cbc:Amount>
        <cac:TaxCategory>
            <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5305">S</cbc:ID>
            <cbc:Percent>15</cbc:Percent>
            <cac:TaxScheme>
                <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID>
            </cac:TaxScheme>
        </cac:TaxCategory>
    </cac:AllowanceCharge>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="SAR">14.40</cbc:TaxAmount>
    </cac:TaxTotal>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="SAR">14.40</cbc:TaxAmount>
        <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="SAR">96.00</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="SAR">14.40</cbc:TaxAmount>
            <cac:TaxCategory>
                <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5305">S</cbc:ID>
                <cbc:Percent>15.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5153">VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:TaxCategory>
        </cac:TaxSubtotal>
    </cac:TaxTotal>
    <cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="SAR">96.00</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="SAR">96.00</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="SAR">110.40</cbc:TaxInclusiveAmount>
        <cbc:AllowanceTotalAmount currencyID="SAR">0.00</cbc:AllowanceTotalAmount>
        <cbc:PrepaidAmount currencyID="SAR">0.00</cbc:PrepaidAmount>
        <cbc:PayableAmount currencyID="SAR">110.40</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>
    <cac:InvoiceLine>
        <cbc:ID>70282</cbc:ID>
        <cbc:InvoicedQuantity unitCode="PCE">3.00</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="SAR">24.00</cbc:LineExtensionAmount>
        <cac:TaxTotal>
            <cbc:TaxAmount currencyID="SAR">3.60</cbc:TaxAmount>
            <cbc:RoundingAmount currencyID="SAR">27.60</cbc:RoundingAmount>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Name>BALL POINT PENS; STD 1MM BLACK قلم اسود</cbc:Name>
            <cac:ClassifiedTaxCategory>
                <cbc:ID>S</cbc:ID>
                <cbc:Percent>15.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:ClassifiedTaxCategory>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="SAR">8.00</cbc:PriceAmount>
            <cac:AllowanceCharge>
                <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
                <cbc:AllowanceChargeReason> </cbc:AllowanceChargeReason>
                <cbc:Amount currencyID="SAR">0.00</cbc:Amount>
            </cac:AllowanceCharge>
        </cac:Price>
    </cac:InvoiceLine>
    <cac:InvoiceLine>
        <cbc:ID>70283</cbc:ID>
        <cbc:InvoicedQuantity unitCode="PCE">3.00</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="SAR">24.00</cbc:LineExtensionAmount>
        <cac:TaxTotal>
            <cbc:TaxAmount currencyID="SAR">3.60</cbc:TaxAmount>
            <cbc:RoundingAmount currencyID="SAR">27.60</cbc:RoundingAmount>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Name>BALL POINT PENS; STD 1MM BLUE قلم ازرق</cbc:Name>
            <cac:ClassifiedTaxCategory>
                <cbc:ID>S</cbc:ID>
                <cbc:Percent>15.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:ClassifiedTaxCategory>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="SAR">8.00</cbc:PriceAmount>
            <cac:AllowanceCharge>
                <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
                <cbc:AllowanceChargeReason> </cbc:AllowanceChargeReason>
                <cbc:Amount currencyID="SAR">0.00</cbc:Amount>
            </cac:AllowanceCharge>
        </cac:Price>
    </cac:InvoiceLine>
    <cac:InvoiceLine>
        <cbc:ID>70284</cbc:ID>
        <cbc:InvoicedQuantity unitCode="PCE">1.00</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="SAR">48.00</cbc:LineExtensionAmount>
        <cac:TaxTotal>
            <cbc:TaxAmount currencyID="SAR">7.20</cbc:TaxAmount>
            <cbc:RoundingAmount currencyID="SAR">55.20</cbc:RoundingAmount>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Name>BALL POINT PENS; STD 0.5 MM BLUE قلم ازرق 0.5 ملم</cbc:Name>
            <cac:ClassifiedTaxCategory>
                <cbc:ID>S</cbc:ID>
                <cbc:Percent>15.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:ClassifiedTaxCategory>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="SAR">48.00</cbc:PriceAmount>
            <cac:AllowanceCharge>
                <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
                <cbc:AllowanceChargeReason> </cbc:AllowanceChargeReason>
                <cbc:Amount currencyID="SAR">0.00</cbc:Amount>
            </cac:AllowanceCharge>
        </cac:Price>
    </cac:InvoiceLine>
</Invoice>

```

**base64 qrcode:**

```auto
AUDZhdik2LPYs9ipINmB2YfYryDYudio2K/Yp9mE2YTZhyDYp9mE2YfZiNmK2LTYp9mGINmE2YTYqtis2KfYsdipAg8zMDAyMDc2Njg5MDAwMDMDFDIwMjUtMDMtMjRUMjI6MTQ6MTRaBAYxMTAuNDAFBTE0LjQwBixsVW5BdGE3WEJZZTN3NUpsR2xEd2NWdmxOdXJDcURHNkV6Z1FlcXBKaXA4PQdgTUVZQ0lRQ3N0VFBnaHAwdm5XRVY4eU5xN3VJRkZndHMrK0ZJZE92eG9wOFFJWXBWY1FJaEFLaldtbVpaRXEySTRFNURNSE5lS2krV3pzdUM1dDh5anpzRUxjVlZ3am9iCHhNRll3RUFZSEtvWkl6ajBDQVFZRks0RUVBQW9EUWdBRUNXZTFTLzV4RUFoSUZITUFreHBFL0NRTTBpZFVtMXhaYks1Q0Jmc2pwSXJnTDVJZ3dnSW1WemU5ckYxb2sreU5CRkhGT3J2SG9HZThZbzRoRGt1M2NnPT0JkjAwMzA0NjAyMjEwMDg3M2ZhMGY0ZTRjMTY4OTEyNjFiYWM2MzE2NzRlNWJjOGZmNWU2NDg4YTZlMGU5M2Y4MWYwOWM3YWMzYWJjNDAwMjIxMDBiMTZmMmYxZjM4NzY4NDIzNjY0MTM4ZGQxMjYwZDU2NmEwNTJiYTE2MDQyOGJiMjM3NjRlNDJlNjAxZThlMWU3

```

 ![WhatsApp Image 2025-03-25 at 12.15.12 AM](https://europe1.discourse-cdn.com/flex013/uploads/zatca1/original/1X/924196a0d90e34d4ac36b3ebedd345b917da9f43.jpeg)

---

<div class="post-metadata">

**Author:** ![Aturkistani](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Aturkistani](https://zatca1.discourse.group/u/Aturkistani)\
**Post date:** [March 31, 2025, 10:51am UTC](https://zatca1.discourse.group/t/error-invalid-qr-code-format-please-follow-the-zatca-qr-code-specifications/6356/2 "2025-03-31T10:51:59Z")

</div>

dear @ahmedShaker,

You can’t depend on the third party QR code apps, you should rely only on the ZATCA official app.

However, the after investigating the provided QR code, it seems that the issue is related to the 9th tag, to get the 9th tag of the QR code correctly, please ensure following the below steps:

1- decode the CCSID or the PCSID based on the API that you would like to send the invoice through (CCSID for the compliance checks while PCSID for reporting API). using base64, only "the binary security token value

2- take the output from the previous step, and decode it using a x.509 certificate decoder.

3- go to the value of “Signature Value”, the value should be in HEX (bytes represntation).

4- remove any special character like “:” if exist.

5- place the value in the 9th tag.

Regards,
