Validate EInvoice PIH [Failed] and B2B invoice calculate hash

aslam alekm
I use Fatoora sdk .net , all invoices are cleared and reported , but when i check the xml invoice by validate SDk CLI i always get the error Validate EInvoice PIH [Failed]

Blockquote

Validate XSD [Success]
Validate EN Schematrons [Success]
Validate KSA Schematrons [Success]
Validate QR Code [Success]
Validate EInvoice Signature [Success]
Validate EInvoice PIH [Failed]
Errors:
**** [Error] CODE: KSA-13, MESSAGE : PIH is inValid
Overall status [Failed]

Blockquote

and also please tell me if that the steps is right after clearance status i decode the return cleared invoice and do generateHash CLI for it and uses this result hash as PIH for the next invoice is that right , or not need to do that and uses the hash that generated and send as payload for request , please explain that for me
and what about this Error for PIH even i start with ZERO hash in a first B2C invoice and for example sign it and uses the generatedHash for this sign invoice as PIH in the next invoice i get this ERROR
thank you

Invoice Hash that you should in payload is the Current Invoice Hash
and this Hash Use to Generate the Next Invoice XML as PIH (pervious Invoice Hash )

1 Like

thank you brother , so i will use the hash that it payload with invoice even it is for invoice without sign
and also why i got this PIH error after the create XML invoice , although if i create the second xml and sign it for reporting just i validate it i get this error
thank you for replying brother

Hi @ahmad1 , please read the documentation,

CIH (current invoice hash) is used for current invoice and in PIH (previous invoice hash) you should enter a value from previous document (reported). If you do not have previous document (you did not report anything yet), then you have to use special value indicated in documentation representing "0" value.

I would recommend you to read the documentation and understand this logic, as it is making the chain of your documents reported by 1 device. “0” → inv1 → inv2 → inv3 → …

Best regards,
Sergei