Invoice Clearance Error – Invalid Invoice Hash

Subject: Invoice Clearance Error – Invalid Invoice Hash

Dears,

Hope this finds you well.

I’m getting the following error when trying to clear an invoice:

{“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”}

How we are retrieving the hash:
We fetch the latest successful invoice hash from our database.
If no previous hash exists, we fall back to a default value (base64_encode(hash(‘sha256’, ‘0’, true))).

Could you please check why the calculated hash is not matching the XML being sent and advise how we can resolve this issue?

Best regards,