ZATCA Phase 2 connects your invoicing system to the FATOORA platform. Standard (B2B) tax invoices must be cleared by ZATCA before you share them, and simplified (B2C) invoices must be reported within 24 hours. To get there, your system has to be onboarded with a cryptographic stamp certificate, produce UBL 2.1 XML, sign every invoice, chain each invoice to the previous one by hash, and print a QR code in ZATCA's format.
Phase 1 (generation) has applied in Saudi Arabia since 4 December 2021. It requires invoices to be produced and stored by a compliant electronic system, not typed into a spreadsheet or scanned from paper. Phase 2 (integration) goes further: your system talks to ZATCA's FATOORA platform through APIs. It started on 1 January 2023 and is rolled out in waves, and ZATCA notifies each wave at least six months before its date.
| Wave | Who | Integrate by |
|---|---|---|
| Wave 24 | VAT-subject revenue above SAR 375,000 in 2022, 2023 or 2024 | 30 June 2026 |
| Wave 25 | VAT-subject revenue above SAR 187,500 in any year from 2022 to 2025 | ZATCA is notifying taxpayers to integrate by 1 February 2027 |
For an engineering team, Phase 2 is not a reporting add-on. It touches how invoices are numbered, how they are signed, when they can be shown to a customer and what happens when one is rejected. Plan it as an integration project, not a template change.
Phase 2 has two flows, and your system must route every document to the right one.
| Clearance | Reporting | |
|---|---|---|
| Applies to | Standard tax invoices (usually B2B) and their credit and debit notes | Simplified tax invoices (usually B2C) and their credit and debit notes |
| Timing | Real time, before the invoice is shared with the buyer | Near real time, within 24 hours of issuing |
| Who stamps it | ZATCA validates it, stamps it and returns the cleared invoice | Your system stamps it before handing it to the customer |
| What the buyer gets | The cleared invoice from ZATCA, as XML or PDF/A-3 with the XML embedded | The invoice your system produced, with its QR code |
Clearance is the one that changes your checkout or billing flow. A B2B invoice is not legally valid until ZATCA clears it, so your system cannot email it to the customer until the API call succeeds. Reporting is more forgiving: the customer gets the receipt straight away, and you upload it in the background within 24 hours.
ZATCA calls your invoicing system an E-Invoice Generation Solution (EGS). Every EGS unit, whether an ERP instance, a billing service or a point-of-sale device, has to be onboarded before it can issue Phase 2 invoices:
The private key is the crown jewel. Generate it on the unit or in a key vault, never email it, and plan for renewal: ZATCA notifies taxpayers before a certificate expires, and renewal runs through the taxpayer portal. One certificate belongs to one unit, so a business with several billing systems or tills onboards each one.
Phase 2 invoices are XML following ZATCA's implementation standard, which is based on the UBL 2.1 invoice schema. The buyer can receive the XML itself or a PDF/A-3 file with the XML embedded. On top of the business fields, every invoice carries three things that most billing systems have never produced before.
The stamp is a digital signature over the invoice hash. ZATCA's security standard requires SHA-256 for hashing, ECDSA with 256-bit keys for signing, and an enveloped XAdES signature inside the XML, including the certificate chain up to ZATCA's trust anchor.
Each unit keeps an invoice counter that increments for every invoice and note and can never be reset. Each invoice also carries the hash of the previous invoice from the same unit, so the documents form a single chain and their order cannot be changed. A unit must not run more than one chain at a time.
This is where most integrations get into trouble. Two workers issuing invoices in parallel from the same unit, a retry that reissues a number, or a manual database fix all break the chain. Issue invoices for each unit through one sequential path, and store the counter and last hash with the same care as a bank balance.
The QR code is a Base64 string of tag-length-value (TLV) fields, up to 700 characters. Tags 1 to 5 hold the seller's name, the seller's VAT number, the invoice timestamp, the total with VAT and the VAT total. Phase 2 adds tag 6, the hash of the XML invoice, tag 7, the ECDSA signature, and tag 8, the public key. For simplified invoices, tag 9 holds the signature of the stamp certificate issued by ZATCA. Buyers can scan it with ZATCA's app.
Invoices can't be cancelled in Phase 2. If ZATCA rejects a standard invoice at clearance, you fix the problem and submit it again as a new invoice, with its own counter value and hash. The rejected document keeps its counter value and hash; you don't edit or reuse them. Corrections to an invoice that was accepted are made with a credit or debit note that references the original.
ZATCA's responses also include warnings. A warning doesn't stop the invoice, but ZATCA says warnings are accepted temporarily and may become rejections later, and repeated warnings can lead to follow-up. Log every warning and fix the cause instead of ignoring it.
ZATCA provides three testing tools: a developer sandbox, an SDK and a web-based validator. Use them in that order. Validate your XML and QR codes with the SDK on every build, run your real invoice types through the sandbox, and only then onboard a production unit.
Test the cases that break chains and queues, not just the happy path:
Phase 2, the integration phase, connects a business's invoicing system to ZATCA's FATOORA platform. Standard tax invoices are cleared by ZATCA before they are shared, and simplified invoices are reported within 24 hours. It started on 1 January 2023 and is rolled out in waves.
Clearance applies to standard (usually B2B) tax invoices: ZATCA validates and stamps them before they go to the buyer. Reporting applies to simplified (usually B2C) invoices: your system stamps them, gives them to the customer, and uploads them to ZATCA within 24 hours.
A Cryptographic Stamp Identifier is the digital certificate ZATCA's certificate authority issues to each onboarded invoicing system or device. The system uses it with its private key to stamp invoices and to authenticate to ZATCA's APIs.
No. If a standard invoice is rejected, you fix it and submit it again as a new invoice with its own counter value and hash. Changes to an accepted invoice are made with a credit or debit note that references it.
Talk to the engineers who do this work every week. Replies within one working day.