Professional Documents
Culture Documents
INFORMATION TECHNOLOGY
1
IT Department - United Group 12/03/2023
1. Introduction
Electronic Invoicing is a procedure that aims to convert the issuing of paper invoices as well as
credit and debit notes into an electronic process that allows the exchange and processing of
invoices, credit and debit notes in a structured electronic format between the buyer and seller. The
E-Invoicing Regulation shall be read together with the Unified VAT Agreement (the Agreement),
the VAT Law published on 4/11/1438H and its amendments (the VAT Law), the VAT
Implementing Regulation (VAT Implementing Regulation) and the resolutions issued pursuant to
the Electronic Invoicing Regulation, including the resolution on the Controls, Requirements,
Technical Specifications and Procedural Rules (herein after referred to as “E-Invoicing
Resolution”) required for implementing Electronic Invoicing in the Kingdom of Saudi Arabia
Listed below, are the three key steps of the UG Journey for obtaining an EGS system and
successfully onboarding it with ZATCA, for the purposes of submitting e-documents to ZATCA:
• The UG will sure the e-invoicing solution is compliant with the e-invoicing
requirements(Compliance of EGS)
• The UG will onboard their EGS devices for integration with ZATCA; (Onboarding)
• The UG will successfully submit electronic invoices, credit notes and debit notes for
Clearance or Reporting to ZATCA.( Sharing invoices and notes (Clearance and Reporting))
unit. The CSR is an encoded text that the EGS Unit(s) submits to the E-invoicing Platform and the
ZATCA CA in order to receive a Compliance CSID. This is a self-signed certificate issued by the E-
invoicing Platform allowing clients to continue the Onboarding process.
Note: All CSR fields are mandatory and the input must follow the specification; otherwise, a CSR
could be rejected. Please refer to the EGS vendor's manual or support for information on how to
resolve issues
Process flow:
• The process for sending a CSR is as follows
• Once the OTP(s) has been entered into the UG EGS Unit(s),
Process Flow
It must be noted that the EGS performs the steps for the completion of the compliance
checks automatically. The Taxpayer should refer to the EGS Guideline for the onboarding
procedure appropriate to their device. The process for the completion of the compliance
checks is as follows:
• Formulate a compliant CSR and receive the CSID for onboarding / renewal (checking the
capability of the EGS Units to perform renewal). Note that reaching compliance checks
implicitly means that the EGS Unit has successfully acquired a compliance CSID
• Based on the invoice type that has been added to the CSR, validation checks are required.
o If the Invoice Type is "1000", then the user should send 3 requests for
o If the Invoice Type is "0100", then the user should send 3 requests for
• The compliance verification of an EGS is concluded when the EGS Unit has undergone the
compliance checks
o The submitted documents are checked against all the validations as well as the
relevant referential/ additional checks and all tests are successfully passed.
o Once found to be compliant, the compliance flag is checked
2.4 Generating a new CSID for the EGS Unit or Renewing the existing CSID
Description:
The CSID generation process occurs at the back-end of the E-invoicing Generation Solution
and is initiated upon the successful completion of the compliance checks and can be
regarded as the final step in the journey of receiving a new CSID. The process flow is
common for both receiving a CSID for the first time and also for renewing the existing CSID.
However, for renewal, the existing CSID of the EGS Unit is revoked and a new one is issued.
Process Flow
The process for the generation and renewal of a CSID is as follows:
• The EGS Unit(s) submit(s) a request to receive its production CSID(s).
• ZATCA CA issues the CSID(s) for the Taxpayer's EGS Unit(s). In cases of renewal,
the ZATCA CA first revokes the existing CSID and then issues the new one.
• The Fatoora Platform relays the new CSID(s) to the Taxpayer's EGS Unit that
originally submitted the CSR to the Fatoora Platform.
3. Onboarding :
The Onboarding section acts as a guide for Taxpayers to help users operate the Onboarding
ZATCA Portal in order to obtain the necessary Cryptographic Stamp Identifiers (CSID) and perform
any other relevant activities such as the revocation of CSID(s). Please note that Taxpayers should
refer to the Guidelineof the E-Invoicing Generation Solution (EGS) Unit for any steps taking place
on the Taxpayer's EGS Unit.
3- Generating QR
• Input: The E-Invoice XML.
• Output: an object of type "Result" that contains
- IsValid : The final Status of the process.
- ResultValue: QR code Generated if "IsValid = True". It should be the same as
the one already exists in the E-Invoice XML file.
- ErrorMessage: The error message if "IsValid = false".
• Integration with other systems
- Declare object from Class "QRValidator"
- Call function "GenerateEInvoiceQRCode"
o Parameter1 (xmlFilePath): E-Invoice
- ResultValue: Empty
- ErrorMessage: The error message if "IsValid = false".
• Integration with other systems
- Declare object from Class "QRValidator"
- Call function "ValidateEInvoiceQRCode"
o Parameter1 (xmlFilePath): E-Invoice XML
5- Validating E-Invoice
• There are two types of E-Invoices "Simplified" & "Standard"
• Validation of "Simplified" E-Invoice contains the next steps
- Validate XSD
- Validate EN Schema Tron
- Validate KSA Schema Tron
- Validate Signature
- Validate QR
- Validate PIH
• Validation of "Standard" E-Invoice contains the next steps
- Validate XSD
- Validate EN Schema Tron
- Validate KSA Schema Tron
- Validate PIH
• Input:
The E-Invoice XML
The content of certificate file.
The Current PIH as string.
• Output: an object of type "Result" that contains
- IsValid : The final Status of the process it should be true if all steps of E-
Invoice validation "IsValid"
- ResultValue: Empty
- ErrorMessage: Empty.
- List of Steps each step is an object of type "Result" that contains if this step
IsValid or not and the error message if it is not valid.
• Integration with other systems
- Declare object from Class " EInvoiceValidator"
- Call function " ValidateEInvoice"
o Parameter 1 (xmlFilePath): E-Invoice XML
o Parameter 2 (certificateContent): Certificate content as string
o Parameter 3 (pihContent): PIH content as string
6- Signing E-Invoice
• Signing E-Invoice contains the next steps
- Generating Hashing
- Generating Signature
- Populating Data
- Generating and populating QR
• Input:
- The E-Invoice XML
- The content of certificate file as string
- The content of private key as string (generated by OpenSSL)
• Output: an object of type "Result" that contains
- IsValid : The final Status of the process it should be true if all steps of E-
Invoice Signing "IsValid"
- ResultValue: XML content after signing if it is valid
- ErrorMessage: Empty.
- List of Steps each step is an object of type "Result" that contains if this step
IsValid or not and the error message if it is not valid.
• Integration with other systems
- Declare object from Class " EInvoiceSigningLogic"
- Call function " SignDocument"
o Parameter 1 (xmlFilePath): E-Invoice XML file full path
o Parameter 2 (certificateContent): Certificate file content as string
o Parameter 3 (privateKeyContent): Private key file content as string
5. System design
5.1 Overview:
Refers to the systems development life cycle a set of processes or stages and all stages of the system
where a number of steps and the main stage falls below .all the steps and methodologies are:
- Plan
- Analysis
- Design
- Implementation
5.2 E-Invoice:
Electronic Invoicing is a procedure that aims to convert the issuing of paper invoices as well as
credit and debit notes into an electronic process that allows the exchange and processing of
invoices, credit and debit notes in a structured electronic format between the buyer and seller.
• IDE: Visual Studio 2022 is the professional IDE (Integrated Development Environment) of
choice for many .NET developers. It's created by Microsoft, who also makes the .NET
framework as well as the C# programming language, so this makes perfect sense. Historically,
VS (short for Visual Studio) has been expensive to use, but fortunately for you and me,
Microsoft has offered a free version for individual developers for many years.
• Language ASP.NET is a free web framework for building websites and web applications on
.NET Framework using HTML, CSS, and JavaScript. ASP.NET MVC 5 is a web framework
based on Model-View-Controller (MVC) architecture. Developers can build dynamic web
applications using ASP.NET MVC framework that enables a clean separation of concerns, fast
development, and TDD friendly.
• HTML is the basic language in web programming and is the cornerstone of web programming.
• JavaScript: JavaScript is a programming language used for interactive web periods - it works
on your computer and does not bear the download from your web site.