Validation issue from .net C# API

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

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 (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

Thanks.
Ibrahem Daoud.

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

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.

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?