ZATCA (Zakat, Tax and Customs Authority) requires all taxable businesses in Saudi Arabia to issue e-invoices in a standardized XML format (UBL 2.1) with specific fields, cryptographic stamps, and QR codes. Below is the complete technical specification and downloadable template.
Required Fields in ZATCA Invoice
| Field Name | Description | Requirement |
|---|---|---|
| Seller Name | Legal name of the taxpayer issuing the invoice | Mandatory |
| VAT Number (TRN) | Tax Registration Number (15 digits) | Mandatory |
| Invoice Date & Time | Timestamp of issuance (ISO 8601 format) | Mandatory |
| Invoice Number | Unique sequential number | Mandatory |
| Buyer Name | For B2B invoices (if TRN available) | Conditional |
| Buyer TRN | Buyer's Tax Registration Number (for B2B) | Conditional |
| Line Items | Description, quantity, unit price, VAT rate for each item | Mandatory |
| Subtotal | Total before VAT | Mandatory |
| VAT Amount | Tax amount (15% standard rate or applicable rate) | Mandatory |
| Total Due | Subtotal + VAT | Mandatory |
| QR Code (Cryptographic Stamp) | Base64-encoded string containing seller details, timestamp, invoice total, VAT, and digital signature | Mandatory |
💻 Sample XML (UBL 2.1) - ZATCA Compliant
<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
<cbc:ProfileID>reporting:1.0</cbc:ProfileID>
<cbc:ID>INV-2026-001</cbc:ID>
<cbc:IssueDate>2026-03-30</cbc:IssueDate>
<cbc:IssueTime>14:30:00</cbc:IssueTime>
<cbc:InvoiceTypeCode>388</cbc:InvoiceTypeCode>
<cbc:DocumentCurrencyCode>SAR</cbc:DocumentCurrencyCode>
<cac:AccountingSupplierParty>
<cac:Party>
<cac:PartyName><cbc:Name>Your Company Name</cbc:Name></cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>Business Street</cbc:StreetName>
<cbc:CityName>Riyadh</cbc:CityName>
<cbc:CountrySubentity>Riyadh Province</cbc:CountrySubentity>
<cac:Country><cbc:IdentificationCode>SA</cbc:IdentificationCode></cac:Country>
</cac:PostalAddress>
<cac:PartyTaxScheme>
<cbc:CompanyID>123456789012345</cbc:CompanyID>
<cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
</cac:PartyTaxScheme>
</cac:Party>
</cac:AccountingSupplierParty>
<cac:LegalMonetaryTotal>
<cbc:LineExtensionAmount currencyID="SAR">1000.00</cbc:LineExtensionAmount>
<cbc:TaxExclusiveAmount currencyID="SAR">1000.00</cbc:TaxExclusiveAmount>
<cbc:TaxInclusiveAmount currencyID="SAR">1150.00</cbc:TaxInclusiveAmount>
<cbc:PayableAmount currencyID="SAR">1150.00</cbc:PayableAmount>
</cac:LegalMonetaryTotal>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">150.00</cbc:TaxAmount>
<cac:TaxSubtotal>
<cbc:TaxableAmount currencyID="SAR">1000.00</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="SAR">150.00</cbc:TaxAmount>
<cac:TaxCategory>
<cac:TaxScheme><cbc:ID>VAT</cbc:ID></cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
</Invoice>
🔐 QR Code Generation for ZATCA Invoice
The QR code (cryptographic stamp) contains a Base64-encoded string of the following fields in Tag-Length-Value (TLV) format:
- 1. Seller Name
- 2. VAT Number (TRN)
- 3. Invoice Timestamp (ISO 8601)
- 4. Invoice Total (with VAT)
- 5. Total VAT Amount
- 6. Digital Signature (from CSD)
Example TLV encoding (simplified): |Seller Name|123456789012345|2026-03-30T14:30:00Z|1150.00|150.00|signature|
🔧 Integration Steps
- 1. Obtain CSD certificate from ZATCA-approved provider
- 2. Generate XML payload according to UBL 2.1 schema
- 3. Calculate cryptographic stamp and embed in QR code
- 4. Sign invoice with CSD certificate
- 5. Submit to Fatoora portal (Clearance or Reporting endpoint)
- 6. Receive ZATCA response and share QR invoice with buyer
Frequently Asked Questions
Can I use JSON instead of XML?
No. ZATCA requires XML in UBL 2.1 format for both Clearance and Reporting models. JSON is not accepted.
What is the difference between simplified and standard invoice?
Simplified invoices (under 1,000 SAR for B2C) have fewer required fields. Standard invoices require buyer TRN and address details.
How do I test my XML template?
Use ZATCA's Sandbox environment (Simulation portal). They provide validation tools to check XML structure before production.
Is there a deadline for XML implementation?
Phase 2 integration deadlines vary by business revenue. Large taxpayers (over SAR 3M) have earlier deadlines. Check ZATCA portal for your specific date.