2026-05-07·
15 min read·
Developer
ZATCA Phase 2 Developer Guide: Complete Technical Integration
This guide is for developers building invoicing systems for the Saudi market. It covers all technical details for integrating with ZATCA Phase 2, from CSR generation to clearing your first invoice.
⚠️ Prerequisites: Understanding of XML, X.509 certificates, ECDSA cryptography, REST APIs, and UBL 2.1 schema.
1. Architecture Overview
Phase 2 (Integration) requires real-time connectivity with ZATCA via two paths:
- Clearance: for Tax Invoices (Standard / B2B). Invoice sent to ZATCA, waits for response before delivery.
- Reporting: for Simplified Invoices (B2C). Invoice delivered first, then reported within 24 hours.
2. Full Integration Cycle
- Generate CSR per ZATCA spec
- Get OTP from Fatoora portal
- POST CSR + OTP → Compliance API → receive Compliance CSID
- Issue 6 test invoices (Standard + Simplified + Credit + Debit notes)
- Request Production CSID from Onboarding API
- Sign real invoices + send to Clearance/Reporting API
Building this layer takes 3-6 months for a specialized team. POS SAAS provides a ready API hiding all complexity. Read API docs or start a free trial.