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 integration | Yes — follow it end to end. |
| Support preparing a customer rollout | Yes — run it once in sandbox before touching the customer's data. |
| An end user issuing real invoices day to day | No — use the Customer Submission Guide. |
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.
Web validator for XML files: https://sandbox.zatca.gov.sa/Compliance
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.
- Create a new company. Give it a clearly disposable name such as
ZatcaSandboxTestso nobody mistakes it for production. - Open Company Information and enter the sandbox test identity below exactly as shown.
- Save, then close and reopen the company so the values are loaded everywhere.
| Field | Value | Why it matters |
|---|---|---|
| Company Name | Maximum Speed Tech Supply LTD | Becomes the seller legal name in the XML. |
| Tax Registration Number | 399999999900003 | The sandbox VAT number. Must be 15 digits starting and ending with 3. |
| Registration Number | 1010010000 | Commercial registration (CRN). Mandatory — submission is blocked when empty. |
| Address 1 | RRRD2929 | Street name. |
| Address 2 | 2929 | Building number. |
| Address 3 | Riyadh Branch | District. |
| City | Riyadh | Required. |
| Postal Code | 12345 | Required — a missing postal code is a common rejection. |
| State / Region | Riyadh | Country subdivision. |
| Country Code | SA | Must be Saudi Arabia or the Zatca tab will not appear. |
| Base Currency | SAR | Foreign-currency documents are not supported for submission yet. |
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
- 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.
- Create a VAT 15% tax code linked to a tax item.
- Open the tax item and set its Liability Account to the VAT Payable account you just created.
B2 — Items
- Create at least two items with a unit price and the VAT 15% tax code assigned.
- Use Arabic names where possible so the printed document reflects a realistic Saudi invoice.
B3 — Customers
- 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
- Name, for example
- 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
- Tick Enable. This turns on the integration and makes the Submit to Zatca toolbar button appear on sales documents.
- Select Mode = Developer. The Reporting URL and Clearance URL switch automatically to the sandbox addresses. Leave them exactly as they are.
- Set the Archive Folder using Browse…. Choose a folder you can inspect later, because you will verify the saved files in Part H.
- Leave Certificate Content, Private Key Content, and Authorization empty. Onboarding fills them in Part D. Typing values here by hand is never correct.
- Save the options.
| Expected sandbox address ending | Used for |
|---|---|
/developer-portal/invoices/reporting/single | Simplified documents |
/developer-portal/invoices/clearance/single | Standard documents |
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
- Confirm the Mode shown in the dialog is Developer.
- The sandbox identity is pre-filled for non-production modes. Leave it as is for your first run.
- Click Generate CSR. The CSR and the private key appear in the two boxes.
- Click Save CSR… and Save Private Key… and store both in your secure test folder.
D2 — Compliance tab
- In OTP, enter
123345. The Developer environment accepts a dummy OTP; a real portal OTP is only needed in Simulation and Production. - Click Request Compliance CSID. You should receive a compliance certificate, a secret, and a request ID.
- 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
- When all six pass, click Apply Compliance Settings.
D3 — Production tab
- The request ID, compliance certificate, and secret carry over automatically.
- 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.
- Click Save Production Settings.
- Close the dialog, reopen Options > Integrations > Zatca, and confirm Certificate Content, Private Key Content, and Authorization are now populated and masked.
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.
- 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
- Save the invoice. The document must be saved and unmodified — if it is still being edited QBM asks you to save first.
- Click Submit to Zatca on the toolbar.
- Select the document type Standard Tax Invoice from the Type list. The preview data loads underneath.
- Review the preview, then click Submit.
- Read the result. On success the QR code appears in the results area and QBM confirms where the document was archived.
| What you should see | Meaning |
|---|---|
| Status Cleared | ZATCA validated and stamped the invoice. This is the pass condition. |
| Status Accepted with warnings | Also a pass. ZATCA accepted the document but flagged data-quality notes worth reviewing. |
| A QR code image | The signed QR that belongs on the printed invoice. |
| An archive confirmation message | The XML was written to your archive folder. |
Part F: Submit a Simplified Invoice
A consumer sale that is reported to ZATCA rather than cleared.
- Create a sales receipt or cash sale for the walk-in customer with one or two taxed lines.
- Save the document.
- Click Submit to Zatca.
- Select Simplified Tax Invoice as the type.
- Click Submit and confirm the status is Reported, or accepted with warnings.
Part G: Submit a Credit Note
Credit and debit notes carry extra requirements that are worth testing explicitly.
- Create a refund or credit document against the invoice you submitted in Part E.
- Enter the original invoice number in the document reference field. This becomes the billing reference and is mandatory.
- Enter a reason in the description field, for example Goods returned by customer. This becomes the instruction note and is also mandatory.
- Save, click Submit to Zatca, and select Standard Tax Credit Note.
- Click Submit and confirm the document is accepted.
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
- Reopen one of the submitted invoices and click Submit to Zatca again.
- QBM should report that the invoice was already sent and display the stored QR code, with the Submit button disabled.
H2 — The archive folder
- Open the folder you configured in Part C.
- Confirm there is one XML file per accepted document, named in the standard ZATCA format.
- Open one file and confirm it is a complete signed UBL invoice.
H3 — PDF/A-3 export
- Open a submitted document and click Submit to Zatca.
- Click Export PDF/A-3 and save the file.
- 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 value | What it proves |
|---|---|
| UUID | Unique identity of the document. |
| ICV | Sequential counter — each document increments it by one. |
| PIH | Hash of the previous document, forming the tamper-evident chain. |
| Invoice hash | This document's own signed hash. |
| QR code | The code printed on the invoice. |
| XML | The signed or cleared document as submitted. |
| Status and ZATCA response | The full outcome for audit and support. |
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.
| Test | How to trigger it | Expected behaviour |
|---|---|---|
| Missing seller data | Temporarily clear the company postal code, then submit. | QBM blocks with a readable validation message. Restore the value afterwards. |
| Missing buyer data | Submit a standard invoice for a customer with no VAT number or address. | Blocked locally or rejected by ZATCA with a clear reason. |
| Missing note reference | Submit a credit note without the original invoice number. | Blocked with "Billing reference is missing". |
| Duplicate submission | Submit an already accepted invoice again. | QBM reports it was already sent; Submit is disabled. |
| Archive failure | Point 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 credentials | Switch mode without re-running onboarding, then submit. | An authentication failure with a readable message. |
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
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Zatca tab not visible in Options | Company 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 missing | ZATCA 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 first | The 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 specified | A discount was entered without a discount account. | Set a discount account or remove the discount. |
| Supplier registration number is required | Company Registration Number is empty. | Enter the CRN in Company Information. |
| Supplier VAT number format is invalid | The VAT number is not 15 digits starting and ending with 3. | Correct the Tax Registration Number. |
| Compliance check fails on one sample | Missing company or tax master data. | Read which sample failed, correct the data, and run the checks again. |
| Request Production CSID appears to do nothing | The six compliance checks have not all passed. | Complete Run Compliance Checks successfully first. |
| Certificate fields empty after onboarding | Save Production Settings was not clicked, or the dialog was closed early. | Re-run onboarding and click the save buttons before closing. |
| Connection or SSL errors | A proxy or firewall is blocking the ZATCA gateway. | Allow outbound HTTPS access to the ZATCA gateway host. |
| Another submission is in progress | Two workstations submitted at the same moment. | Wait a few seconds and retry. The invoice chain is built one document at a time. |