# Validation issue from .net C# API

**URL:** <https://zatca1.discourse.group/t/validation-issue-from-net-c-api/2475>\
**Category:** SDK, web-based validator and sandbox\
**Created:** [August 18, 2024, 1:37pm UTC](https://zatca1.discourse.group/t/validation-issue-from-net-c-api/2475 "2024-08-18T13:37:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhattiasadlatif](https://avatars.discourse-cdn.com/v4/letter/b/e9bcb4/32.png) [@bhattiasadlatif](https://zatca1.discourse.group/u/bhattiasadlatif)\
**Post date:** [August 18, 2024, 1:37pm UTC](https://zatca1.discourse.group/t/validation-issue-from-net-c-api/2475/1 "2024-08-18T13:37:53Z")

</div>

Dear All,

Please can you help me on below issue.

I am signing B2C invoice thru C# API and using SDK Public API commands and signing result is valid as follow:-

| Zatca.EInvoice.SDK.Contracts.Models.StepResult | Validate Sign Inputs | True |
| --- | --- | --- |
| Zatca.EInvoice.SDK.Contracts.Models.StepResult | Generate EInvoice Hash | True |
| Zatca.EInvoice.SDK.Contracts.Models.StepResult | Generate Signature | True |
| Zatca.EInvoice.SDK.Contracts.Models.StepResult | Parse Certificate | True |
| Zatca.EInvoice.SDK.Contracts.Models.StepResult | Hash Certificate | True |
| Zatca.EInvoice.SDK.Contracts.Models.StepResult | Transform Xml Result | True |

but when I am validating the same after siging getting following two errors.

| Zatca.EInvoice.SDK.Contracts.Models.ValidationStepResult | Initialization Step (Simplified EInvoice) | True |
| --- | --- | --- |
| Zatca.EInvoice.SDK.Contracts.Models.ValidationStepResult | Validate XSD | True |
| Zatca.EInvoice.SDK.Contracts.Models.ValidationStepResult | Validate EN Schematrons | True |
| Zatca.EInvoice.SDK.Contracts.Models.ValidationStepResult | Validate KSA Schematrons | True |
| Zatca.EInvoice.SDK.Contracts.Models.ValidationStepResult | Generate EInvoice Hash | True |
| Zatca.EInvoice.SDK.Contracts.Models.ValidationStepResult | Parse Certificate | True |
| Zatca.EInvoice.SDK.Contracts.Models.ValidationStepResult | Generate EInvoice QR | True |
| Zatca.EInvoice.SDK.Contracts.Models.ValidationStepResult | Validate QR Code | False |
| Zatca.EInvoice.SDK.Contracts.Models.ValidationStepResult | Validate EInvoice Signature | False |
| Zatca.EInvoice.SDK.Contracts.Models.ValidationStepResult | Validate EInvoice PIH | True |

But if I am sign the invoice from following CLI command no error found

Fatooranet sign – invoice filepath

Fatooranet validate – invoice filepath

Thanks & Best Regards,

Asad Latif

---

<div class="post-metadata">

**Author:** ![idaoud](https://avatars.discourse-cdn.com/v4/letter/i/f9ae1b/32.png) [@idaoud](https://zatca1.discourse.group/u/idaoud)\
**Post date:** [August 18, 2024, 1:57pm UTC](https://zatca1.discourse.group/t/validation-issue-from-net-c-api/2475/2 "2024-08-18T13:57:17Z")

</div>

Dear @bhattiasadlatif

Thanks for reaching out,

Please ensure that you are using the private key that generated with the CSR,

Also, kindly check the signing process manually and update your code to understand exactly what the right behavior of the signing method.

[SigningProcessUpdated.pdf](https://zatca1.discourse.group/uploads/short-url/vlHNRGtXbkw5sv40gchVevwarmQ.pdf) (927.7 KB)

For any further concerns, please do not hesitate to reach out to our support team via email: [sp\_support@zatca.gov.sa](mailto:sp_support@zatca.gov.sa)

Thanks.  
Ibrahem Daoud.

---

<div class="post-metadata">

**Author:** ![bhattiasadlatif](https://avatars.discourse-cdn.com/v4/letter/b/e9bcb4/32.png) [@bhattiasadlatif](https://zatca1.discourse.group/u/bhattiasadlatif)\
**Post date:** [August 18, 2024, 3:21pm UTC](https://zatca1.discourse.group/t/validation-issue-from-net-c-api/2475/3 "2024-08-18T15:21:20Z")

</div>

Dear @idaoud,

thanks for your quick response, I am sure that using the same Private key generated thru CSR, but I have a question, do I need to use in API with Private Key with header and footer or only text without header and footer.

Thanks & Best Regards,

Asad Latif

---

<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:** [August 18, 2024, 4:49pm UTC](https://zatca1.discourse.group/t/validation-issue-from-net-c-api/2475/4 "2024-08-18T16:49:20Z")

</div>

Dear @bhattiasadlatif

Possible error, you are not using VAT Number 399999999900003 in your csr.config.Properties.

PCSID BinarySecurityToken from Public Api / Sandbox uses 399999999900003 as VAT Number even though our csr config uses different Vat Number.

---

<div class="post-metadata">

**Author:** ![khaledmaqtari](https://avatars.discourse-cdn.com/v4/letter/k/d6d6ee/32.png) [@khaledmaqtari](https://zatca1.discourse.group/u/khaledmaqtari)\
**Post date:** [August 18, 2024, 11:05pm UTC](https://zatca1.discourse.group/t/validation-issue-from-net-c-api/2475/5 "2024-08-18T23:05:59Z")

</div>

Dear All,

I have the same problem in the SDK validation code, but in the following steps:  
1- alidate EN Schematrons.  
2- alidate KSA Schematrons.  
3- Validate EInvoice Signature.

Any idea?
