# Wrong invoice hashing / QR Error During Simplified Invoice Validation

**URL:** <https://zatca1.discourse.group/t/wrong-invoice-hashing-qr-error-during-simplified-invoice-validation/7706>\
**Category:** Signing process\
**Created:** [July 15, 2025, 10:21am UTC](https://zatca1.discourse.group/t/wrong-invoice-hashing-qr-error-during-simplified-invoice-validation/7706 "2025-07-15T10:21:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chkjamil](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@chkjamil](https://zatca1.discourse.group/u/chkjamil)\
**Post date:** [July 15, 2025, 10:21am UTC](https://zatca1.discourse.group/t/wrong-invoice-hashing-qr-error-during-simplified-invoice-validation/7706/1 "2025-07-15T10:21:33Z")

</div>

Hi,

I’m encountering failure response when validating a **simplified** invoice via the ZATCA .NET SDK. Below is the console output:

```auto
Validate XSD [Success]
Validate EN Schematrons [Success]
Validate KSA Schematrons [Success]

Validate QR Code [Failed]
  **** [Error] CODE: hashedXml
       MESSAGE: hashedXml does not match QR‑code hashedXml or hashedXml is missing

Validate EInvoice Signature [Failed]
  **** [Error] CODE: invoiceSignedDataDigestValue – wrong invoice hashing.
  **** [Error] CODE: signatureValue – wrong signature value.

Validate EInvoice PIH [Success]
Overall status [Failed]

```

### What I’ve Done so Far

1. **CSR → Certificate**

2. **Signing the Invoice**  
Command used:

3. **Validation**

4. **Developer Portal API Check**  
The same (signed) invoice fails when I use “GenerateRequest” command with:

Is there an additional step required to embed or re‑calculate the invoice hash and QR code after signing? BTW, as per my understanding “SignDocument” will generate invoice hash, QR code and signature.

Any guidance or examples would be greatly appreciated.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![Aturkistani](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Aturkistani](https://zatca1.discourse.group/u/Aturkistani)\
**Post date:** [July 15, 2025, 4:47pm UTC](https://zatca1.discourse.group/t/wrong-invoice-hashing-qr-error-during-simplified-invoice-validation/7706/2 "2025-07-15T16:47:33Z")

</div>

Dear @chkjamil,

Where have you posted the CSR? In Sandbox environment (developer portal)? because if you are posting it to simulation or production they will be unusable for the devloper portal environment (Sandbox).

Regarding the SDK validation error, it’s probably a mistake in placing the certificate file, try to run the command without -certificate -privatekey as the SDK will automatically trigger the default place holder for both of the certificate and privatekey, you are basically signing based on the obtained certificate but in terms of validation, it’s being done on the default certificate where it’s placed in the following path:

> ZATCA’s SDK folder/Data/Certificates/Cert.pem

Try to replace the value with your obtained certificate, same is applied for the private key as well.

Regards,

---

<div class="post-metadata">

**Author:** ![chkjamil](https://avatars.discourse-cdn.com/v4/letter/c/f475e1/32.png) [@chkjamil](https://zatca1.discourse.group/u/chkjamil)\
**Post date:** [July 16, 2025, 4:20pm UTC](https://zatca1.discourse.group/t/wrong-invoice-hashing-qr-error-during-simplified-invoice-validation/7706/3 "2025-07-16T16:20:25Z")

</div>

Thanks, the issue is resolved. Actually, I was missing following line at the top of the xml file

```auto
<?xml version="1.0" encoding="UTF-8"?>

```

---

<div class="post-metadata">

**Author:** ![Aturkistani](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Aturkistani](https://zatca1.discourse.group/u/Aturkistani)\
**Post date:** [July 24, 2025, 10:29am UTC](https://zatca1.discourse.group/t/wrong-invoice-hashing-qr-error-during-simplified-invoice-validation/7706/4 "2025-07-24T10:29:56Z")

</div>

It’s great to hear that! thanks for sharing.

Regards,
