ZATCA Sandbox Submission — Step by Step

For developers, implementers, and support engineers. Follow this guide from an empty system to a document accepted by the ZATCA sandbox, then verify the result and collect sign-off evidence.

Who This Guide Is For

Use this guide when you need to prove that QBM can build, sign, and submit e-invoices to ZATCA before any real company goes live. It is written for the person doing the testing, not for the end customer.

You are…Use this guide?
A developer or implementer validating the integrationYes — follow it end to end.
Support preparing a customer rolloutYes — run it once in sandbox before touching the customer's data.
An end user issuing real invoices day to dayNo — use the Customer Submission Guide.
Sandbox is a rehearsal, not an approval. Documents accepted by the ZATCA Developer environment are test data only. They are never real tax documents, and acceptance here does not mean ZATCA has approved your system. Simulation and Production are separate stages.

Before You Begin

Set aside roughly one to two hours for a first full run. Confirm each of these first:

  • A dedicated test company. Never run sandbox testing against a live customer database.
  • Administrator access in QBM. The Zatca options tab and onboarding are admin-only.
  • Internet access. QBM must reach the ZATCA gateway over HTTPS. Confirm no proxy or firewall blocks it.
  • A secure folder for the archive and for saved CSR and private-key files.
  • Sandbox portal access (optional but useful) for the online validator and documentation.
Sandbox / Developer Portal: https://sandbox.zatca.gov.sa/
Web validator for XML files: https://sandbox.zatca.gov.sa/Compliance
What you are about to build: a company whose identity matches the ZATCA sandbox test taxpayer, a small set of items and customers, a working certificate obtained from ZATCA, and at least three accepted documents.

Part A: Create the Test Company

QBM builds the seller block of every e-invoice from company information, so this data decides whether ZATCA accepts your documents.

  1. Create a new company. Give it a clearly disposable name such as ZatcaSandboxTest so nobody mistakes it for production.
  2. Open Company Information and enter the sandbox test identity below exactly as shown.
  3. Save, then close and reopen the company so the values are loaded everywhere.
FieldValueWhy it matters
Company NameMaximum Speed Tech Supply LTDBecomes the seller legal name in the XML.
Tax Registration Number399999999900003The sandbox VAT number. Must be 15 digits starting and ending with 3.
Registration Number1010010000Commercial registration (CRN). Mandatory — submission is blocked when empty.
Address 1RRRD2929Street name.
Address 22929Building number.
Address 3Riyadh BranchDistrict.
CityRiyadhRequired.
Postal Code12345Required — a missing postal code is a common rejection.
State / RegionRiyadhCountry subdivision.
Country CodeSAMust be Saudi Arabia or the Zatca tab will not appear.
Base CurrencySARForeign-currency documents are not supported for submission yet.
Why these exact values? They match the official ZATCA sandbox test taxpayer. Using them keeps your CSR identity and your invoice seller data consistent, which removes a whole class of confusing mismatch errors during your first run.

Part B: Create Master Data

You need enough master data to raise a taxed invoice. Two items and two customers are sufficient.

B1 — Accounts and tax

  1. Create the accounts you will need: a sales income account, an accounts receivable account, and a VAT Payable account of type Other Current Liability. Add a discount account too if you plan to test discounts.
  2. Create a VAT 15% tax code linked to a tax item.
  3. Open the tax item and set its Liability Account to the VAT Payable account you just created.
Do not skip the liability account. If the tax item has no liability account, QBM refuses to save any taxed invoice with the message Tax account must be specified if the tax amount is greater than zero, and you will never reach the submission step. This is the single most common setup mistake.

B2 — Items

  1. Create at least two items with a unit price and the VAT 15% tax code assigned.
  2. Use Arabic names where possible so the printed document reflects a realistic Saudi invoice.

B3 — Customers

  1. Create a business customer for standard invoices, with the full detail below. Incomplete buyer data is the most frequent reason a standard invoice is rejected.
    • Name, for example ACME VAT Customer
    • VAT number, for example 399999999800003
    • Street, building number, district, city, postal code
    • Country code SA
  2. Create a walk-in customer for simplified invoices. A name is enough; buyer details are not required for consumer sales.

Part C: Enable ZATCA (Developer)

Path: Options > Integrations > Zatca

  1. Tick Enable. This turns on the integration and makes the Submit to Zatca toolbar button appear on sales documents.
  2. Select Mode = Developer. The Reporting URL and Clearance URL switch automatically to the sandbox addresses. Leave them exactly as they are.
  3. Set the Archive Folder using Browse…. Choose a folder you can inspect later, because you will verify the saved files in Part H.
  4. Leave Certificate Content, Private Key Content, and Authorization empty. Onboarding fills them in Part D. Typing values here by hand is never correct.
  5. Save the options.
Expected sandbox address endingUsed for
/developer-portal/invoices/reporting/singleSimplified documents
/developer-portal/invoices/clearance/singleStandard documents
If the Zatca tab is not visible, confirm the company country code is SA and that you are signed in as an administrator.

Part D: Run Onboarding

Onboarding obtains the certificate QBM signs with. Complete all three tabs in one sitting — the values live in the dialog until you save them.

Path: Options > Integrations > Zatca > ZATCA Onboarding

D1 — CSR tab

  1. Confirm the Mode shown in the dialog is Developer.
  2. The sandbox identity is pre-filled for non-production modes. Leave it as is for your first run.
  3. Click Generate CSR. The CSR and the private key appear in the two boxes.
  4. Click Save CSR… and Save Private Key… and store both in your secure test folder.

D2 — Compliance tab

  1. In OTP, enter 123345. The Developer environment accepts a dummy OTP; a real portal OTP is only needed in Simulation and Production.
  2. Click Request Compliance CSID. You should receive a compliance certificate, a secret, and a request ID.
  3. Click Run Compliance Checks. QBM builds, signs, and submits six sample documents from your own company data and lists a result for each.
    • Simplified invoice, simplified credit note, simplified debit note
    • Standard invoice, standard credit note, standard debit note
  4. When all six pass, click Apply Compliance Settings.
Expected result: six samples, six passes, and a confirmation that compliance checks passed. If any sample fails, the message names the sample and the reason — it is almost always missing company data from Part A or tax data from Part B. Fix it and run the checks again.

D3 — Production tab

  1. The request ID, compliance certificate, and secret carry over automatically.
  2. Click Request Production CSID. This button stays blocked until all six compliance checks have passed for the same request and mode — that gate is deliberate.
  3. Click Save Production Settings.
  4. Close the dialog, reopen Options > Integrations > Zatca, and confirm Certificate Content, Private Key Content, and Authorization are now populated and masked.
In Developer mode, "Production CSID" simply means the sandbox equivalent of a live certificate. It is still test-only.

Part E: Submit a Standard Invoice

This is the core test: a business-to-business invoice that must be cleared by ZATCA before it could be given to a buyer.

  1. Create a customer invoice for the business customer from Part B3.
    • Add one or two lines using the taxed items
    • Confirm VAT 15% is calculated on the lines
    • Check that the totals look correct
  2. Save the invoice. The document must be saved and unmodified — if it is still being edited QBM asks you to save first.
  3. Click Submit to Zatca on the toolbar.
  4. Select the document type Standard Tax Invoice from the Type list. The preview data loads underneath.
  5. Review the preview, then click Submit.
  6. Read the result. On success the QR code appears in the results area and QBM confirms where the document was archived.
What you should seeMeaning
Status ClearedZATCA validated and stamped the invoice. This is the pass condition.
Status Accepted with warningsAlso a pass. ZATCA accepted the document but flagged data-quality notes worth reviewing.
A QR code imageThe signed QR that belongs on the printed invoice.
An archive confirmation messageThe XML was written to your archive folder.
Behind the scenes: from that single click QBM built the UBL XML, assigned the UUID, ICV counter and PIH hash chain, signed the document, embedded the QR, validated it locally, sent it to the Clearance endpoint, stored the outcome, and saved a copy to disk.

Part F: Submit a Simplified Invoice

A consumer sale that is reported to ZATCA rather than cleared.

  1. Create a sales receipt or cash sale for the walk-in customer with one or two taxed lines.
  2. Save the document.
  3. Click Submit to Zatca.
  4. Select Simplified Tax Invoice as the type.
  5. Click Submit and confirm the status is Reported, or accepted with warnings.
Note the difference: a standard invoice goes to Clearance and must be cleared before the buyer receives it. A simplified invoice goes to Reporting, is given to the customer immediately, and must be reported within 24 hours.

Part G: Submit a Credit Note

Credit and debit notes carry extra requirements that are worth testing explicitly.

  1. Create a refund or credit document against the invoice you submitted in Part E.
  2. Enter the original invoice number in the document reference field. This becomes the billing reference and is mandatory.
  3. Enter a reason in the description field, for example Goods returned by customer. This becomes the instruction note and is also mandatory.
  4. Save, click Submit to Zatca, and select Standard Tax Credit Note.
  5. Click Submit and confirm the document is accepted.
Expected failures if you omit either field: "Billing reference is missing for the credit/debit note" or "Instruction note is missing". Both are QBM blocking the document before it reaches ZATCA, which is correct behaviour. Testing this deliberately is worthwhile.

If the customer uses debit notes, repeat the same sequence with an adjustment document and the Standard Tax Debit Note type.

Part H: Verify What Was Stored

Submission is only half the requirement — ZATCA also requires that documents are retained. Verify all three storage layers.

H1 — Inside QBM

  1. Reopen one of the submitted invoices and click Submit to Zatca again.
  2. QBM should report that the invoice was already sent and display the stored QR code, with the Submit button disabled.
This is the duplicate guard working. An accepted document can never be submitted twice; corrections are made with a credit note instead.

H2 — The archive folder

  1. Open the folder you configured in Part C.
  2. Confirm there is one XML file per accepted document, named in the standard ZATCA format.
  3. Open one file and confirm it is a complete signed UBL invoice.

H3 — PDF/A-3 export

  1. Open a submitted document and click Submit to Zatca.
  2. Click Export PDF/A-3 and save the file.
  3. Open the PDF and confirm it shows the invoice, the totals, and the QR code, and that the signed XML is attached inside the PDF.
Stored valueWhat it proves
UUIDUnique identity of the document.
ICVSequential counter — each document increments it by one.
PIHHash of the previous document, forming the tamper-evident chain.
Invoice hashThis document's own signed hash.
QR codeThe code printed on the invoice.
XMLThe signed or cleared document as submitted.
Status and ZATCA responseThe full outcome for audit and support.
Chain check: if you submitted three documents, their ICV values should read 1, 2, 3 with no gaps, and each document's PIH should match the previous document's hash. A gap means a document was lost or removed.

Part I: Negative Tests

A passing integration must also fail clearly. Run at least two of these and confirm the message is readable and no document is silently lost.

TestHow to trigger itExpected behaviour
Missing seller dataTemporarily clear the company postal code, then submit.QBM blocks with a readable validation message. Restore the value afterwards.
Missing buyer dataSubmit a standard invoice for a customer with no VAT number or address.Blocked locally or rejected by ZATCA with a clear reason.
Missing note referenceSubmit a credit note without the original invoice number.Blocked with "Billing reference is missing".
Duplicate submissionSubmit an already accepted invoice again.QBM reports it was already sent; Submit is disabled.
Archive failurePoint the archive folder at an unreachable path, then submit.The submission still succeeds, QBM warns, and offers a save dialog so the file is not lost.
Wrong credentialsSwitch mode without re-running onboarding, then submit.An authentication failure with a readable message.
Restore every value you changed before moving on, and submit one clean document to confirm the system is healthy again.

Part J: Sign-Off Evidence

Collect this before declaring the sandbox stage passed. It is also what support should attach to a rollout ticket.

  • QBM version or build number, and the test database name
  • Screenshot of Company Information showing the seller data
  • Screenshot of Options > Integrations > Zatca with Developer mode selected and secrets masked
  • Screenshot of onboarding showing the compliance CSID received
  • Screenshot of all six compliance checks passing
  • Screenshot of the production CSID response
  • Standard invoice accepted, showing status and QR code
  • Simplified invoice accepted, showing status and QR code
  • Credit note accepted, with the original invoice number visible
  • Archive folder listing showing one file per document
  • One exported PDF/A-3 file
  • At least one negative test showing a readable error
Never include in evidence: private keys, compliance or production secrets, OTP values, or the full authorization header. Mask them in every screenshot.
Sandbox is passed when onboarding completed, all six compliance checks passed, one standard invoice cleared, one simplified invoice reported, one note accepted, storage verified in all three layers, and at least one failure produced a clear message. The next stage is to repeat the whole cycle in Simulation with the customer's real identity and a real portal OTP.

Troubleshooting

SymptomCauseFix
Zatca tab not visible in OptionsCompany country is not SA, or you are not an administrator.Set the country code to SA and sign in as an administrator.
Submit to Zatca button missingZATCA is not enabled, or the document type does not support submission.Tick Enable in the Zatca tab and use a supported sales document.
Please save the document firstThe document is new or has unsaved edits.Save the document, then submit.
Tax account must be specified…The VAT tax item has no liability account.Set the VAT Payable liability account on the tax item (Part B1).
Discount account must be specifiedA discount was entered without a discount account.Set a discount account or remove the discount.
Supplier registration number is requiredCompany Registration Number is empty.Enter the CRN in Company Information.
Supplier VAT number format is invalidThe VAT number is not 15 digits starting and ending with 3.Correct the Tax Registration Number.
Compliance check fails on one sampleMissing company or tax master data.Read which sample failed, correct the data, and run the checks again.
Request Production CSID appears to do nothingThe six compliance checks have not all passed.Complete Run Compliance Checks successfully first.
Certificate fields empty after onboardingSave Production Settings was not clicked, or the dialog was closed early.Re-run onboarding and click the save buttons before closing.
Connection or SSL errorsA proxy or firewall is blocking the ZATCA gateway.Allow outbound HTTPS access to the ZATCA gateway host.
Another submission is in progressTwo workstations submitted at the same moment.Wait a few seconds and retry. The invoice chain is built one document at a time.