Help with XML Signature & QR Hash Errors in Sandbox

I hope you’re well. I’m developing a MERN-based e-invoicing application and have followed the UBL 2.1 + XAdES-EPES guidelines from your documentation. My generated XML matches your simplified sample, but when I test it at the sandbox endpoint, I receive the following errors:

  1. Errors from TestXML endpoint

image.png

  1. Simulation API (“/invoices/report”) response :
    {
    “error”: “ZATCA 400 {"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":"invalid-invoice-hash",” +
    “"category":"INVOICE_HASHING_ERRORS",” +
    “"message":"The invoice hash API body does not match the (calculated) Hash of the XML",” +
    “"status":"ERROR"},{” +
    “"type":"ERROR",” +
    “"code":"certificate-hashing",” +
    “"category":"CERTIFICATE_ERRORS",” +
    “"message":"Invalid certificate hashing",” +
    “"status":"ERROR"},{” +
    “"type":"ERROR",” +
    “"code":"signed-properties-hashing",” +
    “"category":"CERTIFICATE_ERRORS",” +
    “"message":"Invalid signed properties hashing, SignedProperties with id=‘xadesSignedProperties’",” +
    “"status":"ERROR"}],” +
    “"status":"ERROR"},” +
    “"reportingStatus":"NOT_REPORTED"}”
    }

Could you please help identify the root cause of these signature and hashing mismatches and advise on how to correct them? Any reference code or detailed steps—particularly around XML canonicalization, digest calculations, certificate fields, and QR hash generation in Node.js—would be extremely helpful.

Thank you for your support.

Dear @OsamaOdeh

Thanks for reaching out,

Please find the attached “SigningProcessUpdated.pdf” showing the exact steps you need to follow to successfully doing the signing process manually, that will provide all the needed to implement your own solution.

SigningProcessUpdated.pdf (927.7 KB)

Thanks,
Ibrahem Daoud.