# Issue with Invoice Clearance: Invalid Invoice Hash Error

**URL:** <https://zatca1.discourse.group/t/issue-with-invoice-clearance-invalid-invoice-hash-error/4864>\
**Category:** Clearance and Reporting\
**Created:** [December 31, 2024, 5:33am UTC](https://zatca1.discourse.group/t/issue-with-invoice-clearance-invalid-invoice-hash-error/4864 "2024-12-31T05:33:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saud](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@Saud](https://zatca1.discourse.group/u/Saud)\
**Post date:** [December 31, 2024, 5:33am UTC](https://zatca1.discourse.group/t/issue-with-invoice-clearance-invalid-invoice-hash-error/4864/1 "2024-12-31T05:33:17Z")

</div>

I am encountering an issue with clearing an invoice on the live environment. The error response I receive is as follows:

```auto
{
  "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](https://we.tl/t-F2J9cbAbbR)

Please let me know if you require additional details or clarification.

---

<div class="post-metadata">

**Author:** ![halrashidy](https://avatars.discourse-cdn.com/v4/letter/h/3bc359/32.png) [@halrashidy](https://zatca1.discourse.group/u/halrashidy)\
**Post date:** [December 31, 2024, 8:26am UTC](https://zatca1.discourse.group/t/issue-with-invoice-clearance-invalid-invoice-hash-error/4864/2 "2024-12-31T08:26:26Z")

</div>

Dear @Saud ,

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.

Thanks,

---

<div class="post-metadata">

**Author:** ![eCloud](https://dub1.discourse-cdn.com/flex013/user_avatar/zatca1.discourse.group/ecloud/32/629_2.png) [@eCloud](https://zatca1.discourse.group/u/eCloud)\
**Post date:** [December 31, 2024, 9:04am UTC](https://zatca1.discourse.group/t/issue-with-invoice-clearance-invalid-invoice-hash-error/4864/3 "2024-12-31T09:04:30Z")

</div>

@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.

From your Payload

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/zatca1/original/1X/c01be28a11c277f326d0353c5af3538af6c007e9.png)

You can create a payload directly with the  
`fatoora -invoiceRequest -invoice New.xml`

This command will generate file `generated-json-request-nnnnnnnnnn.json` in your current directory
