I am encountering an issue with clearing an invoice on the live environment. The error response I receive is as follows:
{
"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"
}
Details:
The hash is generated using the ZATCA SDK.
I execute the following command to sign the invoice: fatoora -sign -invoice <filepath>
From the signed invoice, I extract the hash and send the file in base64 format to the API.
I have attached the payload for reference: Payload File
Please let me know if you require additional details or clarification.
Thanks for reaching out.
Kindly note that you might receive this error when the invoice hash is not generated correctly you need to follow the generate hash process for standards also note that when you make any modification in the invoice you need to generate new hash also you don’t need to sign your invoice for standard invoices
you can generate the hash using this command: Fatoora -generateHash -invoice “invoice.xml”
You will have to take the hash value from the CLI and replace the first digest value in the invoice with the new generated Hash.
@Saud
For standard invoices, you don’t need to sign your invoice. Make sure your XML invoice is well formatted, and all element values in Utf8 Encoding.