Saudi Arabia’s Zakat, Tax and Customs Authority (ZATCA) has transformed how businesses issue invoices. After Phase 1 made electronic invoices mandatory, Phase 2, the Integration Phase, requires invoicing systems to connect directly with ZATCA’s Fatoora platform. If your business bills customers through a custom web portal, an online store or an in-house system, that system has to be ready.
Phase 2 is being rolled out in waves, with ZATCA notifying taxpayers in advance based on their revenue. Once your business is selected, you have a fixed window to integrate. Here’s what the requirements mean in technical terms.
Phase 1 vs. Phase 2
| Phase 1: Generation | Phase 2: Integration | |
|---|---|---|
| Started | December 2021 | January 2023, in waves |
| Format | Electronic invoice (any format) | Structured XML (UBL 2.1) or PDF/A-3 with embedded XML |
| Connection to ZATCA | Not required | Required, through the Fatoora APIs |
| Security | Basic QR code | Cryptographic stamp, hash chain and extended QR code |
Two types of invoices, two flows
Phase 2 treats business and consumer invoices differently, and your system needs to support both if you serve both:
- Standard tax invoices (B2B) go through clearance: you send the invoice to ZATCA, it is validated and stamped, and only then can you share it with the buyer
- Simplified tax invoices (B2C) go through reporting: you issue the invoice to the customer immediately and report it to ZATCA within 24 hours
Credit and debit notes follow the same rules as the invoices they relate to.
Core technical requirements
Structured XML invoices
Every invoice must be generated as XML following the UBL 2.1 standard and ZATCA’s data dictionary. That includes seller and buyer details, VAT numbers, line items, tax categories, totals and a unique identifier (UUID) for every document. Your system needs a reliable mapping from its own data model to these fields.
Cryptographic stamp and hash chain
Each invoice is hashed (SHA-256) and signed with a cryptographic stamp using keys issued to your solution during onboarding. Every invoice also includes the hash of the previous one and an incremental counter, creating a tamper-evident chain. If someone deletes or edits an invoice after the fact, the chain breaks.
Real-time API integration
Your system communicates with Fatoora through secure APIs to onboard devices, clear B2B invoices and report B2C invoices. That means handling authentication, network errors, retries and validation responses gracefully, without ever losing or duplicating an invoice.
QR code generation
Simplified invoices must display a QR code encoded in ZATCA’s TLV format. In Phase 2 it includes the seller name, VAT number, timestamp, invoice total and VAT amount, plus the invoice hash, the digital signature and the public key. Customers and auditors can scan it to verify the invoice.
In Phase 2, an invoice isn’t just a document you send. It’s a record your system has to prove is authentic.
How onboarding works
- Generate a certificate signing request (CSR) for each invoicing unit or solution
- Get a one-time password from the Fatoora portal
- Request a compliance certificate and pass ZATCA’s compliance checks with sample invoices
- Receive your production certificate (CSID) and start submitting live invoices
- Renew certificates before they expire and keep private keys secure
ZATCA provides a developer portal and a simulation environment, so you can test the whole flow before going live. Use it extensively.
Integration approaches for custom portals
- Build it into your application: full control and no extra fees, but you own the complexity of XML generation, signing and certificate management
- Use a certified middleware provider: your portal sends invoice data to a provider who handles the ZATCA layer, which is faster to launch but adds a recurring cost and a dependency
- Connect through your ERP: if your ERP is already Phase 2 compliant, your portal can create invoices there instead of generating them itself
The right choice depends on your invoice volume, your team and how central invoicing is to your product.
Common pitfalls
- Allowing invoices to be edited or deleted after issue instead of using credit notes
- Losing the hash chain when invoices are issued from several servers at once
- Treating ZATCA rejections as rare and not building a clear error-handling workflow
- Storing private keys in source code or shared folders
- Leaving integration until the deadline is close
Phase 2 compliance protects your business from penalties and keeps your invoicing running without interruption. Built properly, it also gives you cleaner data and more reliable financial records. It’s also one of several regulations pushing Saudi businesses to modernise, as we explored in how custom web apps support growth under Vision 2030.
Need to connect your web portal or billing system to Fatoora? Let’s plan a ZATCA Phase 2 integration that fits your platform.
Talk to our team →

