We have an issue in simulation but working in developer-portal

We are trying to integrate Zatca with our Logistic application for e-invoicing. Now we are completed our development process. and we checked that in developer portel. it is working. But it is not working in simulation. how to get a support to overcome this issue?

Our error messages are shown below,

  1. The invoice hash API body does not match the (calculated) Hash of the XML
  2. Invalid signed properties hashing, SignedProperties with id=‘xadesSignedProperties’

Detailed error response is,

“errorMessages”:
[
{
“code”: “invalid-invoice-hash”,
“type”: “ERROR”,
“status”: “ERROR”,
“message”: “The invoice hash API body does not match the (calculated) Hash of the XML”,
“category”: “INVOICE_HASHING_ERRORS”
},
{
“code”: “signed-properties-hashing”,
“type”: “ERROR”,
“status”: “ERROR”,
“message”: “Invalid signed properties hashing, SignedProperties with id=‘xadesSignedProperties’”,
“category”: “CERTIFICATE_ERRORS”
}
],

The generated XML file is

<?xml version="1.0" encoding="UTF-8"?>
<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">
    <ext:UBLExtensions>
        <ext:UBLExtension>
            <ext:ExtensionURI>urn:oasis:names:specification:ubl:dsig:enveloped:xades</ext:ExtensionURI>
            <ext:ExtensionContent>
                <sig:UBLDocumentSignatures xmlns:sac="urn:oasis:names:specification:ubl:schema:xsd:SignatureAggregateComponents-2" xmlns:sbc="urn:oasis:names:specification:ubl:schema:xsd:SignatureBasicComponents-2" xmlns:sig="urn:oasis:names:specification:ubl:schema:xsd:CommonSignatureComponents-2">
                    <sac:SignatureInformation>
                        <cbc:ID>urn:oasis:names:specification:ubl:signature:1</cbc:ID>
                        <sbc:ReferencedSignatureID>urn:oasis:names:specification:ubl:signature:Invoice</sbc:ReferencedSignatureID>
                        <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="signature">
                            <ds:SignedInfo>
                                <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2006/12/xml-c14n11"/>
                                <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256"/>
                                <ds:Reference Id="invoiceSignedData" URI="">
                                    <ds:Transforms>
                                        <ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
                                            <ds:XPath>not(//ancestor-or-self::ext:UBLExtensions)</ds:XPath>
                                        </ds:Transform>
                                        <ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
                                            <ds:XPath>not(//ancestor-or-self::cac:Signature)</ds:XPath>
                                        </ds:Transform>
                                        <ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
                                            <ds:XPath>not(//ancestor-or-self::cac:AdditionalDocumentReference[cbc:ID='QR'])</ds:XPath>
                                        </ds:Transform>
                                        <ds:Transform Algorithm="http://www.w3.org/2006/12/xml-c14n11"/>
                                    </ds:Transforms>
                                    <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                                    <ds:DigestValue>PmHhFlGFyY86tUX98dZkhSmZcUWfG8e0aZMyKDblMWg=</ds:DigestValue>
                                </ds:Reference>
                                <ds:Reference Type="http://www.w3.org/2000/09/xmldsig#SignatureProperties" URI="#xadesSignedProperties">
                                    <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                                    <ds:DigestValue>ZjI3NGFmMTUxYTE1Y2M2NDBlMzMxZmY2MDkyNjZkZmVlNWZiYWI2OTJiZmU0MzAxNzQwNjEyOTNmM2E4YzIzNQ==</ds:DigestValue>
                                </ds:Reference>
                            </ds:SignedInfo>
                            <ds:SignatureValue>MEYCIQDnWghZ9uEzejRifd2cO7nzZKeVY9ysA7cyk6y307z2cwIhAKaYqfrLx/GT143eAwXQXOQrkfJ0vDk+qsf1vDmJ4/jy</ds:SignatureValue>
                            <ds:KeyInfo>
                                <ds:X509Data>
                                    <ds:X509Certificate>MIICSDCCAe2gAwIBAgIGAY4NOn8MMAoGCCqGSM49BAMCMBUxEzARBgNVBAMMCmVJbnZvaWNpbmcwHhcNMjQwMzA1MDYwODM2WhcNMjkwMzA0MjEwMDAwWjBjMRcwFQYDVQQDDA5FR1MxLTg4NjQzMTE0NTETMBEGA1UECwwKMTIzNDU2Nzg5MDEmMCQGA1UECgwdR2xhdWJldGVjaCBJbnZlbnRpb25zIFB2dCBMdGQxCzAJBgNVBAYTAlNBMFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAE8IiqKGrY+Lvnnf8seaF9XXtgIBmNWs5MwVXDWUlHcESz0PEX2mQbDP2tnw0N4sxCyOSUyZNektBrXce0UHd1qqOB3TCB2jAMBgNVHRMBAf8EAjAAMIHJBgNVHREEgcEwgb6kgbswgbgxQTA/BgNVBAQMODEtQlJJREdFTENTfDItSU9TfDMtOWI3ZDJhZDctOGRjZC00YTE1LTlhYWItOWNkMTc5MGQ2M2MyMR8wHQYKCZImiZPyLGQBAQwPMzEwOTA2MzkwODAwMDAzMQ0wCwYDVQQMDAQwMTAwMTQwMgYDVQQaDCswMDAwIDJuZCBmbG9vciwgUGF5eW9saSBCdWlsZGluZywgS296aGlrb2RlMQ0wCwYDVQQPDARGb29kMAoGCCqGSM49BAMCA0kAMEYCIQDDrmvhN5rU/9Ogqk0qJfU2j8t10JxxyhND1eB22ziBdAIhALjCl1IEOcrj1FpmUOmPiMxRQNW/i1RvK9HBwYWKettN</ds:X509Certificate>
                                </ds:X509Data>
                            </ds:KeyInfo>
                            <ds:Object>
                                <xades:QualifyingProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" Target="signature">
                                    <xades:SignedProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" Id="xadesSignedProperties">
                                    <xades:SignedSignatureProperties>
                                        <xades:SigningTime>2024-03-05T06:08:41Z</xades:SigningTime>
                                        <xades:SigningCertificate>
                                            <xades:Cert>
                                                <xades:CertDigest>
                                                    <ds:DigestMethod xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                                                    <ds:DigestValue xmlns:ds="http://www.w3.org/2000/09/xmldsig#">OGU2ODcxYmFmNmM3OWFhZjhjMjgyZGI3YTk4MmIyOTQxNWMwOWRlOTViMzFmYzk3ZTc5NjAzNzg3ZDZmMWZhZQ==</ds:DigestValue>
                                                </xades:CertDigest>
                                                <xades:IssuerSerial>
                                                    <ds:X509IssuerName xmlns:ds="http://www.w3.org/2000/09/xmldsig#">CN=eInvoicing</ds:X509IssuerName>
                                                    <ds:X509SerialNumber xmlns:ds="http://www.w3.org/2000/09/xmldsig#">1709618921228</ds:X509SerialNumber>
                                                </xades:IssuerSerial>
                                            </xades:Cert>
                                        </xades:SigningCertificate>
                                    </xades:SignedSignatureProperties>
                                </xades:SignedProperties>
                                </xades:QualifyingProperties>
                            </ds:Object>
                        </ds:Signature>
                    </sac:SignatureInformation>
                </sig:UBLDocumentSignatures>
            </ext:ExtensionContent>
        </ext:UBLExtension>
    </ext:UBLExtensions>
    <cbc:ProfileID>reporting:1.0</cbc:ProfileID>
    <cbc:ID>EGS1-886431145-1</cbc:ID>
    <cbc:UUID>9b7d2ad7-8dcd-4a15-9aab-9cd1790d63c2</cbc:UUID>
    <cbc:IssueDate>2024-03-05</cbc:IssueDate>
    <cbc:IssueTime>06:08:41</cbc:IssueTime>
    <cbc:InvoiceTypeCode name="0211010">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>QR</cbc:ID>
        <cac:Attachment>
            <cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">AR1HbGF1YmV0ZWNoIEludmVudGlvbnMgUHZ0IEx0ZAIPMzEwOTA2MzkwODAwMDAzAxQyMDI0LTAzLTA1VDA2OjA4OjQxWgQGMjAwLjAwBQQwLjAwBixQbUhoRmxHRnlZODZ0VVg5OGRaa2hTbVpjVVdmRzhlMGFaTXlLRGJsTVdnPQdgTUVZQ0lRRG5XZ2haOXVFemVqUmlmZDJjTzduelpLZVZZOXlzQTdjeWs2eTMwN3oyY3dJaEFLYVlxZnJMeC9HVDE0M2VBd1hRWE9RcmtmSjB2RGsrcXNmMXZEbUo0L2p5CFgwVjAQBgcqhkjOPQIBBgUrgQQACgNCAATwiKooatj4u+ed/yx5oX1de2AgGY1azkzBVcNZSUdwRLPQ8RfaZBsM/a2fDQ3izELI5JTJk16S0Gtdx7RQd3WqCUgwRgIhAMOua+E3mtT/06CqTSol9TaPy3XQnHHKE0PV4HbbOIF0AiEAuMKXUgQ5yuPUWmZQ6Y+IzFFA1b+LVG8r0cHBhYp6200=</cbc:EmbeddedDocumentBinaryObject>
        </cac:Attachment>
    </cac:AdditionalDocumentReference>
    <cac:Signature>
      <cbc:ID>urn:oasis:names:specification:ubl:signature:Invoice</cbc:ID>
      <cbc:SignatureMethod>urn:oasis:names:specification:ubl:dsig:enveloped:xades</cbc:SignatureMethod>
    </cac:Signature>
    <cac:AccountingSupplierParty>
        <cac:Party>
            <cac:PartyIdentification>
                <cbc:ID schemeID="CRN">454634645645654</cbc:ID>
            </cac:PartyIdentification>
            <cac:PostalAddress>
                <cbc:StreetName>2nd floor, Payyoli Building</cbc:StreetName>
                <cbc:BuildingNumber>0000</cbc:BuildingNumber>
                <cbc:PlotIdentification>0000</cbc:PlotIdentification>
                <cbc:CitySubdivisionName>Kozhikode</cbc:CitySubdivisionName>
                <cbc:CityName>Kozhikode</cbc:CityName>
                <cbc:PostalZone>31952</cbc:PostalZone>
                <cac:Country>
                    <cbc:IdentificationCode>SA</cbc:IdentificationCode>
                </cac:Country>
            </cac:PostalAddress>
            <cac:PartyTaxScheme>
                <cbc:CompanyID>3#######0#00003</cbc:CompanyID>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:PartyTaxScheme>
            <cac:PartyLegalEntity>
                <cbc:RegistrationName>Glaubetech Inventions Pvt Ltd</cbc:RegistrationName>
            </cac:PartyLegalEntity>
        </cac:Party>
    </cac:AccountingSupplierParty>
    <cac:AccountingCustomerParty/>
    <cac:TaxTotal>
        <cbc:TaxAmount currencyID="SAR">0.00</cbc:TaxAmount>
        <cac:TaxSubtotal>
            <cbc:TaxableAmount currencyID="SAR">200.00</cbc:TaxableAmount>
            <cbc:TaxAmount currencyID="SAR">0.00</cbc:TaxAmount>
            <cac:TaxCategory>
                <cbc:ID schemeAgencyID="6" schemeID="UN/ECE 5305">O</cbc:ID>
                <cbc:Percent>0.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:TaxTotal>
        <cbc:TaxAmount currencyID="SAR">0.00</cbc:TaxAmount>
    </cac:TaxTotal>
    <cac:LegalMonetaryTotal>
        <cbc:LineExtensionAmount currencyID="SAR">200.00</cbc:LineExtensionAmount>
        <cbc:TaxExclusiveAmount currencyID="SAR">200.00</cbc:TaxExclusiveAmount>
        <cbc:TaxInclusiveAmount currencyID="SAR">200.00</cbc:TaxInclusiveAmount>
        <cbc:AllowanceTotalAmount currencyID="SAR">0</cbc:AllowanceTotalAmount>
        <cbc:PrepaidAmount currencyID="SAR">0</cbc:PrepaidAmount>
        <cbc:PayableAmount currencyID="SAR">200.00</cbc:PayableAmount>
    </cac:LegalMonetaryTotal>
    <cac:InvoiceLine>
        <cbc:ID>1004</cbc:ID>
        <cbc:InvoicedQuantity unitCode="PCE">1</cbc:InvoicedQuantity>
        <cbc:LineExtensionAmount currencyID="SAR">200.00</cbc:LineExtensionAmount>
        <cac:TaxTotal>
            <cbc:TaxAmount currencyID="SAR">0.00</cbc:TaxAmount>
            <cbc:RoundingAmount currencyID="SAR">200.00</cbc:RoundingAmount>
        </cac:TaxTotal>
        <cac:Item>
            <cbc:Name>12321313</cbc:Name>
            <cac:ClassifiedTaxCategory>
                <cbc:ID>O</cbc:ID>
                <cbc:Percent>0.00</cbc:Percent>
                <cac:TaxScheme>
                    <cbc:ID>VAT</cbc:ID>
                </cac:TaxScheme>
            </cac:ClassifiedTaxCategory>
        </cac:Item>
        <cac:Price>
            <cbc:PriceAmount currencyID="SAR">200</cbc:PriceAmount>
        </cac:Price>
    </cac:InvoiceLine>
</Invoice>

Please Help me to fix this issue

Please help to fix this issue

I fixed first error that is

The invoice hash API body does not match the (calculated) Hash of the XML

Please help to fix the second one

Invalid signed properties hashing, SignedProperties with id=‘xadesSignedProperties’

Can you share solution “The invoice hash API body does not match”

Did you find the solution for this? What language you’re using?

I fixed it in php laravel

can you share us your code ?