Invalid Invoice Hash error in Invoice Clearance

Subject: Invalid Invoice Hash error in Invoice Clearance

Dear Sir,

While attempting to clear an invoice I’m getting below error:

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

Our hash retrieving process:

  1. Finding most recent successful invoice hash from our database.
    If there is no previous hash, we use a default value (base64_encode(hash(‘sha256’, ‘0’, true))).

Can you please check why the calculated hash is not agreeing with what is being sent in XML?

Please check & help us with this issue

Thank you

Dear @Hafsa

Thanks for reaching out, Welcome to our community.

To provide comprehensive support as usual, can I kindly ask you to elaborate with the below:

  1. From my understanding of your query, are you using the hash for your invoice (New One) as the same hash for the last invoice that submitted successfully?
  2. Can you confirm your full understanding of the PIH?
  3. Did you successfully Integrated with ZATCA?
  4. Are you facing this on Simulation Or Production Env?
  5. are you using ZATCA SDK? If so what is the SDK version. Or you implement your own solution?

Thanks,
Ibrahem Daoud.