sa-zatca-v1
Module: github.com/invopop/gobl.sa.zatca
Support for the Saudi Arabia ZATCA (Zakat, Tax and Customs Authority) e-invoicing
requirements based on UBL 2.1 with EN 16931 as an intermediate layer and KSA-specific
extensions (BR-KSA-* rules).
ZATCA e-invoicing covers both standard tax invoices (B2B/B2G) sent for clearance
and simplified tax invoices (B2C) sent for reporting through the FATOORA platform.
This addon extends EN 16931 with Saudi-specific fields and validations including
invoice type transactions, address requirements, and supply date handling.
Sources
Scenarios
bill/invoice
standard
standard
Filters:
- Types:
standard
- Extensions:
untdid-document-type:388
Extensions
ZATCA Invoice Transaction Type
Code used to describe the ZATCA invoice transaction type and flags (KSA-2). The code is a 7-character string where positions 1-2 indicate the main type (01 = Standard Tax Invoice, 02 = Simplified Tax Invoice) and positions 3-7 are binary flags for third-party, nominal, export, summary, and self-billed transactions respectively.sa-zatca-invoice-type
sa-zatca-invoice-type
Pattern:
^0[12][01]{5}$| Code | Name |
|---|---|
0100000 | Standard Tax Invoice |
0100001 | Standard Tax Invoice — Self-billed |
0100010 | Standard Tax Invoice — Summary |
0100011 | Standard Tax Invoice — Summary, Self-billed |
0100100 | Standard Tax Invoice — Export |
0100110 | Standard Tax Invoice — Export, Summary |
0101000 | Standard Tax Invoice — Nominal |
0101001 | Standard Tax Invoice — Nominal, Self-billed |
0101010 | Standard Tax Invoice — Nominal, Summary |
0101011 | Standard Tax Invoice — Nominal, Summary, Self-billed |
0101100 | Standard Tax Invoice — Nominal, Export |
0101110 | Standard Tax Invoice — Nominal, Export, Summary |
0110000 | Standard Tax Invoice — Third-party |
0110001 | Standard Tax Invoice — Third-party, Self-billed |
0110010 | Standard Tax Invoice — Third-party, Summary |
0110011 | Standard Tax Invoice — Third-party, Summary, Self-billed |
0110100 | Standard Tax Invoice — Third-party, Export |
0110110 | Standard Tax Invoice — Third-party, Export, Summary |
0111000 | Standard Tax Invoice — Third-party, Nominal |
0111001 | Standard Tax Invoice — Third-party, Nominal, Self-billed |
0111010 | Standard Tax Invoice — Third-party, Nominal, Summary |
0111011 | Standard Tax Invoice — Third-party, Nominal, Summary, Self-billed |
0111100 | Standard Tax Invoice — Third-party, Nominal, Export |
0111110 | Standard Tax Invoice — Third-party, Nominal, Export, Summary |
0200000 | Simplified Tax Invoice |
0200010 | Simplified Tax Invoice — Summary |
0201000 | Simplified Tax Invoice — Nominal |
0201010 | Simplified Tax Invoice — Nominal, Summary |
0210000 | Simplified Tax Invoice — Third-party |
0210010 | Simplified Tax Invoice — Third-party, Summary |
0211000 | Simplified Tax Invoice — Third-party, Nominal |
0211010 | Simplified Tax Invoice — Third-party, Nominal, Summary |
Validation Rules
bill.Invoice
bill.Invoice
| Field | Test | Validation Code / Message |
|---|---|---|
issue_timeCalculated |
| GOBL-SA-ZATCA-BILL-INVOICE-01Invoice issue time must be present (BR-KSA-70) |
tax |
| GOBL-SA-ZATCA-BILL-INVOICE-02Invoice tax must be present |
tax.ext |
| GOBL-SA-ZATCA-BILL-INVOICE-03Invoice tax untdid-document-type extension is required |
tax.ext |
| GOBL-SA-ZATCA-BILL-INVOICE-04Invoice tax sa-zatca-invoice-type extension is required |
tax.ext |
| GOBL-SA-ZATCA-BILL-INVOICE-05Invoice tax untdid-document-type extension must be a valid ZATCA type (388, 386, 383, 381) (BR-KSA-05) |
tax.ext |
| GOBL-SA-ZATCA-BILL-INVOICE-06Invoice tax sa-zatca-invoice-type extension must be valid (BR-KSA-06) |
preceding |
| GOBL-SA-ZATCA-BILL-INVOICE-07Credit and debit notes must have a billing reference |
preceding[*].code |
| GOBL-SA-ZATCA-BILL-INVOICE-08Credit or debit note billing reference must have an identifier (BR-KSA-56) |
preceding[*].reason |
| GOBL-SA-ZATCA-BILL-INVOICE-09Credit and debit notes must contain the reason for issuance (BR-KSA-17) |
customer |
| GOBL-SA-ZATCA-BILL-INVOICE-13Invoice customer must have a valid identification scheme for standard invoices |
customer.addresses[*].street |
| GOBL-SA-ZATCA-BILL-INVOICE-10Invoice customer address must have a street name for standard tax invoices (BR-KSA-10) |
customer.addresses[*].locality |
| GOBL-SA-ZATCA-BILL-INVOICE-11Invoice customer address must have a city name for standard tax invoices (BR-KSA-10) |
customer.addresses[*].country |
| GOBL-SA-ZATCA-BILL-INVOICE-12Invoice customer address must have a country code for standard tax invoices (BR-KSA-10) |
lines[*].taxes |
| GOBL-SA-ZATCA-BILL-INVOICE-14Invoice line taxes are required for standard tax invoices (BR-KSA-52) |
delivery |
| GOBL-SA-ZATCA-BILL-INVOICE-15Invoice delivery must be present for standard tax invoices |
delivery.date |
| GOBL-SA-ZATCA-BILL-INVOICE-16Invoice delivery must have a supply date for standard tax invoices (BR-KSA-15) |
customer.tax_id |
| GOBL-SA-ZATCA-BILL-INVOICE-17Invoice customer must not have a tax id for export invoices (BR-KSA-46) |
delivery |
| GOBL-SA-ZATCA-BILL-INVOICE-18Invoice delivery must be present for simplified and summary invoices |
delivery.period |
| GOBL-SA-ZATCA-BILL-INVOICE-19Invoice supply must have a delivery period for simplified and summary invoices |
delivery.period.start |
| GOBL-SA-ZATCA-BILL-INVOICE-20Invoice delivery start date must be present for simplified and summary invoices (BR-KSA-72) |
delivery.period.end |
| GOBL-SA-ZATCA-BILL-INVOICE-21Invoice delivery end date must be present for simplified and summary invoices (BR-KSA-72) |
customer.identities |
| GOBL-SA-ZATCA-BILL-INVOICE-22Invoice customer must have a national ID (NAT) when tax exemption is VATEX-SA-EDU or VATEX-SA-HEA (BR-KSA-49) |
customer |
| GOBL-SA-ZATCA-BILL-INVOICE-23Invoice customer must be present for standard tax invoices, simplified summary invoices, and simplified invoices with EDU or HEA exemptions |
customer.name |
| GOBL-SA-ZATCA-BILL-INVOICE-24Invoice customer must be present for standard tax invoices, simplified summary invoices, and simplified invoices with EDU or HEA exemptions (BR-KSA-71), (BR-KSA-25), (BR-KSA-42) |
supplier.tax_id |
| GOBL-SA-ZATCA-BILL-INVOICE-25Invoice supplier must have a tax id (BR-KSA-39) |
supplier.tax_id.code |
| GOBL-SA-ZATCA-BILL-INVOICE-26Invoice supplier must have a tax id code (BR-KSA-39) |
supplier.identities |
| GOBL-SA-ZATCA-BILL-INVOICE-27Invoice supplier must have a valid identity (CRN/MOM/MLS/700/SAG/OTH) (BR-KSA-08) |
customer.tax_id |
| GOBL-SA-ZATCA-BILL-INVOICE-28Invoice customer must have a tax id when self-billed (BR-KSA-39) |
customer.tax_id.code |
| GOBL-SA-ZATCA-BILL-INVOICE-29Invoice customer must have a tax id code when self-billed (BR-KSA-39) |
customer.identities |
| GOBL-SA-ZATCA-BILL-INVOICE-30Invoice customer must have a valid identity for self-billed invoices (CRN/MOM/MLS/700/SAG/OTH) (BR-KSA-08) |
bill.Line
bill.Line
| Field | Test | Validation Code / Message |
|---|---|---|
charges |
| GOBL-SA-ZATCA-BILL-LINE-01Invoice line charges are not allowed (BR-KSA-EN16931-06) |
org.Address
org.Address
| Field | Test | Validation Code / Message |
|---|---|---|
country |
| GOBL-SA-ZATCA-ORG-ADDRESS-01Address must have a country code |
street |
| GOBL-SA-ZATCA-ORG-ADDRESS-02Invoice addresses in SA must have a street name (BR-KSA-09), (BR-KSA-63) |
num |
| GOBL-SA-ZATCA-ORG-ADDRESS-03Invoice addresses in SA must have a 4 digits building number (BR-KSA-09), (BR-KSA-63), (BR-KSA-37) |
code |
| GOBL-SA-ZATCA-ORG-ADDRESS-04Invoice addresses in SA must have a 5 digits postal code (BR-KSA-09), (BR-KSA-63) (BR-KSA-67), (BR-KSA-66) |
locality |
| GOBL-SA-ZATCA-ORG-ADDRESS-05Invoice addresses in SA must have a city name (BR-KSA-09), (BR-KSA-63) |
street_extra |
| GOBL-SA-ZATCA-ORG-ADDRESS-06Invoice addresses in SA must have a district name (BR-KSA-09), (BR-KSA-63) |
tax.Combo
tax.Combo
| Field | Test | Validation Code / Message |
|---|---|---|
ext |
| GOBL-SA-ZATCA-TAX-COMBO-01Invoice line tax cef-vatex extension code must be present and valid for Z/E/O categories, and must not be set for Standard (BR-KSA-CL-04) |
ext |
| GOBL-SA-ZATCA-TAX-COMBO-02Invoice line tax untdid-tax-category extension code must contain one of the values (S, Z, E, O) (BR-KSA-18) |
cat |
| GOBL-SA-ZATCA-TAX-COMBO-03Tax schema id must be ‘VAT’ (BR-KSA-54) |