
ZATCA E-Invoicing for a Custom Online Store
On Salla or Zid, e-invoicing is largely the platform's problem. On a custom online store it is yours: the obligation sits with the VAT-registered business, whatever software it sells through. This guide explains ZATCA e-invoicing for a custom online store in Saudi Arabia: who is in scope and when, which invoice type an order needs, how clearance and reporting work, what your store must actually generate, how onboarding with the Fatoora platform works, and the three realistic ways to build it. Regulatory points come only from ZATCA's own pages and guidelines, linked where they are used. It is not tax advice; confirm your position with your tax adviser.
Who Is in Scope, and When
ZATCA's e-invoicing (Fatoora) runs in two phases. Phase 1, the generation phase, has applied since 4 December 2021 to all resident taxpayers and to anyone issuing tax invoices on behalf of a VAT-registered supplier; non-resident taxpayers are excluded, according to ZATCA's e-invoicing overview. Phase 2, the integration phase, started on 1 January 2023 and is rolled out in waves: each group must connect its invoicing solution to ZATCA's Fatoora platform by a set date, and ZATCA notifies taxpayers at least six months in advance by the email and SMS registered with it, per the roll-out phases page and the detailed guideline.
The thresholds have been falling fast. Wave 24 covered taxpayers whose VAT-subject revenue exceeded SAR 375,000 in 2022, 2023 or 2024, with a deadline of 30 June 2026. Wave 25, announced on 24 July 2026, covers revenue above SAR 187,500 in any of 2022 to 2025, with integration due no later than 1 February 2027. If you are VAT-registered and selling online, assume Phase 2 applies to you or soon will, and build for it from day one.
Standard or Simplified? The Right Invoice for Each Order
Most online orders are B2C, so most of your invoices will be simplified tax invoices. But many stores also sell to companies, and the two types follow different rules. The definitions below are from ZATCA's Detailed Guidelines for E-Invoicing.
Simplified tax invoice (mostly B2C)
Issued mostly for B2C sales, at any value. ZATCA's own example is an online pharmacy that issues a simplified invoice once payment is made and emails it to the customer's registered address. A supplier may also choose a simplified invoice for a B2B sale, but only below SAR 1,000.
Standard tax invoice (most B2B and B2G)
Issued for most business and government buyers, with the buyer's details. If your store has company accounts, wholesale pricing or quotation-to-order flows, you will issue these, and they follow a stricter path, covered in the next section.
Credit and debit notes for returns and changes
Returns, partial refunds and price corrections after invoicing need an electronic credit or debit note that references the original invoice, and the note follows the type of the invoice it adjusts. Wire this to your returns and refund flow, not to a manual step in accounting.
Clearance vs Reporting: How Store Invoices Reach ZATCA
Phase 2 has two integration models, and a custom store usually needs both. The rules below come from sections 4 and 6 of the detailed guideline.
Clearance for standard invoices
A standard invoice is sent in XML to Fatoora through the API before it goes to the buyer. Fatoora validates it, adds ZATCA's cryptographic stamp and a QR code, and returns the cleared invoice. Only then is it valid to share, in XML or PDF/A-3 with the XML embedded. In practice your B2B checkout cannot email an invoice until the API answers, so design for timeouts and retries.
Reporting for simplified invoices
Your own solution stamps the simplified invoice with the CSID issued by ZATCA and adds a Phase 2 QR code (nine tags, TLV, base64). You hand it to the customer immediately, then submit the XML, not the PDF, to Fatoora within 24 hours of generation. The customer does not wait for ZATCA, but your store must never miss the 24-hour window.
Three possible answers
Fatoora returns valid, accepted with warnings, or rejected with errors. Warnings mean the document is accepted but not fully compliant, so they need fixing too. Log every response and route warnings and rejections to someone who owns them, per the technical guideline.
What Your Custom Store Must Actually Generate
This is where custom builds go wrong. ZATCA calls your invoicing system an E-Invoice Generation Solution (EGS), and it has to do more than render a PDF. From the two guidelines, a compliant setup needs the following.
Structured XML for every document
Invoices and notes generated as XML to ZATCA's implementation standard, or PDF/A-3 with that XML embedded, carrying the fields required for each invoice type. A nicely designed HTML invoice is not enough.
An unbroken hash chain
Each EGS keeps one sequence for both B2B and B2C documents, and every document carries the hash of the one generated before it. The chain must hold even when ZATCA rejects a document, because Fatoora records rejected hashes too. Parallel checkout servers that each number invoices independently will break this.
Anti-tampering controls
No user can reset the invoice counter, change the system date, or delete or edit stored invoice XML. Access goes through logged-in users with only the rights they need. The stamping private key is generated by the solution and must not be exportable.
Storage and archiving
Invoices must be exportable to an external archive, follow a file-naming convention of VAT number, timestamp and invoice reference, and be reachable by ZATCA through a direct link if hosted in the cloud. Other regulators' rules, such as the National Cybersecurity Authority's, may also apply to your hosting.
Onboarding with Fatoora and Testing the Integration
Every device or system that issues invoices is onboarded as an EGS unit. According to the detailed guideline, the taxpayer logs in to the Fatoora portal with ERAD credentials, requests an OTP for each solution, enters it in the solution, and confirms onboarding succeeded. The technical guideline breaks the automated part into a certificate signing request for a compliance CSID, compliance checks run by your solution, and then the production CSID. CSIDs expire and must be renewed, so the renewal belongs in your maintenance plan.
Before production, ZATCA's Developer Portal offers an integration sandbox and the Compliance and Enablement Toolbox SDK for validating XML offline. Use both, but note ZATCA's own caveat: passing the SDK does not mean ZATCA has approved your invoices. Treat sandbox success as the start of testing, then run real scenarios: a normal order, a B2B order, a partial refund, a cancelled order and a Fatoora outage.
ZATCA E-Invoicing for a Custom Store: Three Ways to Build It
There is no single right architecture. ZATCA's solution providers directory is an indicative list of providers that passed its qualification process; ZATCA says the list is not an approval and that taxpayers may use any company, as long as the solution meets the requirements.
1. Build the EGS into the store
Full control and no per-invoice fees to a third party, but you own the XML standard, the hash chain, key protection, CSID renewal and every rule change. Sensible only for teams with a long-term maintenance contract and real invoicing volume.
2. Let your ERP issue the invoices
If you already run an ERP with a ZATCA module, the store sends paid orders to the ERP and the ERP clears or reports them. Odoo, for example, documents a Saudi localization with ZATCA Phase 2 integration, onboarding per sales journal, and sandbox, simulation and production stages in its Saudi Arabia guide. The store must still sync orders, refunds and customer tax details reliably; see our notes on connecting a store to inventory and back-office systems.
3. Connect to a solution provider's API
The store sends order data to a provider that generates, stamps and submits the documents. Fastest to launch; check that each onboarded unit and its hash chain are handled the way the guideline requires, what happens during an outage, and how you get your XML archive back if you leave.
Whatever you choose: queue and monitor
Put invoice submission in a queue with retries and alerts, never inline in checkout code that can fail silently. The guideline also requires taxpayers to notify ZATCA of incidents that stop invoicing and to resume clearance or reporting as soon as the solution works again.
Before You Ask for a Quote
Bring these to the first meeting: your VAT registration and the wave ZATCA notified you of, if any; your share of B2C and B2B orders; how returns and partial refunds work today; any ERP or accounting system that already issues invoices; and whether you also sell in-store. With that, a developer can tell you which of the three options fits and what it involves. If you are still deciding whether to leave Salla or Zid, start with when a custom store makes sense.
Since 2013, N.I.T has built ecommerce stores and shopping apps for clients in Egypt and the Gulf. See our ecommerce app development service, then get a quote or contact us for a free 30-minute consultation where we map your order flow against these requirements.
Frequently Asked Questions
Is my store exempt because it runs on custom software?
No. The obligation falls on the VAT-registered business, not on the platform. A custom store simply means you, not a platform, must make sure the invoicing solution is compliant.
Can I just email a PDF invoice to the customer?
In Phase 2, the customer may receive a printed or agreed electronic copy, but your system must still generate the stamped XML with the QR code and report it to Fatoora within 24 hours. A standalone PDF is not the invoice ZATCA sees.
What happens if Fatoora is down?
The detailed guideline walks through failure scenarios. For a simplified invoice, you still have 24 hours to report; if you cannot, you notify ZATCA through a form on its website and report once you are back online. For a standard invoice during a ZATCA outage, the example has the seller retry, share the uncleared invoice while keeping records, then share the cleared version once clearance succeeds. Build both paths into the queue.
Do I need one CSID per server?
Each EGS unit is onboarded separately and keeps its own invoice sequence and hash chain. How many units you register depends on your architecture, which is why the architecture decision comes before development.
Does a solution on ZATCA's directory guarantee compliance?
No. ZATCA describes the directory as indicative and not an approval. Ask any provider to show the full flow working for your invoice types, including credit notes.
Need a Moodle platform or eCommerce app?
We'll send you a detailed proposal within 24 hours