On this page
What ZATCA actually asks of your software
ZATCA — the Zakat, Tax and Customs Authority — runs Saudi Arabia's e-invoicing programme under the name Fatoora. At policy level it sounds like a documentation exercise: issue invoices electronically, include the right VAT fields, share them with the authority. At engineering level it is something else. Fatoora asks your billing system to produce a specific XML document, sign it with a key ZATCA issued to that system, chain it cryptographically to the invoice before it, and — for a whole class of invoices — obtain approval before the buyer may see the document at all.
That last point catches teams out. E-invoicing gets filed under "finance and tax", so it lands with the finance team as a reporting obligation. But a rule that inserts an external API call between "user presses Save" and "customer receives invoice" is not a reporting obligation. It is a change to your transaction path, with every availability, latency and failure-handling question that implies.
The framing that helps. Treat ZATCA compliance as a distributed systems problem with a tax deadline attached, not a tax problem with some code attached. Every hard part — ordering, retries, idempotency, key custody — is a systems problem wearing a compliance label.
The upside is worth stating honestly. E-invoicing will not transform your finance function on its own. What it delivers is a structured, machine-readable record of every sale, validated at source, with a tamper-evident chain behind it. Reconciliation gets faster, VAT returns stop being archaeology, and disputes are settled by pointing at a signed document. Teams that later invest in business intelligence or data analytics find the groundwork already done.
Phase 1 and Phase 2: what changed
The programme arrived in two stages, and the distinction still matters because plenty of systems in the field satisfy the first and not the second.
Phase 1, "Generation", applied from 4 December 2021. It required invoices to be issued and stored electronically in a structured format, simplified invoices to carry a QR code, and mandatory VAT fields to be present. Notably, it did not require you to talk to ZATCA at all — a compliant Phase 1 system could be entirely self-contained. That is precisely why the step to Phase 2 is larger than the numbering suggests.
Phase 2, "Integration", applied from 1 January 2023 and has rolled out in waves defined by revenue thresholds. Your E-invoicing Generation Solution must now integrate with the Fatoora platform itself. Invoices become UBL 2.1 XML (or PDF/A-3 with the XML embedded), each carrying a cryptographic stamp, a UUID, an invoice hash and the previous invoice hash. The stamp uses a cryptographic stamp identifier — a CSID — obtained by onboarding the generating unit with ZATCA.
On waves and thresholds. ZATCA has advanced the wave schedule repeatedly, and each wave has its own threshold and compliance date. We deliberately name no "current" wave anywhere on this site, because such a claim is wrong within months. Taxpayers in scope are notified directly. Confirm your position against ZATCA's published guidance and your own notification — the only source authoritative on the day you read it.
Clearance vs reporting
Phase 2 splits invoices down a line that determines your architecture. Getting this wrong is expensive, because the two models have opposite failure characteristics.
Clearance covers standard tax invoices — broadly B2B and B2G. The invoice goes to Fatoora and must be cleared by ZATCA before you share it with the buyer. This is synchronous, and it sits on your critical path.
Reporting covers simplified tax invoices — broadly B2C. The buyer gets the invoice immediately; you report it within 24 hours. This is asynchronous and forgiving of transient failure, which is what a retail till needs.
| Clearance (standard) | Reporting (simplified) | |
|---|---|---|
| Typical use | B2B and B2G invoices | B2C, point of sale |
| Timing | Before the buyer receives it | Within 24 hours of issue |
| Call pattern | Synchronous, on the critical path | Asynchronous, queued |
| If ZATCA is unreachable | Invoice cannot be issued yet — needs a queue and a clear operational rule | Till keeps trading; queue drains later |
| Buyer sees | The cleared document | The stamped document with QR |
| Main engineering risk | Latency and availability coupling | Backlog and ordering in the queue |
Most businesses of any size issue both. A distributor with a trade counter, or a clinic billing insurers and walk-in patients, runs clearance and reporting side by side — one codebase carrying two delivery models. Operators hitting this from the POS side should read our restaurant POS notes alongside this guide, since offline tolerance at the till is where the two models collide hardest.
Anatomy of a compliant invoice
Strip away the acronyms and a Phase 2 invoice is a structured document plus some cryptographic bookkeeping.
- UBL 2.1 XML — the document format: Universal Business Language, an OASIS standard, with a Saudi-specific profile on top. Valid UBL is not the same as valid for ZATCA, and the profile's rules are where most rejections originate.
- UUID — a unique identifier for the invoice document, distinct from your human-readable invoice number. Both exist and should not be conflated.
- Invoice hash — a digest of the invoice's canonical form. Change one character and the hash changes, which makes tampering detectable rather than merely discouraged.
- PIH (previous invoice hash) — the hash of the invoice issued immediately before this one by the same EGS. This turns a pile of invoices into a chain, and it is the most under-appreciated requirement in the specification.
- Cryptographic stamp — a signature applied with the key associated with your CSID, binding the document to an onboarded generating unit.
- QR code — mandatory on simplified invoices, encoding key details so they can be verified from the printed slip.
The PIH deserves a moment. Chaining makes invoice ordering a correctness property, not a convenience. You cannot regenerate invoice 500 once 501 exists, let two instances issue against one EGS identity concurrently, or restore a database to yesterday and carry on. Any system whose numbering was "whatever the sequence gives us" now has a real consistency requirement — one ordinary application design handles fine, but only if you know it is there before you build.
EGS onboarding, CSID and the sandbox
An EGS — E-invoicing Generation Solution — is whatever unit actually produces invoices. Not your company, and not your ERP as an abstract product: the concrete generating unit. A till. A branch instance. A company code. A billing microservice. Each is onboarded individually and receives its own CSID, binding it to your VAT registration so every stamped invoice is attributable to a known source.
The practical consequence surprises people. Forty tills across a dozen branches is not one onboarding; it is forty, each with a certificate to install, renew and eventually revoke. You now operate a small PKI estate — an operational commitment, not a project task, and it needs an owner. Where those units run on cloud infrastructure, design the key custody story deliberately alongside your AWS or Azure setup.
ZATCA provides a sandbox, and our consistent advice is to get into it earlier than feels comfortable — ideally before the ERP work is scoped. The sandbox is where you discover that your credit notes reference the original invoice in a way the profile rejects, that line-level discounts do not reconcile to the header, or that a customer's VAT number has a stray space in it. Cheap findings in month one; expensive ones in the week before your compliance date. Nothing in the specification is difficult — the difficulty lives entirely in the gap between the specification and the data you already have.
Common failure modes
The same handful of problems recur. None are exotic; all are avoidable if you know to look.
- Broken PIH chains. Out-of-order generation, a restored backup, a retry that duplicated an invoice, or two instances sharing one EGS identity. Recovery means establishing which invoice is genuinely last and resuming from it — awkward under pressure, trivial to prevent with a single-writer design.
- VAT data that was never as clean as anyone thought. Missing buyer VAT numbers, wrong category codes, addresses that fail validation. The ERP tolerated it for years because a human read the PDF. A validator does not.
- Clearance treated as fire-and-forget. A synchronous dependency on the sales path with no timeout policy, no retry policy, and no answer to "what do counter staff do when Fatoora is slow?" That deserves a decision, not a stack trace.
- Certificate expiry with no owner. If nobody is watching, certificates expire on a Thursday afternoon during a promotion. Monitoring and renewal need a named owner from day one.
- Rounding drift. Line-level rounding that has always been within a halala of the header now fails, because the validator does the arithmetic exactly.
- Returns and credit notes as an afterthought. They are invoices too, and they chain too. Teams scope the happy path and meet this in the sandbox.
Replace the ERP or add an integration layer?
This is the decision most Saudi businesses actually face, and it is often presented dishonestly — usually by whoever sells the replacement. So, plainly: in most cases you do not need to replace your ERP to comply with ZATCA Phase 2.
An integration layer sits beside your existing system. It reads invoice data, generates the UBL 2.1 XML, applies the stamp, manages the PIH chain, handles clearance or reporting, and gives you a console for failures. Your ERP keeps doing what it does. The requirements are modest: invoice data must be accurate and reachable — an API, a database view, even a scheduled export will do.
| Consideration | Integration layer | Replace the ERP |
|---|---|---|
| Scope of change | Invoicing path only | Finance, operations, reporting, training |
| Typical timeline | Weeks | Months, often across a fiscal boundary |
| Risk profile | Contained; original system stays as fallback | Migration risk across the whole business |
| Fixes bad source data? | No — surfaces it, does not repair it | Only if you genuinely re-model the data |
| Sensible when | ERP data is sound and reachable | ERP is end of life, or invoice data is structurally unreliable |
| Main trap | Layer papering over data quality nobody fixes | Compliance deadline driving a decision that should be strategic |
The honest exception: if your invoice data is structurally unreliable — VAT treatment decided by whoever raises the invoice, free-text discounts, the same customer existing five times — no integration layer will save you. It will faithfully transmit the mess and ZATCA will reject it. That is a data problem, and it wants fixing regardless. It may justify a broader ERP programme — but make that call on its own merits, not because a compliance date forced your hand. Our construction ERP and clinic ERP notes cover the same trade-off by sector.
How Inovsion helps
Inovsion has built and delivered an ERP-integrated ZATCA e-invoice solution: EGS onboarding and integration, broad ERP compatibility, and automated compliance and validation. It is a real product, and we work with clients in Saudi Arabia — RiyadhPharma among them — alongside our engineering work across the UAE and India.
What that means in practice:
- We start in the sandbox, not the slide deck. The fastest way to learn what your compliance project really is: push real invoice data at a validator and read the errors. We would rather hand you an uncomfortable findings list in week one than a reassuring plan.
- We integrate with what you have. Deliberately ERP-agnostic: an API, a view or an export is usually enough. If we can get you compliant without touching your core system, that is the recommendation you will get — including when it means a smaller engagement for us.
- We treat the chain as a correctness problem. Single-writer design per EGS, idempotent generation, explicit ordering, and an answer for when Fatoora is slow or a database is restored.
- We plan for the operational tail. Certificate renewal, expiry monitoring, a failure console someone in finance can actually read, and a defined owner. Compliance is not a launch; it runs every day afterwards.
- We confirm requirements per engagement. Waves, thresholds and dates move. We check your position against ZATCA's published guidance rather than a summary written months earlier — including this one.
For the product view, see our ZATCA e-invoicing solution. If you are weighing a wider programme in the Kingdom, our Saudi Arabia engineering page covers how we work there, and our work shows what we have delivered — from ClueMaster's IoT-enabled escape room platform to the Rising Walls property portal.
Frequently asked questions
What is the difference between ZATCA clearance and reporting?
Clearance applies to standard tax invoices, typically B2B and B2G. The invoice must be sent to the Fatoora platform and cleared by ZATCA before you share it with the buyer, so clearance sits inside your invoicing flow. Reporting applies to simplified tax invoices, typically B2C. The invoice is given to the buyer immediately at the point of sale and reported to ZATCA within 24 hours, so reporting can be handled asynchronously.
What is an EGS and why does it need onboarding?
An EGS, or E-invoicing Generation Solution, is the unit that actually generates invoices — a POS till, a billing module, an ERP company code or a branch instance. Each EGS unit is onboarded individually so it can obtain its own cryptographic stamp identifier, or CSID. Onboarding binds a specific device or instance to your VAT registration, which is what allows ZATCA to attribute every stamped invoice to a known source.
What is PIH and why do invoices break because of it?
PIH is the previous invoice hash. Each invoice carries the hash of the invoice issued before it by the same EGS, forming a chain that makes silent deletion or insertion detectable. Chains break when invoices are generated out of order, when a database is restored from a backup, when a queue retries and duplicates an invoice, or when two instances share one EGS identity. Recovery requires establishing which invoice is genuinely last for that EGS and resuming the chain from it.
Does ZATCA Phase 2 mean we have to replace our ERP?
Usually not. If your ERP holds accurate VAT data and can expose invoices through an API, database view or scheduled export, an integration layer can handle UBL 2.1 generation, stamping, PIH chaining, clearance and reporting without touching your core system. Replacement is worth considering only when the underlying invoice data itself is unreliable, or when the ERP is already at end of life for other reasons.
Which ZATCA wave applies to my business?
Waves are announced by ZATCA against revenue thresholds and have advanced repeatedly since Phase 2 began, so any wave named in an article will date quickly. Taxpayers in scope are notified directly by ZATCA. Confirm your wave, threshold and compliance date against ZATCA's published guidance and your own notification rather than against third-party summaries.
How long does a ZATCA Phase 2 integration usually take?
In our experience the engineering work is rarely the long pole. A single EGS with clean invoice data can move through sandbox to production in a few weeks. Timelines stretch when VAT data needs cleaning, when many branches or tills must each be onboarded, or when returns, credit notes and discounts have been modelled inconsistently. Starting in the sandbox early is the most reliable way to discover which of these apply to you.
Work out where you actually stand
Send us how you invoice today — the ERP or POS, roughly how many generating units, and whether you issue standard invoices, simplified invoices or both. We will tell you honestly whether this is an integration layer or something larger, and what we would check first.