QR code issue for simlified B2C invoice

Hi

I have successfully generated and posted the XML for a B2B invoice without any issues. However, when attempting to validate XML format for a B2C invoice on zatca xml validator, I am encountering errors related to the QR code and digital signature validation.

Could you please provide guidance on the appropriate approach to validate the XML for a B2C invoice? I would appreciate recommendations you can offer to resolve these validation errors.

Dear @Haseeb_35,

Can you please share with us the error that appear to you

Thanks

Hi @halrashidy

Thank you for your assistance thus far. I am currently encountering an issue when validating the XML on the ZATCA XML validator. The validator responds with errors, particularly regarding the QR code.

I am somewhat confused about the process of encoding the QR code, particularly in steps 6 and 7, where the hash is already in Base64 format. Should I convert this Base64 string directly to hexadecimal, or should I first convert the original string to hexadecimal?

For instance, if my hash is "pWOjDxZDtaw1zJ0PovA8afdcFxJbhuhKhUMTC3IxZ/w=", what would be the correct hexadecimal representation of this hash?

Additionally, I would appreciate some clarification on the “ECDSA signature” mentioned in step 7. Could you please explain where I can obtain this signature and how it should be used in the validation process?

Thank you for your guidance.

Atually B2B is easy because ZATCA is creating sign & Qr (depending on your valid XML)

for B2C you suppose to do Everything and zatca is depending on you for that.

make search for articles… you will find many helpful answers

Hi @Embro

Thank you for your previous assistance, which has helped clarify many of my doubts regarding QR codes. However, I am still in need of guidance on obtaining the ECDSA (Elliptic Curve Digital Signature Algorithm) signature. I currently have the hash, public key, and private key, but I am unsure how to proceed in generating the ECDSA signature.

I would greatly appreciate any further assistance you could provide on this matter.

Thank you once again for your support.

Which SDK are you using?
did you try to sign the invoice using FatooraNet?
I was having similar issue when using SDK 3.3.3, Now i am signing and validating invoices using FatooraNet and they are getting cleared and reported without any issue.

you can use the.provided sdk of signing the xml .you will generate the xml normally then you will use the sdk to sign the invoice then send the signed invoice to zatca . the sdk will sign the invoice and generate a valid qr code

As i want to post B2C invoice i think the requirment is to generate qrcode by my self then zatca can validate the xml.
Now the issue is whenever i validate the xml it always return the error as
image

is there any valid method ? to resolve the issue

If you need detailed information about Elliptic Curve go to

ECDSA and Custom XML Signatures in .NET

My self (not using sdk) I am signing manually step by step
signing an invoice using this command openssl

hash in file XmlInitial_Sha256.txt
output in file sign_sha256_base64.txt
openssl dgst -sign privatekey.pem XmlInitial_Sha256.txt | openssl base64 -e -A > sign_sha256_base64.txt

Zatca has an offline sdk both in java and .net .This sdk contains much of the steps related to signing and generating the qr code . the problem you are facing is because the signature is not included in the qr cide it self . and it is quiet not easy task to do. but you can simply use the offline sdk before sending the xml document to zatca. by using the offline sdk you will be able to sign and generate a valid qr code. after that you send the documentt to zatca and it will not show the error

Hi @Ather @abdelrahman
Thank you for your thoughtful response. I have reviewed all of the answers provided, but I would like to inquire specifically about the ECDSA signature. Could you please guide me on how to generate this signature and validate it? Additionally, I would appreciate your advice on where exactly this signature should be used within an XML document, as I have not been able to find a clear explanation on this matter.However i have generated it online and make a QR code it works fine but when I procced it with xml and validate that xml from zatca website i gives an error as
" * category : SIGNATURE_ERROR

  • **code :**signatureValue
  • message : wrong signature Value"

@halrashidy Is there an issue with printing the QR code for Phase One on simplified invoices? Sometimes, I need to review the invoice before sending it, and there is no internet in the branches, so I want to send it from the head office. However, I want to print a barcode on the invoice. Can I initially print the QR code for Phase One until the invoice is sent to the authority?

Are there any fines or penalties for doing so?