User Manual Developer Portal Manual Version 3
User Manual Developer Portal Manual Version 3
فــاتورة
User Manual
Developer Portal Manual
Version 3
Nov 2022
1
Contents
1. General Information 05
1.1 Introduction 05
1.1.1 Objectives 05
1.1.2 Scope 06
2.1 Pre-requisites 08
2.3.6 Accessing the Compliance and Enablement Toolbox Portal Based Validator 17
2
2.3.7 Using the Compliance and Enablement Toolbox Portal Based Validator 19
3. Security Requirements 68
4.2.3 Compliance and Enablement Toolbox Portal Based Validator Technical FAQs 82
5 Appendix 87
3
5.1 Glossary 87
4
1. General Information
1.1 Introduction
The Developer Portal is a dedicated portal provided by ZATCA for the developers of E-invoicing Generation
Solutions (EGS). It contains two development tools aimed at supporting developers build compliant EGS
units which are:
● The Compliance and Enablement Toolbox Software Development Kit (SDK): an offline downloadable
tool which can be used to validate an XML based e-invoice, credit or debit note files in accordance
with the ZATCA published requirements, standards and guidelines. It also allows validation of the QR
codes as per the prescribed structure. Developers can integrate their EGS units with the SDK locally
(offline) or also test using a Command Line Interface (CLI).
● Integration Sandbox: a test ZATCA backend system which EGS units can integrate with to make API
calls to simulate and test the Onboarding process followed by the submission of test e-invoices, credit
and debit notes for Reporting and Clearance in accordance with the ZATCA published requirements,
standards and guidelines.
In addition to the above, the Developer Portal has a third tool aimed at intermediate or non-technical users
to validate an XML based e-invoice, credit or debit note files from the portal directly. This is referred to as
the Compliance and Enablement Toolbox Portal Based Validator.
Finally, the Developer Portal has a dedicated support page containing a list of Frequently Asked Questions
(FAQs) to help developers troubleshoot during development and testing of their EGS units as well as
provide guidance on E-invoicing requirements in general.
1.1.1 Objectives
The primary objective of the Developer Portal is to support the Developer community in building EGS units
that are compliant with ZATCA's XML implementation standards as well as the Security Features and
Implementation Standards.
5
● The objective of the SDK is to ensure that XML e-invoices, credit or debit notes being generated by the
EGS units are compliant
● The objective of the Web based validator is to allow less or non-technical users to be able to independently
validate the compliance of XML e-invoices, credit or debit notes and share the results with their developers.
● The objective of the Integration Sandbox is to test the EGS units / solutions / applications are able to
integrate with a test ZATCA backend system via APIs covering the following:
● Submit a test Certificate Signing Request (CSR) to obtain a test Compliance Cryptographic
Stamp Identifier (CCSID) and test Request ID
● Submit a test Request ID to obtain a test Production CSID
● Submit test Standard Documents using the test Clearance API (or using a variant of the test
Reporting API to mimic the process when Clearance is turned off)
● Submit Simplified Documents using the Reporting API
1.1.2 Scope
This user manual acts as a guide for Developers in order to help them access and use the Developer
Portal features and functionalities. It explains in detail the user journey including steps, requirements and
processes needed for accessing the Developer Portal. Moreover, it provides guidance for the relevant
technical aspects and methods to be used to solve common issues that might be faced by the Portal users.
This document covers the following functionalities that are of relevant to the Developer Portal:
6
● Accessing and downloading the Compliance and Enablement Toolbox SDK
● Understanding of the SDK and how to use it
● Downloading the SDK
7
2. Developer Portal Overview
2.1 Pre-requisites
The Developer Portal itself is a web-based application and can be run from any modern browser such as
Google Chrome, Microsoft Edge or Apple Safari.
The SDK is a Java based JAR file that can run on all leading platforms including Windows, Linux and
Mac. The Java SDK (JAR) will run on JDK versions >=11 and <15, to comply with secp256k1 as per ZATCA
security regulations.
The Integration Sandbox APIs can be accessed from all leading platforms as those mentioned above.
REST APIs can be accessed from any Rest Client tools (Postman) for testing or using any coding languages
(java, .Net, PHP, Nodejs, etc.) to call the rest services using HTTPs Protocol.
8
2.2 Structure / Sitemap
The Developer Portal is comprised of the following:
Developer Portal
Onboarding process)
● Test compliance of XML
● Test APIs to obtain new Compliance
● Test compliance of QR
CSID and Production CSID (Test the
Code (Generation Phase)
Renewal process)
● Test Compliance of QR
● Test API to submit documents for
Code (Integration Phase)
Reporting
Clearance
9
2.3 User Journeys
The recommended steps for Solution Developers are:
1. Read the XML Implementation Standards, Security Features Implementation Standards and Data
Dictionary
2. Access the Developer Portal
3. Create a Developer Portal Account
4. Login to the Developer Portal as a Registered User
5. Access the SDK Page
6. Read the SDK Support and Documentation
7. Download the SDK
8. Test XML compliance using the SDK via CLI / local integration
9. Access the Integration Sandbox Page
10. Go through the API Documentation on Swagger
11. Test the APIs through Swagger
12. Test the APIs via integration
13. Leveraging the Developer Portal Support page FAQs for troubleshooting
10
2.3.1 Accessing the Developer Portal
The process for accessing the Developer Portal is as follows:
1. Access the Developer Portal through the following weblink (https://sandbox.zatca.gov.sa/).
2. The user is directed to the Developer Portal main dashboard / landing page
1. In this page the user can access the below sections without registration or login:
1. Developer Portal Support Page which includes the FAQs.
2. Web Based Validator for Non-Technical Users.
2. The following sections would require the user to create a Developer Portal account:
1. Compliance and Enablement Toolbox SDK Page.
2. Integration Sandbox Page.
Note: The User can chose to toggle the language between English and Arabic by using the icon on the
top right-hand side of the page.
11
2.3.2 Creating a Developer Portal Account
As mentioned above, a Developer Portal account is required for accessing the Compliance and Enable-
ment Toolbox SDK page and the Integration Sandbox page. You can ignore this step if you only wish to
access the Web Based Validator or the Developer Portal Support page.
Once the user is on the main dashboard of the Developer Portal, they can click on the "Sign up" button at
the top right-hand side as seen in the Figure below.
● Email ID
● First Name
● Last Name
● Company Name (optional field)
● Password
● Confirm Password
In the Sign Up page (as seen in the Figure below), the user will be prompted to create a new account by
providing the following details:
The email must be a valid email and the password must be at least 8 characters comprising of at least one
number, one letter each in lower and upper case, and one symbol.
After completing all the necessary fields, the user should click on the CAPTCHA verification followed by
the Sign up button.
12
Login Page
After the user has signed up and created their account credentials, they can proceed to the Login page
where they will be prompted to:
● Fill in the User Name and Password (as created by the user).
● Click the CAPTCHA.
● In addition, the user can click "Forgot Password"
● In the case where the user does not have an account set up and requires one, the user can click on the
Sign Up option, in order to create a new account and proceed to the process described in this Section
2.3.2 of the User Manual for registration.
● After filling in all the information, the user should click on the Login button in order to proceed to the
main dashboard again where the user will now also be able to access the Compliance and Enable-
ment Toolbox SDK page and the Integration Sandbox page.
● A logged in user can logout at any time by clicking on the logout option on the header. The user can
also change the password at any time by clicking on the arrow next to the user profile icon in header.
13
2.3.3 Accessing the Compliance and Enablement Toolbox SDK Page
The Compliance and Enablement Toolbox (SDK) which is an offline downloadable tool that can be used to
validate an XML based e-invoice, credit or debit note files in accordance with the ZATCA published XML
Implementation Standards. It also allows validation of the QR codes as per the prescribed structure. Developers
can integrate their EGS units with the SDK locally (offline) or also test using a CLI.
The process for accessing and downloading the Compliance and Enablement Toolbox SDK through the
Developer Portal is as follows:
● The user should be registered and logged into the Developer Portal successfully
● The user should click on "Compliance and Enablement Toolbox and SDK" to view the SDK functionalities.
14
Accessing the Compliance and Enablement Toolbox (SDK)
After the user has accessed the Compliance and Enablement Toolbox SDK Page, the user can:
● Access the SDK support, which includes aspects such as how to use the SDK and how it works, as well
as the minimum software requirements and the instructions of relevance to each Operating System/
environment.
● Access documentation such as the XML Implementation Standards (E-Invoice XML Implementation
Standard), Security Features and Implementation Standards (E-Invoice Security Features and
Implementation Standards) & Data Dictionary (E-Invoice Data Dictionary)
● Download the SDK after accepting the terms and conditions.
● View the version history which contains earlier releases of the SDK.
15
Accessing the E-Invoicing specification documents
16
2.3.5 Using the SDK (outside of the Developer Portal)
Please refer to the ZATCA E-Invoice Java SDK (CLI) Manual on the below link by downloading the SDK
and then navigate to readme folder.
https://zatca.gov.sa/ar/E-Invoicing/SystemsDevelopers/ComplianceEnablementToolbox/Pages/Down-
loadSDK.aspx.
The process for accessing the "Web Based Validator for Non-Technical Users" page is as follows:
● The User accesses the "Web Based Validator for Non-Technical Users" on the Developer Portal (no prior
registration or log in required).
17
Accessing the web based validator
● On the "Web Based Validator for Non-Technical Users", users can view information related to an
explanation of the Web Based Validator and what it aims to do
● In addition, users can click on "Access the Web Based Validator for taxpayers without a development
environment" in order to begin testing and validating their XMLs.
● Once users have chosen to "Access the Web Based Validator for taxpayers without a development
environment", a disclaimer is shown detailing that:
18
The portal validation page is a standalone application and compliance does not necessarily imply the
e-invoices, credit or debit notes have been accepted by ZATCA. All Taxpayer E-invoicing solution unit will
need to pass the testing requirements as part of Registration/Taxpayer Onboarding prior to submitting
e-invoices, credit or debit notes to ZATCA.
● The User has to acknowledge the disclaimer in order to proceed to test their XML files.
19
The process for validating XMLs from the Web Based Validator for Non-Technical Users page is as follows:
Click on “Upload XML file” and choose a file, then click “Validate."
20
If not compliant, the following message is shown.
The non-technical user is expected to share the validation outcomes with the Solution Developer to take
necessary action.
21
Developers must also take into account that documents or requests submitted on the Core E-invoicing Solution
will be subjected to additional validations such as security features, prohibited functionalities, additional
business rule validations and/or referential checks based such as validating Seller/Buyer information entered
in the documents, validations based on previously submitted documents.
On the left navigation bar of the page the user is able to access the links to the API documentation which
are maintained as Swagger files (each API call is described in section 2.3.10 below along with the possible
outcomes).
22
2.3.9 Accessing the API and associated Documentation (Swagger Files)
Access to the Swagger files is provided from the Integration Sandbox page. API documentation is provided
covering all the API calls that can be tested on the Sandbox such as:
● Test request for Compliance CSID as part of a new onboarding (requires a signed test CSR to be submitted
- details provided in the Swagger files)
● Test request for Production CSID as part of a new onboarding (requires a test Compliance CSID to be
submitted)
Note: The Core E-invoicing Solution will require specific compliance checks to be completed in between
the Compliance CSID and Production CSID requests and the latter will return an invalid response until these
compliance checks are completed. This invalid response can be tested in the Sandbox by providing a specific
input which is covered in the Swagger files below.
● Test request for a new Production CSID as part of renewal (requires a test Compliance CSID to be sub-
mitted)
● Test submission of documents for Clearance (requires a test Production CSID)
● Test submission of documents for Reporting (requires a test Production CSID)
Although the Sandbox uses test CSIDs, it is important to note that the VAT Registration number used to obtain
the test CSID must match with the VAT Registration number in the Renewal CSR and/or e-invoices, credit
notes, debit notes and QR codes submitted in all subsequent calls made using that specific test CSID. In other
words for every VAT Registration Number that is used in the Sandbox integration, a separate CSID will have
to be requested. Of course the VAT Registration Numbers can be dummy inputs.
● Please refer to the API Documentation through the following LINK.
Note: Please make sure to log-in in order to view the API documentation
23
2.3.10 Step by step guide to make a successful call to APIs
1. For Reporting and Clearance (testing the submission of E-invoices, credit and debit notes)
● The users' E-Invoice Generation Solution (EGS) needs to generate compliant XML documents. For
more details on generating compliant XML documents please refer to the XML Implementation
Standards and the Data Dictionary (E-Invoice specifications (zatca.gov.sa). It is also recommend to
test the compliance using the Compliance and Enablement Toolbox SDK (Download SDK (zatca.
gov.sa) or Portal based validator for non-technical users (Compliance and Enablement Toolbox
portal).
● For Simplified documents (and optionally for Standard documents), the EGS also needs to generate
compliant QR codes. For more details on generating compliant QR codes please refer to the
Security Features and Implementation Standards (E-Invoice Security Features and Implementation
Standards).
24
● Note that EGS must obtain a test Cryptographic Stamp Identifier (CSID) first, by using the test
integration calls for Onboarding or Renewal.
2. For Cryptographic Stamp Identifier (testing the Onboarding and Renewal processes).
● The users' EGS needs to generate a compliant CSR to obtain a test CSID. For more details on
generating a compliant CSR and CSID specifications please refer to (E-Invoice Security Features and
Implementation Standards).
● Note that EGS must obtain a test Cryptographic Stamp Identifier (CSID) first, by using the test
integration calls for Onboarding, in order to test the integration call for Renewal which requires a test
CSID to be included in the request.
25
● Step 4: Click on API documentation guides
26
● Step 6: Click on try it out
● Step 7: Insert valid OTP and fill the request body (CSR)
● Step 8: Click on Execute
Note: V2 refers to the Version of the APIs used and should be mentioned in the API calls
(V2 is currently the only valid version).
27
● Result (200)
28
● Step 4: Click on API documentation guide
Note: This step is to be repeated on the number of invoices to be sent as part of the compliance
checks.
29
● Step 6:
For the Sandbox, use the sample dummy Username and Password provided to you on
the Authorization screen.
For Production, run the Compliance CSID API to obtain the “binarySecurityToken” to be used
as the Username and “secret” as the Password.
30
● Step 7: Click on Compliance Invoice API drop-down
31
● Step 8: Click on Try it out button
Note: V2 refers to the Version of the APIs used and should be mentioned in the API calls
(V2 is currently the only valid version).
32
● Step 9: Fill the request body (invoice hash, UUID, encoded XML invoice)
● Step 10: Click on Execute
● Result (200)
33
2.3.10.3 Production CSID (Onboarding) API
● Step 1: Navigate to Developer Portal link
● Step 2: Login with correct credentials
● Step 3: Navigate to API Integration Sandbox
34
● Step 5: Click on Authorize Production CSID (Onboarding) API
35
● Step 6:
For the Sandbox, use the sample dummy Username and Password provided to you on
the Authorization screen.
For Production, run the Compliance CSID API to obtain the “binarySecurityToken” to be used
as the Username and “secret” as the Password.
36
● Step 7: Click on Production CSID (Onboarding) API drop-down
Note: V2 refers to the Version of the APIs used and should be mentioned in the API calls (V2 is
currently the only valid version).
37
● Step 9: Fill the request body (compliance request ID)
● Step 10: Click on Execute button
38
● Result (200)
39
2.3.10.4 Production CSID (Renewal) API
● Step 1: Navigate to Developer Portal link
● Step 2: Login with correct credentials
● Step 3: Navigate to API Integration Sandbox
40
● Step 5: Click on Authorize Production CSID (Renewal) API
41
● Step 6:
For the Sandbox, use the sample dummy Username and Password provided to you on
the Authorization screen.
For Production, run the Compliance CSID API to obtain the “binarySecurityToken” to be used
as the Username and “secret” as the Password.
42
● Step 7: Click on Production CSID (renewal) API drop-down
43
● Step 9: Insert valid OTP
Note: V2 refers to the Version of the APIs used and should be mentioned in the API calls (V2 is
currently the only valid version).
44
● Step 10: Fill the request body (CSR)
● Step 11: Click on Execute button
● Result (200)
45
2.3.10.5 REPORTING
● Step 1: Open CMD and Generate simplified invoice
● Step 2: On SDK, sign the XML invoice and get the hash value using the following:
● fatoora -sign -qr -invoice invoiceName.xml -signedinvoice signedinvoiceName.xml (hash is
returned and signed invoice is generated)
● fatoora -generateHash -invoice invoiceName.xml (optional)
Afterwards, validate the XML invoice.
46
● Step 3: Encode the Signed XML invoice using Base 64
● Step 4: Open Developer Portal and choose integration sandbox
47
● Step 5: Click on API documentation guides
48
● Step 7:
For the Sandbox, use the sample dummy Username and Password provided to you on
the Authorization screen.
For Production, run the Compliance CSID API to obtain the “binarySecurityToken” to be used
as the Username and “secret” as the Password.
49
● Step 8: Click on Reporting API drop-down
Note: V2 refers to the Version of the APIs used and should be mentioned in the API calls (V2 is
currently the only valid version).
50
● Step 10: Replace the Invoice hash in xml and encode the xml using Base 64
● Step 11:Fill the request body (invoice hash, UUID, Base 64 encoded XML invoice)
51
● Step 12: Execute
52
● Result (200)
● Result (400)
53
2.3.10.6 CLEARANCE
● Step 1: Open CMD and Generate standard invoice
54
● Step 4: Open Developer Portal and choose integration sandbox
55
● Step 5: Click on API documentation guides
56
● Step 7:
For the Sandbox, use the sample dummy Username and Password provided to you on
the Authorization screen.
For Production, run the Compliance CSID API to obtain the “binarySecurityToken” to be used
as the Username and “secret” as the Password.
57
● Step 8: Click on Clearance API drop-down
58
● Step 9: Click on try it out
Note: V2 refers to the Version of the APIs used and should be mentioned in the API calls
(V2 is currently the only valid version).
59
● Step 10: Replace the Invoice hash in xml and encode the xml using Base 64
● Step 11: Fill the request body (invoice hash, UUID, Base 64 encoded XML invoice)
60
● Step 12: Execute
● Result (200)
61
● Result (400)
62
● As per updated data dictionary,
● As per updated data XML Implementation Stan-
The treatment of dictionary, XML dards and Security Features
validations and Implementation and Implementation Standards
● As per original
exceptions as part Standards and (including updates to CSR and
(published) data
of the Reporting Security Features CSID standards)
dictionary, XML
and Clearance and Implementation ● Seller Address field will be
Implementation
process. Standards (includ- accepted with warning for Tax-
Standards and
Exceptions here ing updates to CSR payer devices / solution units to
Security Features
refer to warnings and CSID standards) differentiate Between a warning
and Implementation
Validation which are similar to ● Seller Address field and an error response
Standards
Engine errors but do not will be accepted ● Two variants of the Reporting
● No exceptions
(For Invoices) cause the with warning for and Clearance APIs which are
(Invoices are
submitted Taxpayer devices / configured with Clearance
either accepted or
invoices/documents to solution units to dif- disabled is being provided -
rejected)
be rejected but are still ferentiate between ● NEW
● Not possible to test
indicated in a warning and an ● Note: In the Core Einvoicing
for Sandbox behav-
the response so error response Solution there will only be one
ior When Clearance
that they can be ● Not possible to test API each for Reporting and
is disabled
corrected in future for Sandbox behav- Clearance which at any point of
submissions. ior when Clearance time willeither be configured
is disabled to Clearance being enabled or
disabled
63
Table 2
The following table provides a summary description of the APIs including the key outputs and inputs/pre-
requisites for each API.
64
● Valid request: Test Com-
This API should be used to test submitting ● Public Private Key pair
pliance CSID and a test
Compliance test CSRs (Certificate Signing Requests) to
Request ID are obtained ● Signed CSR
CSID API the ZATCA backend system as part of the
Onboarding and renewal process
● Invalid request: Error
message(s)
65
2.3.12 Accessing the Developer Portal Support Page
The Developer Portal Support Page can be accessed from the main dashboard of the Developer Portal and
does not require any prior registration / log in. Through this page, the user can view the different types of
support available which includes the Toolbox and Sandbox documentation. In addition, the user can view the
FAQ section to find readily available answers to common inquiries they may have on the Developer Portal
tools and functionalities as well as more specific questions on testing the compliance of their XMLs. Users can
also find the support contact information that they can access should they require any support. This includes
phone number / hotline, international phone number and the email address. Users could also provide any
suggestions or complaints they may have.
The user can access the Developer Portal Support Page from the main Developer Portal page.
66
A search bar is also readily available for users to search and obtain the relevant information easily. The user
can view common enquiries in the FAQ page. The user can see a contact section at the bottom of the support
page in case of experiencing any issues and in the event that the user would want to receive the support of the
contact center.
67
3. Security Requirements
ZATCA uses Basic Authentication for its E-invoicing security solution.
Basic Authentication
The solution will include a Basic Authentication header with the CSID as the Username and
Description a Secret Value as the Password. Secret value will be issue with the CSID. An additional ac-
cept-version: v2 header must be added to V2 API calls.
CSID and Secret are issued for the compliance checks, CSID should be used as the user and the
Onboarding
Secret as the password
Production CSID and Secret issued and all eInvoicing calls (reporting and clearance) should
E-invoicing include the Basic Authentication header with CSID as the user and Secret as the password. An
additional accept-version: v2 header must be added to V2 API calls
68
4. Frequently Asked Questions (FAQs)
4.1 Business FAQs
4.1.1 Developer Portal Business FAQs
# Question Answer
● The SDK page, used for testing the compliance of XML files
What are the main tools or
with the e-invoicing requirements
2 functionalities provided by the
● The Portal-based validator page, which enables non-
Developer Portal?
technical users to check the compliance of XML files by
uploading them to the Portal
69
# Question Answer
70
4.1.2 SDK Business FAQs
# Question Answer
71
The users will be able to validate the following fields:
1. Seller's Name.
1. Seller's Name.
72
9. For Simplified Tax Invoices and their associated notes,
the ECDSA signature of the cryptographic stamp’s public
key by ZATCA’s technical Certificate Authority (CA) is
required.
6 Continue
Please find below an example:
73
public static byte[] extractS(String digitalSignature) throws
Exception {
MessageDigest digest = MessageDigest.
getInstance("SHA-256");
byte[] hash =
6 Continue
digest.digest(Base64.getDecoder().
decode(digitalSignature.getBytes(StandardCharsets.
UTF_8)));
return Arrays.copyOfRange(hash, 32, 64);
74
4.1.3 Web Based Validator Business FAQs
# Question Answer
75
4.1.4 Integration Sandbox Business FAQs
# Question Answer
76
If my invoices are compliant XMLs validated by the Toolbox are expected to receive
as per the Compliance and successful responses on the Integration Sandbox also
3 Enablement Toolbox, will unless there are issues with the API request itself.
they also pass the Integration However, the Sandbox can also run some additional
Sandbox? validations.
77
Does the Integration Sandbox No, dummy information can be provided as long as they
9 require actual taxpayer details meet the syntax and content specifications and the XML
on the XML files? implementation standards and validation rules.
78
A Compliance CSID is an intermediate CSID provided in
response to the CSR submission from an EGS or other solution.
In the Core E-invoicing Solution, the Compliance CSID is
What is the difference between required to complete some compliance checks before the EGS
13 a Compliance and Production or other solution is able the Production CSID which is required
CSID? for authenticating the EGS or other solution to ZATCA. In the
Sandbox, the compliance checks are not required, and the
purpose is to therefore to test the integration calls of obtaining
the Compliance and Production CSIDs.
Can anyone access sandbox and No, Sandbox can be accessed by anyone, but FATOORA
16 FATOORA portal? production system can be accessed only by taxpayers using
Taxpayer portal credentials (ERAD credentials).
79
4.2 Technical FAQs
4.2.1 Developer Portal Technical FAQs
# Question Answer
# Question Answer
80
Java is a programming language that runs on different
operating systems (OS), such as Windows and Linux. A JAR is
3 What is a Java and JAR? a package file format that is generally used to aggregate many
Java class files and associated metadata and resources (text,
images, etc.) into one file for distribution.
Can I validate the Arabic language No, since the CLI does not support Arabic characters
4
fields in a QR code within the CLI? display.
What JAVA version should I The prerequisite is using the Java SDK (JAR) versions
5
install before using the SDK? >=11 and <15.
What should the user do when When faced with a JAVA error, the user needs to install JAVA
6
faced with a JAVA error? (versions >=11 and <15) before running and using the SDK.
Where can I find examples of Sample XML files are included in SDK. You can download the
7
XML files? latest SDK from Developers portal (Sandbox).
81
4.2.3 Web Based Validator for Non-Technical Users Technical FAQs
# Question Answer
82
4.2.4 Integration Sandbox Technical FAQs
# Question Answer
4. QR Code validation
5. Cryptographic Stamp validation
83
The response will be 200 HTTP Ok with a Retrieved
object containing 4 values : "invoiceHash","Status"
,"Warnings", "errors" .
Retrieved object Example:
{
What should the user expect
"invoiceHash": "TODO Add Invoice Hash",
4 as a response if calling the
"status": "Reported",
"Reporting API" was a success?
"warnings": null,
"errors": null
}
More information can be found on the Integration
Sandbox section of the Developer Portal.
84
The body object should Contain 2 Values: the first one is
called "invoiceHash" and the second one is called "invoice".
Example:
What's the Request Body the {
7 user should send while calling "invoiceHash": "string",
"Clearance API"? "invoice": "string"
}
More information can be found on the Integration Sandbox
section of the Developer Portal.
Code - Description
● 200- HTTP OK
● 202- Accepted with Errors, simplified invoice accepted
What are the Response causes
with warning errors
(Code & Description) that can
9 ● 303- HTTP See Other. Returned when the submitted
appear while calling "Reporting
invoice is a Standard Invoice while clearance is activated
single API"?
● 400- HTTP Bad Request. Returned when the submitted
request is invalid
● 500- HTTP Internal Server Error. Returned when the
service faces internal errors
85
Code - Description
● 200- HTTP OK
● 202- Accepted with Errors, clearance invoice accepted
What are the Response causes with warning errors
(Code & Description) that can ● 303- HTTP See Other. Returned when the submitted
10
appear while calling "Clearance invoice is a Standard Invoice while clearance is
single API"? activated
● 400- HTTP Bad Request. Returned when the submitted
request is invalid
● 500- HTTP Internal Server Error. Returned when the
service faces internal errors
86
5. Appendix
5.1 Glossary
CN Credit Note
DN Debit Note
87
ISB Integration Sandbox
88
5.2 Developer Portal Security Information
The Developer Portal uses HTTPS, as a secure method of communication between the browser and the
server. The user account is protected by a username and password. The session stays alive for 8 hours
after which the user will need to sign in again.
89
VAT Registration Number of the
VAT or Group Taxpayer (Taxpayer / Taxpayer
Organization 15 digits, starting and
VAT Registration device to provide this to allow
Identifier ending with 3
Number to check if the OTP is correctly
associated with this TIN)
If 11th digit of
Organization Identifier
The branch name for taxpayers.
is not = 1 then Free
In case of VAT Groups this field
text
Organization should contain the 10-digit TIN
Organization Unit
Unit Name number of the individual group
If 11th digit of
member whose EGS Unit is
Organization Identifier
being onboarded
= 1 then needs to be a
10 digit number
Organization
Taxpayer Name Organization/Taxpayer Name Free text
Name
90
The input should be using the
digits 0 & 1 and mapping those to
“TSCZ” where:
0 = False/Not supported
Organization
Taxpayer Name Organization/Taxpayer Name Free text
Name
The screenshot below represents the information the user must use to generate a CSR (using Open SSL
Command Tool) and its configuration file as shown below. For further information, please see link: /
index.html (openssl.org)
91
5.3.2 Generate public/private key pair
● According to security implementation document the Key pair shall be generated according to FIPS
186. Further, reasonable techniques shall be used to validate the suitability of the generated key
pair.
● The suitability of keys shall be done according to either the ECC Full Public Key Validation Routine or
the ECC Partial Public Key Validation Routine. [Source: Sections 5.6.2.3.2 and 5.6.2.3.3, respective-
ly, of NIST SP 56A: Revision 2].
● Keys must be marked as non-exportable in order to prohibit key export out of the security module
where the key was generated
● A hardware or software based security module can be used to generate and store the key pair as
long as the above requirements are met.
92
5.3.2.1 Generate Private Key
The service providers/ own solution need to keep the private key secret. The created certificate will
only work with a particular private key that was generated. So if the private key lost, the certificate
will no longer work. we are generating a pair of ECDSA keys with the P-256 (secp256k1) curve, the
PrivateKey.pem file will be the generated private key, change the file name to YourPrivateKey.pem.
the following command show how to generate a private key using OpenSSL:
By using the compressed public key only X values will be used in the elliptic curves:
93
The base64 public key will be use to validate the signature for the standard invoice:
94
5.3.4 Testing the certificate
The service providers/own solution can test the compliance of the generated CSR using the requests
that can be found in the below Postman collection:
The service providers/own solution needs to add the generated CSR in the body of the request:
95
External Document
This guide has been prepared for educational and awareness purposes only,
its content may be modified at any time. It is not considered in any way binding
to ZATCA and is not considered in any way a legal consultation. It cannot be
relied upon as a legal reference in and of itself, It is always necessary to
refer to the applicable regulations in this regard. Every person subject to
zakat, tax and customs laws must check his duties and obligations, he is
solely responsible for compliance with these regulations. ZATCA shall not
be responsible in any way for any damage or loss The taxpayer is exposed
to that results from non-compliance with the applicable regulations.
scan
تحديـث this code
عـلــــى آخر ّ to view
لالطالع the
الـكــود lastامـسـح
هـــــذا
version and
المـنـشـورة all published
المستنــــدات وكـافةdocuments
لـهــذا المستنـد
or visit the website zatca.gov.sa
zatca.gov.sa أو تـفضل بزيـارة الموقع اإللكتروني
96