i am using sandbox account of zatca and using API Integration Sandbox, I have completed Compliance invoice API , but when i am using production Reporting API i am getting error , Please check if i am following the correct steps for production onboarding.
Kindly not that the sandbox has a static certificate and you can not successfully integrate with ZATCA using it, please find the below detailed onboarding process using our SDK tool JAVA, our recommendation is to start in simulation environment after reviewing carefully the detailed technical docs shared on ZATCA site, to ensure full understanding for all ZATCA regulations before starting with integration.
The following links are some documentation that might help you.
You can find below the steps for the onboarding process using Java SDK:
Prepare your config file with the required info
Use “fatoora -CSR -csrConfig –[config file path]” command to generate CSR file
A CSR file will be generated
Generate the OTP from Fatoora portal or simulation portal based on the purpose of either testing or production.
Use the CSR in the body of the request using one of the below endpoints to send the request for generating the CCSID (Use the OTP in the Headers of the request):
a. For the simulation environment use this API URL:
https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance
b. For the production environment, use this API URL:
https://gw-fatoora.zatca.gov.sa/e-invoicing/core/compliance
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.
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.
For standard invoices
a. use “fatoora -generateHash -invoice [invoice path]” command to generate the hash
b. replace the generated hash in the “Digestvalue” tag in the XML
c. generate the JSON file for the invoice using “fatoora -invoiceRequest -invoice [invoice path]” command
For simplified invoices
a. make sure to change the SDK\Data\Certificates\cert.pem with the decoded CCSID
b. sign the invoice using “fatoora -sign -invoce [invoice path] command
c. generate the JSON file for the signed invoice using “fatoora -invoiceRequest -invoice [invoice path]”
After you prepared your invoices, you need to send the encoded invoices (JSON file) to one of the following APIs:
a. For compliance checks in the Production Environment, use this API URL. https://gw-fatoora.zatca.gov.sa/e-invoicing/core/compliance/invoices
b. For compliance checks in the Simulation Environment, use this API URL https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance/invoices
In order to generate the PCSID, take the “Request ID” you got from the CCSID response (on step 6 above)and replace it in the body of the request.
Make sure to send an invoice, credit note, and debit note to the compliance check, to avoid “Missing Compliance Steps”
Now you need to generate the PCSID using one of the following APIs in the body use the request_ID and in authentications use the BinarySecurityToken as user name, secret as password:
a. For Simulation Environment: https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/production/csids
b. For Production Environment: https://gw-fatoora.zatca.gov.sa/e-invoicing/core/production/csids
Additionally, note that the only different if you are using .Net will be in the command, the main functionality will stay the same, for any further concerns do not hesitate to reach out your RM to reach with our support team via below mail.
For Sandbox Environment, make sure you use default Vat Number 399999999900003 for Generating CSR and Invoice Xml inside Tag <cac: AccountingSupplyerParty>.