Dear All,
After generate cert.csr , csr.config , ec-secp256k1-priv-key.pem and SignedInvoice using Simplified_invoice in SDK (.NET)
What’s now should do ?
Dear @Madleen ,
Kindly note that there are 5 main steps in the onboarding process.
1- CSR generation
2- Compliance certificate generation
3- Compliance check
4- Production certificate generation
So after generating the CSR,
1-you need to generate the CCSID. to generate the CCSID you need to generate the OTP from Fatoora portal or simulation portal based on the environment that you will be using.
2-You need to send a request to compliance API to generate CCSID. Use the generated CSR in the body of the request
3-The response will include the BinarySecurityToken and Secret, you will use those as Authentication in the compliance checks step. Moreover, the response will include request_ID which will be used in the body for generating PCSID API in a later step.
4-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 means you will only send a simplified invoice, if it’s 1000 only for standard invoices and if it’s 1100 you will send both standard and simplified. Moreover, make sure to send an invoice, credit note, and debit note to the compliance check, to avoid “Missing Compliance Steps”
5-For standard invoices use “fatooraNet -generateHash -invoice [invoice path]” command to generate the hash
6-replace the generated hash in the “Digestvalue” tag in the XML
7-generate the JSON file for the invoice using “fatooraNet -invoiceRequest -invoice [invoice path]” command
8-For simplified invoices Before sending any B2C invoice to be checked ensure to decode the
BinarySecurityToken using Base64 and put the decoded BinarySecurityToken to the cert.pem fie following bath inside the SDK (zatca-einvoicing-sdk-238-
R3.3.3\Data\Certificates)
9-sign the invoice using “fatooraNet -sign -invoce [invoice path] command
generate the JSON file for the signed invoice using “fatooraNet -invoiceRequest -invoice [invoice path]”
10-After you prepared your invoices, you need to send the encoded invoices (JSON file) to compliance checks APIs.
11-After completing the compliance checks, now you can generate PCSID. In order to generate the PCSID, take the “Request ID” you got from the CCSID response and replace it in the body of the request and in authentications use the BinarySecurityToken as user name, secret as password
The following links are some documentation that might help you.
XML Standard and Data Dictionary: Technical requirements & Specifications
API Integration Sandbox: Zatca
Web based validator: Zatca
E-invoicing Detailed Technical Guidelines: https://zatca.gov.sa/en/E-Invoicing/Introduction/Guidelines/Documents/E-invoicing-Detailed-Technical-Guideline.pdf
Dear @lalomar ,
I appreciate your help, i want to be clear about steps I did
Step 1:
- Copy the file located in C:\zatca-einvoicing-sdk-238-R3.3.3\Data\Input\csr-config-example-EN.properties to C:\zatca-einvoicing-sdk-238-R3.3.3\Lib.Net\csr-config-example-EN.properties.
- Edit the content of the file using notepad and save it.
- Rename the edited file from csr-config-example-EN.properties to csr.config.
Step 2: - Open a terminal command prompt.
- Run the following command:
fatooranet.exe csr -csrConfig …\csr.config -generatedCsr …\cert.csr -privateKey …\ec-secp256k1-priv-key.pem -nonprod true - This command will generate cert.csr and ec-secp256k1-priv-key.pem.
Step 3: - Use the content of cert.csr (open it with notepad) as the CSR data to get the CCSID.
Step 4: - After getting the CCSID, sign the invoice in CLI using the following command for .NET:
fatooranet sign -invoice “invoice.xml”
Step 5: - Create a JSON request using this command in CLI for .NET:
fatooranet billRequest -invoice "SignedInvoiceName.xml
Note: I have used the simplified_invoice.xml file located in " zatca-einvoicing-sdk-238-R3.3.4\Data\Samples\Simplified\ ٍSimplified_Invoice.xml " to sign the invoice.
Is there anything wrong with the steps? Also, I would like to know when to do the clearing/reporting for debit, credit and invoices in SDK. Should I use SDK for this? I am currently using developer portal endpoints.