ZATCA Phase 2 Integration: A Technical Guide for Saudi Businesses

What ZATCA Phase 2 integration actually requires from your ERP or POS — the XML, the cryptographic stamp, the API calls, and where it breaks.
ZATCA Phase 2 Integration: A Technical Guide for Saudi Businesses
If your accounting software still lets you generate a PDF invoice and call it done, you're already behind. ZATCA Phase 2 integration turns Saudi e-invoicing from a formatting exercise into a live conversation between your system and the Zakat, Tax and Customs Authority — and for standard tax invoices, that conversation has to happen before the invoice is even valid.
Phase 1 only asked you to generate invoices electronically and store them. Phase 2 — the Integration Phase — asks your system to talk to ZATCA's Fatoora platform directly: request a cryptographic stamp, get a UUID assigned, and for B2B standard invoices, get clearance before the document reaches your customer. Get any part of that wrong and you haven't made a paperwork error — you've issued an invoice that legally doesn't count.
By the end of this guide you'll know what ZATCA Phase 2 integration actually demands from your ERP or POS — the XML structure, the cryptographic stamp, the onboarding steps, and the places integrations quietly break in practice — enough to brief a developer or evaluate a vendor instead of guessing from a checklist.
Tip
TL;DR — Phase 2 requires your system to generate UBL 2.1-based XML invoices, sign them with a cryptographic stamp tied to a device certificate ZATCA issues you, and either get real-time clearance (standard invoices) or report within 24 hours (simplified invoices). None of that works without onboarding your device through the sandbox first — most integration failures trace back to skipping that step.
1. What ZATCA Phase 2 integration changes
Phase 1 (from December 2021) was a generation requirement: issue invoices electronically, in a structured format, and stop accepting handwritten ones. Compliance was mostly about the invoicing software you used.
Phase 2 is an integration requirement. Your system doesn't just produce a compliant invoice — it has to be onboarded with ZATCA, sign every invoice with a cryptographic identity ZATCA recognizes, and transmit that invoice to the Fatoora platform. Why ERP implementations fail in the UAE covers a version of this same lesson: the software was never the hard part, the integration with an external system of record is.
ZATCA rolled Phase 2 out in waves, grouping taxpayers by annual revenue and giving each wave a go-live date with several months' notice. If you haven't been onboarded yet, don't assume your revenue bracket is still exempt — check your current wave status directly on the Fatoora portal or with your ZATCA-accredited solution provider, since thresholds and dates are revised periodically and are the one detail in this guide worth verifying fresh rather than trusting any article, including this one.
2. Standard vs. simplified invoices — two different API paths
Phase 2 splits into two workflows depending on who the invoice is for:
- Standard tax invoices (B2B, B2G) go through clearance: your system submits the signed XML to ZATCA, ZATCA validates and stamps it, and only the cleared version — with ZATCA's stamp added — is valid to send to the buyer. This is synchronous; your invoicing flow has to wait on it.
- Simplified tax invoices (B2C — retail, restaurants, most POS transactions) go through reporting: you issue the invoice to the customer immediately with your own cryptographic stamp, then report it to ZATCA within 24 hours. No blocking API call sits between the sale and the receipt.
This distinction drives your architecture more than anything else in this guide. A POS at checkout cannot afford to block on a clearance API call for every simplified invoice — it doesn't need to. A B2B invoicing module absolutely must, because an uncleared standard invoice isn't a valid tax document.
3. What your system needs to generate
Every ZATCA-compliant e-invoice is structured XML based on UBL 2.1 (Universal Business Language), extended with ZATCA-specific fields. At minimum your system needs to produce, per invoice:
- A UUID (universally unique identifier) — not your internal invoice number, a separate identifier ZATCA uses to track the document.
- An Invoice Counter Value (ICV) and a Previous Invoice Hash — each invoice's XML includes a hash of the one before it, forming a tamper-evident chain. Skip an invoice in the sequence and the chain breaks.
- A cryptographic stamp — generated using a private key tied to the device certificate ZATCA issued during onboarding (see below). This is what proves the invoice came from a registered, unaltered device.
- A QR code, embedded in the human-readable invoice, encoding the seller's details, timestamp, total, VAT amount, and (for cleared invoices) the cryptographic stamp — this is what lets a buyer's phone verify an invoice on the spot.
Warning
The most common integration bug isn't in the XML — it's in the hash chain. If your system generates invoices from multiple terminals or in parallel, and two invoices claim the same "previous invoice," ZATCA will reject both. Sequencing has to be enforced at the database level, not assumed from application logic.
4. Onboarding: CSID, CSR, and the sandbox you shouldn't skip
Before your system can sign a single invoice, it needs a Cryptographic Stamp Identifier (CSID), issued by ZATCA in exchange for a Certificate Signing Request (CSR) your system generates. The practical sequence looks like this:
- Generate a CSR that identifies your device/solution (seller name, VAT number, common name).
- Submit it through ZATCA's onboarding API to get a compliance CSID in the sandbox environment.
- Run the compliance checks ZATCA provides — sample invoices, credit notes, and debit notes — until your system passes.
- Request a production CSID and switch your endpoint from sandbox to production.
Every integrator who has done this more than once will tell you the same thing: do not skip step 3. The sandbox exists specifically to catch schema mismatches, wrong tax category codes, and malformed QR payloads before they become a production invoice a customer is holding. Teams that rush straight to production CSID requests are usually the ones back in the sandbox two weeks later, debugging live.
5. Where ZATCA Phase 2 integrations break in practice
A few patterns show up repeatedly, regardless of which ERP or POS is behind them:
- Arabic-language and currency field encoding — VAT numbers, addresses, and item names need consistent UTF-8 handling; a working invoice in English testing can fail once Arabic branch names or item descriptions enter the payload.
- Clock drift — the invoice timestamp and the request timestamp have to be consistent and within ZATCA's accepted tolerance; a server with the wrong timezone silently rejects otherwise-valid invoices.
- Credit and debit notes treated as an afterthought — they follow the same clearance/reporting rules as invoices and reference the original invoice's hash chain; bolting them on after go-live is a common source of late scrambling.
- Retrying failed clearance calls without idempotency — a timeout doesn't mean the invoice wasn't received; resubmitting blindly can create duplicate UUIDs for the same transaction.
None of these are exotic. They're the kind of thing that surfaces in week three of a rushed implementation, which is exactly why the difference between an off-the-shelf tool and one built for how you actually invoice matters more here than in most integration work — compliance APIs punish improvisation.
Wrapping Up
ZATCA Phase 2 integration is not a settings toggle in your accounting software — it's a real integration project with a cryptographic identity, a tamper-evident data structure, and a government API in the critical path of every invoice. Treat the sandbox phase as mandatory, get your hash-chain sequencing right at the database layer, and re-verify your wave status before you assume you're covered.
If you're mid-implementation and something in your clearance flow doesn't match what's described here, that's usually a sign it's worth a second pair of eyes before go-live rather than after.
Tip
Need a system that's actually built for this? A compliant invoice flow has to be designed in from the data model up, not patched on afterward. See how we build compliant systems or get in touch to talk through your setup.
Related Posts
Related Articles

ERP Implementation Cost in Saudi Arabia: What the Licence Price Hides
The licence is about a third of the bill. Data migration, ZATCA integration, Arabic localisation and training are the rest — here is how to price them.

Qoyod vs Daftra vs Odoo vs Custom: Which Actually Fits a Saudi SMB?
Four different answers to the same problem. Here is which one fits which business, and the revenue point where each stops making sense.

ERP Implementation Failure: Why UAE Projects Go Wrong
Two-thirds of ERP projects miss their targets, and the software is almost never the reason. Here's what actually kills them, and how to avoid it.
