Simulation csid and pcsid

Dear Sir,

Please anyone can explain the steps to get the PCSID on simulation portal.

  1. Generator CSR .net zatca SDK fatoora -csr -sim -csrconfig d:\csr.properties
  2. request for CSID. (with OTP from simulation portal)
  3. request for PCSID with request ID from CSID.

is any step is missing?

because getting error while creating PCSID.

thanking in advance for help .

Dear @bhattiasadlatif

Thank you for reaching out, and welcome to our community.

Can you please share the error message received to help better investigate?

Thanks,

Dear @Saalotaibi,

Bad Request Error, I am sending CSID request ID to “https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/production/csids” Authorization CSID “binarySecurityToken” + “secret”

Dear @bhattiasadlatif

Kindly review the API documentation provided by ZATCA to ensure you are following the correct procedure for sending the CSID request.

Developer Portal User Manual.pdf (5.6 MB)

Double-check the endpoint and headers, to ensure they are correct and match the API specifications, review the error details in the response body for more guidance on what might be causing the “Bad Request” error.

If you are still facing issues, please don’t hesitate to reach out with our support team via email:

SP email: sp_support@zatca.gov.sa

Thanks,

Dear @saalotaibi

thanks for your clear instructions to @charbelsarkis123, I was looking for same, but I have one question about below point, that we need to add space or any character between BinarySecurityToken and Secret or its will be continues BinarySecurityToken + Secret

  1. The response will include the BinarySecurityToken and Secret, you will use those as Authentication in the compliance checks. Moreover, the response will include request_ID which will be used in the body for generating PCSID API in a later step.

Thanks & Best Regards,

Asad Latif

Dear @bhattiasadlatif

Thanks for reaching out.

Please note that in the authorization, you will choose Basic Auth, the BinarySecurityToken will be the user name without any spaces, and the Secret will be the password without any spaces.

Thanks,
Ibrahem Daoud.

Dear @idaoud

thanks for your prompt reply, i am asking about authorization thru JSON
file

Authorization: Basic BinarySecurityToken + Secret (without any space or chracter) ?

Thanks,

Asad Latif

Dear @bhattiasadlatif

Sorry, can I kindly ask you to elaborate more to ensure a comprehensive support as usual?

Thanks.

Dear @idaoud,
Thanks for prompt reply, in Simulation Environment, when I need to send request thru API (.net) so, I will use the JSON file, in JSON file Header i will send as follow :-

Authorization: Basic BinarySecurityToken + Secret (without any space or chracter) ?

Thanks,

Asad Latif

Dear @bhattiasadlatif

Thanks for your elaborating,

Based on what you mentioned it seems that you have misunderstanding of what the value in the header should be right? If yes, please answer these questions
1- What is the endpoint that you want to use?
2-you mentioned Heder, and the value of it is the Authorization!

Please note that there are no APIs from ZATCA side that use the Authorization in the header.

However, please follow the steps below to ensure a successfully onboarding in simulation environment and generate your PCSID:

Our recommendation is:

  1. Access Fatoora portal and log in using your tin number.
  2. Use Simulation Enviromint before production, from simulation portal start using the APIs as their order.
  3. Generate the OTP from simulation portal.
  4. Use the CSR in the body of the request using the below endpoint to send the request for generating the CCSID (Use the OTP in the Headers of the request):
    For the simulation environment use this API URL: https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance
  5. The response will include the BinarySecurityToken and Secret, you will use those as Authentication in the compliance checks. Moreover, the response will include request_ID which will be used in the body for generating PCSID API in a later step.
  6. You need to start the compliance check, In order to complete the compliance check you need to prepare your invoices. Please note that this is based on the invoice type in your configuration file if it’s 0100 that’s mean you will only send a simplified invoice, if it’s 1000 only for standard invoices and if it is 1100 you will send both standard and simplified.
  7. For standard invoices:
    1.use fatooranet generatehash -invoice “invoicebath” command to generate the hash
    2.generate the JSON file for the invoice using fatooranet invoiceRequest -invoice “invoicebath” command
  8. For simplified invoices:
    1.make sure to change the SDK\Data\Certificates\cert.pem with the decoded CCSID
    2.sign the invoice using fatooranet sign -invoice “invoicebath” command
    3.generate the JSON file for the signed invoice using fatooranet invoiceRequest -invoice “invoicebath” command
  9. After you prepared your invoices, you need to send the encoded invoices (JSON file) to the the following API:
    For compliance checks in the Simulation Environment, use this API URL https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance/invoices
    10.In order to generate the PCSID, take the “Request ID” you got from the CCSID response (on step 5 above) and replace it in the body of the request.
    11.Make sure to send an invoice, credit note, and debit note to the compliance check, to avoid “Missing Compliance Steps”
  10. Now you need to generate the PCSID using the following API in the body use the request_ID and in authentications use the BinarySecurityToken as user name, secret as password:
    For Simulation Environment: https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/production/csids

If you have any concerns regarding the onboarding process after reviewing the Educational library (zatca.gov.sa), please don’t hesitate to reach out with our support team via email:

sp_support@zatca.gov.sa

Thanks,
Ibrahem Daoud.

Dear @idaoud,

Thanks,

Your question : what the value in the header should be right? Yes

curl -X ‘POST’
https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/production/csids
-H ‘accept: application/json’
-H ‘Accept-Version: V2’
-H ‘Authorization: Basic BinarySecurityToken + Secret (without any space or chracter) ?’
-H ‘Content-Type: application/json’
-d ‘{
“compliance_request_id”: “1234567890123”
}’

Thanks,

Asad Latif

Thanks,

Asad Latif

Dear @saalotaibi , @idaoud

thanks for support, I successfully generated the PCSID after following the instructions.

Thanks & Best Regards,

Asad Latif