Hello Everyone,
I will list all my steps below, to check if i missed anything, Iam working now on Simulation environment:
1- Generate CSR using Company info, I successfully received : Private key, and Csr.
2- I send Csr to (https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance) with OTP, and successfully received: requestId, binarySecurityToken and secret.
3- Sign invoice XML with certificate (should be decoded value of binarySecurityToken) and private key, and its success and valid.
4- Send SignedXML to (https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/invoices/reporting/single), and i used for authorization
"Basic " + encoded with base64string(binarySecurityToken:Secret).
Please note that the response you received from step 2 is called CSID, and we use it to complete the compliance checks (this step is mandatory to be able to generate your PCSID) you need to send 3 or 6 types of invoices based on the csr.invoice.type filed in your config file for standard 1000 you need to send 3 types of invoices (Invoice, standard credit, and standard debit) to (https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance)
for simplified 0100 you need to send 3 types of invoices (Invoice, simplified credit, and simplified debit) to (https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance) after signed them using the CSID,
for standard and simplified 1100 you need to send 6 types of invoices (Invoice, standard credit, and standard debit// Invoice, simplified credit, and simplified debit) to (https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance)
you can find samples invoice in SDK following this path (zatca-einvoicing-sdk-238-R3.3.3\Data\Samples).
After completing all the compliance steps, now you need to generate your PCSID in simulation environment using this API (https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/production/csids) you can find it in fatoora simulation portal in API Documentation tap, in the body you will send the requestId from step 2, using in Authorization basic auth and binarySecurityToken as userName, the secret as the Password, The response will be your PCSID on simulation env.
Now you need to use the PCSID binarySecurityToken and decode it base64 and replace it in the cert.pem file to start signing your actual invoice using your PCSID.
Please follow the provided steps carefully, to avoid the unauthorized response,
If you face any challenges after these steps, Please do not hesitate to reach out with our support team via email to arrange a meeting and provide comprehensive support as usual.
Thanks Ibrahim for your detailed answer,
I have been finished all mentioned steps, but i have one question:
after i received PCSID, i decoded binarySecurityToken and use it as Certificate,
but i didn’t received private key for this certificate, how can i extract it from Certificate, to be able to sign xml ?
as you know, sign XML require 3 values : xmldocument, certificate and privatekey
Please ensure to replace not only the cert.pem file, also you need to replace the
(ec-secp256k1-priv-key.pem), with the private key that generated with the CSR.
You mean private key i have from Step 1?
but i think that this private key is related to CSID certificate, not PCSID generated afterwards?
I hope that i able to clarify my question
Hi,
When you are reporting basically you are sending QR code in your xml so exactly how you want to retrieve and from where. In reporting you will not get any response from ZATCA excel acknowledgement while signed xml already with you. thanks