ZATCA Regulatory & Technical GuideLast reviewed: November 1, 20269 min read

Complete ZATCA Phase 2 (Integration Phase) Technical & ERP Guide

Saudi Arabia’s Zakat, Tax and Customs Authority (ZATCA) Phase 2—known as the Integration Phase—requires VAT-registered taxpayers to integrate their E-Invoice Generation Solutions (EGS) directly with the FATOORA portal using UBL 2.1 XML, cryptographic stamps (CSID), SHA-256 invoice hash chaining, and real-time or 24-hour API transmission.

Regulatory Note: ZATCA rolls out Phase 2 integration waves based on annual taxable revenue thresholds. Do not confuse a wave announcement date with your organization’s specific integration deadline—always verify your official ZATCA notification and FATOORA portal status.

1. ZATCA Phase 1 (Generation) vs. Phase 2 (Integration)

Phase 1 (effective December 4, 2021) required taxpayers to stop issuing handwritten or unstructured invoices and generate electronic invoices containing basic mandatory fields and a 5-tag Base64 QR code on B2C receipts.

Phase 2 (the Integration Phase, rolled out in waves starting January 1, 2023) introduces strict technical and cryptographic requirements. Every invoice must be structured in ZATCA-compliant UBL 2.1 XML, linked to the preceding invoice via a SHA-256 Previous Invoice Hash (PIH), stamped with a Cryptographic Stamp Identifier (CSID) issued by ZATCA, and transmitted to ZATCA’s FATOORA APIs.

Comparison of ZATCA Phase 1 and Phase 2 Technical Requirements
Requirement AreaPhase 1 (Generation Phase)Phase 2 (Integration Phase)
Invoice FormatAny electronic format (PDF, print)Mandatory UBL 2.1 XML (or PDF/A-3 with embedded XML)
ZATCA ConnectivityOffline (no API transmission required)Direct API integration with ZATCA FATOORA portal
Cryptographic StampNot required in Phase 1Mandatory ECDSA cryptographic signature via ZATCA CSID
Invoice ChainingStandard sequential numberingMandatory Invoice Counter Value (ICV) + Previous Invoice Hash (PIH)
QR Code Structure5 TLV tags (Seller, VAT, Timestamp, Total, VAT Amt)9 TLV tags (adds XML Hash, ECDSA Signature, Public Key & Certificate Signature)

2. Core Technical Pillars: UBL 2.1 XML, PIH Chaining & TLV QR

Under Phase 2, an ERP cannot simply generate a visual PDF. The system must first construct a canonicalized UBL 2.1 XML document adhering to ZATCA’s Data Dictionary and Schematron validation rules (BR-KSA-*).

Each E-Invoice Generation Solution (EGS) unit maintains an immutable chain of invoices. The first invoice uses a base64-encoded SHA-256 hash of "0" as its Previous Invoice Hash (PIH), and every subsequent invoice embeds the SHA-256 digest of the immediately preceding XML invoice.

  • UUID (Universally Unique Identifier): A RFC 4122 UUID v4 generated uniquely for every tax document.
  • ICV (Invoice Counter Value): A strictly incrementing integer counter maintained per EGS unit without gaps.
  • PIH (Previous Invoice Hash): Cryptographic link preventing retroactive deletion or tampering of historical invoices.
  • ECDSA Digital Signature: Generated using the private key paired with the EGS unit’s ZATCA-issued CSID certificate.

3. Why Enterprises Use Middleware Between Their ERP and ZATCA

Core ERP platforms—such as Microsoft Dynamics 365, SAP, Oracle, and custom sector-specific billing systems—are designed for accounting ledgers and operational workflows, not real-time cryptographic XML signing and authority API retry management.

Deploying dedicated middleware like Saky ZATCA Connect decouples statutory e-invoicing cryptography from your core ERP upgrade cycle. Your ERP continues posting invoices normally while the middleware transforms payloads into UBL 2.1 XML, runs pre-flight Schematron validations, communicates with FATOORA, and returns the cleared XML and QR code.

Official ZATCA Regulatory References

Frequently Asked Questions

Yes. Standard Tax Invoices (B2B/B2G) require real-time API clearance from ZATCA prior to issuance, while Simplified Tax Invoices (B2C) must be cryptographically signed and reported to ZATCA within 24 hours.
KSA Enterprise Integration Assessment

Request a ZATCA Phase 2 Technical Demo

Share your existing ERP environment and monthly invoice volume. Our integration engineers will walk you through the middleware architecture, UBL 2.1 XML transformation, and CSID onboarding flow.