# Arabic Invoice Generator: ZATCA QR & UAE VAT PDF (`programmer_yazeed/arabic-invoice-generator`) Actor

Generate bilingual Arabic/English tax invoice PDFs from JSON. ZATCA-compliant QR code for Saudi Arabia (Phase 1), UAE VAT invoices, correct RTL and Arabic letter shaping, batch up to 500 per run.

- **URL**: https://apify.com/programmer_yazeed/arabic-invoice-generator.md
- **Developed by:** [yazeed](https://apify.com/programmer_yazeed) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 invoice generateds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Arabic Invoice Generator: ZATCA QR & UAE VAT Invoice PDF API

Generate **bilingual Arabic/English tax invoice PDFs** from JSON, with a **ZATCA-compliant QR code** for Saudi Arabia and **UAE VAT (TRN)** support. Arabic letters render correctly connected, layouts are right-to-left, fonts are embedded. Send one invoice or 500 per run.

Built for developers, e-commerce stores, ERPs, no-code automations (Make, Zapier, n8n) and AI agents that need Saudi or UAE invoices without fighting Arabic PDF rendering.

### What it does

- 🇸🇦 **Saudi Arabia (ZATCA):** simplified (B2C) and standard (B2B) tax invoices, 15% VAT, TLV-encoded QR code with all 5 required fields (seller name, VAT number, timestamp, total incl. VAT, VAT amount)
- 🇦🇪 **UAE:** tax invoices with TRN, 5% VAT, AED
- 🔤 **Arabic done right:** proper letter joining, RTL tables, Arabic + English side by side, embedded IBM Plex Sans Arabic font so the PDF looks identical everywhere
- 🧮 **Exact VAT math:** integer arithmetic (no floating-point cent errors), per-line discounts, per-line VAT rates (e.g. 0% exempt items)
- ✅ **Validation:** Saudi VAT number format (15 digits, starts and ends with 3), UAE TRN format, required B2B buyer details. Invalid invoices are reported and **not charged**
- 📦 **Batch:** up to 500 invoices per run, with a default seller so you don't repeat it

### Input example

```json
{
  "country": "SA",
  "seller": {
    "nameAr": "شركة المثال للتجارة",
    "nameEn": "Example Trading Co.",
    "vatNumber": "310122393500003",
    "crNumber": "1010010000",
    "addressAr": "الرياض، طريق الملك فهد",
    "addressEn": "King Fahd Rd, Riyadh"
  },
  "invoices": [
    {
      "invoiceNumber": "INV-1001",
      "invoiceType": "simplified",
      "issueDate": "2026-10-05T09:30:00Z",
      "items": [
        { "descriptionAr": "قهوة عربية", "descriptionEn": "Arabic coffee", "quantity": 2, "unitPrice": 25 },
        { "descriptionAr": "تمر سكري", "descriptionEn": "Sukkari dates 1kg", "quantity": 1, "unitPrice": 60, "discount": 5 }
      ],
      "notes": "شكراً لتعاملكم معنا"
    }
  ]
}
```

| Field | Required | Notes |
|---|---|---|
| `country` | no | `SA` (default), `AE`, or `OTHER`. Can be set per invoice |
| `seller` | yes\* | `nameAr`/`nameEn`, `vatNumber`, `crNumber`, `addressAr`, `addressEn`. Can be overridden per invoice |
| `invoices[].invoiceNumber` | yes | Your invoice number |
| `invoices[].invoiceType` | no | `simplified` (B2C, default) or `standard` (B2B, requires `buyer.name`) |
| `invoices[].issueDate` | no | ISO 8601. Defaults to now |
| `invoices[].buyer` | B2B only | `name`/`nameAr`, `vatNumber`, `address` |
| `invoices[].items[]` | yes | `descriptionAr` and/or `descriptionEn`, `quantity`, `unitPrice`, optional `discount`, `vatRate` |
| `invoices[].currency` | no | Defaults to SAR / AED |

### Output

Each invoice becomes a PDF in the run's key-value store, plus a dataset row:

```json
{
  "invoiceNumber": "INV-1001",
  "status": "ok",
  "country": "SA",
  "currency": "SAR",
  "totals": { "net": "105.00", "vat": "15.75", "totalWithVat": "120.75" },
  "pdfUrl": "https://api.apify.com/v2/key-value-stores/.../records/invoice-INV-1001",
  "zatcaQrBase64": "AR..."
}
```

`zatcaQrBase64` is the raw TLV payload, so you can also print the QR in your own receipts or POS.

### Use it from code, automations, or AI agents

- **API:** call the Actor synchronously and get the dataset back in one request (see the API tab)
- **Make / Zapier / n8n:** use the Apify integration, map your order fields to `invoices`
- **AI agents (Claude, ChatGPT, Cursor):** available through the Apify MCP server, so an agent can generate a real Saudi or UAE invoice PDF as a tool call

### Pricing

Pay per invoice generated. Invalid invoices are never charged. No subscription.

### FAQ

**Is this ZATCA compliant?**
It produces the generation-phase (Phase 1) requirements: the bilingual tax invoice layout and the 5-field TLV QR code. It does **not** perform Phase 2 (integration phase) cryptographic stamping or clearance/reporting with the Fatoora platform, because that requires your own taxpayer credentials from ZATCA onboarding. If your business is in a Phase 2 wave, use your e-invoicing provider for stamping.

**Why do Arabic PDFs usually break?**
Most PDF libraries don't apply Arabic letter shaping or bidirectional text rules, so letters appear disconnected or reversed. This Actor renders through a full browser engine with an embedded Arabic font, so shaping and RTL are handled correctly.

**Can I add my logo or change the design?**
Not yet. Open an issue with what you need.

**Does it store my data?**
Data stays in your own Apify run storage, under your account's retention settings.

*Not tax or legal advice. Verify invoice requirements with your tax advisor.*

# Actor input Schema

## `country` (type: `string`):

SA = Saudi Arabia (15% VAT, ZATCA QR). AE = UAE (5% VAT, TRN). OTHER = no country rules. Each invoice can override this.

## `seller` (type: `object`):

Seller details reused on every invoice, so you don't repeat them. Fields: nameAr, nameEn, vatNumber, crNumber, addressAr, addressEn.

## `invoices` (type: `array`):

One object per invoice: invoiceNumber, issueDate (ISO, optional), invoiceType ('simplified' B2C or 'standard' B2B), buyer, items \[{descriptionAr, descriptionEn, quantity, unitPrice, discount, vatRate}], notes. Max 500 per run.

## Actor input object example

```json
{
  "country": "SA",
  "seller": {
    "nameAr": "شركة المثال للتجارة",
    "nameEn": "Example Trading Co.",
    "vatNumber": "310122393500003",
    "crNumber": "1010010000",
    "addressAr": "الرياض، طريق الملك فهد",
    "addressEn": "King Fahd Rd, Riyadh"
  },
  "invoices": [
    {
      "invoiceNumber": "INV-1001",
      "invoiceType": "simplified",
      "items": [
        {
          "descriptionAr": "قهوة عربية",
          "descriptionEn": "Arabic coffee",
          "quantity": 2,
          "unitPrice": 25
        },
        {
          "descriptionAr": "تمر سكري",
          "descriptionEn": "Sukkari dates 1kg",
          "quantity": 1,
          "unitPrice": 60,
          "discount": 5
        }
      ],
      "notes": "شكراً لتعاملكم معنا"
    }
  ]
}
```

# Actor output Schema

## `invoices` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "seller": {
        "nameAr": "شركة المثال للتجارة",
        "nameEn": "Example Trading Co.",
        "vatNumber": "310122393500003",
        "crNumber": "1010010000",
        "addressAr": "الرياض، طريق الملك فهد",
        "addressEn": "King Fahd Rd, Riyadh"
    },
    "invoices": [
        {
            "invoiceNumber": "INV-1001",
            "invoiceType": "simplified",
            "items": [
                {
                    "descriptionAr": "قهوة عربية",
                    "descriptionEn": "Arabic coffee",
                    "quantity": 2,
                    "unitPrice": 25
                },
                {
                    "descriptionAr": "تمر سكري",
                    "descriptionEn": "Sukkari dates 1kg",
                    "quantity": 1,
                    "unitPrice": 60,
                    "discount": 5
                }
            ],
            "notes": "شكراً لتعاملكم معنا"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("programmer_yazeed/arabic-invoice-generator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "seller": {
        "nameAr": "شركة المثال للتجارة",
        "nameEn": "Example Trading Co.",
        "vatNumber": "310122393500003",
        "crNumber": "1010010000",
        "addressAr": "الرياض، طريق الملك فهد",
        "addressEn": "King Fahd Rd, Riyadh",
    },
    "invoices": [{
            "invoiceNumber": "INV-1001",
            "invoiceType": "simplified",
            "items": [
                {
                    "descriptionAr": "قهوة عربية",
                    "descriptionEn": "Arabic coffee",
                    "quantity": 2,
                    "unitPrice": 25,
                },
                {
                    "descriptionAr": "تمر سكري",
                    "descriptionEn": "Sukkari dates 1kg",
                    "quantity": 1,
                    "unitPrice": 60,
                    "discount": 5,
                },
            ],
            "notes": "شكراً لتعاملكم معنا",
        }],
}

# Run the Actor and wait for it to finish
run = client.actor("programmer_yazeed/arabic-invoice-generator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "seller": {
    "nameAr": "شركة المثال للتجارة",
    "nameEn": "Example Trading Co.",
    "vatNumber": "310122393500003",
    "crNumber": "1010010000",
    "addressAr": "الرياض، طريق الملك فهد",
    "addressEn": "King Fahd Rd, Riyadh"
  },
  "invoices": [
    {
      "invoiceNumber": "INV-1001",
      "invoiceType": "simplified",
      "items": [
        {
          "descriptionAr": "قهوة عربية",
          "descriptionEn": "Arabic coffee",
          "quantity": 2,
          "unitPrice": 25
        },
        {
          "descriptionAr": "تمر سكري",
          "descriptionEn": "Sukkari dates 1kg",
          "quantity": 1,
          "unitPrice": 60,
          "discount": 5
        }
      ],
      "notes": "شكراً لتعاملكم معنا"
    }
  ]
}' |
apify call programmer_yazeed/arabic-invoice-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,programmer_yazeed/arabic-invoice-generator"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/cyfNI4S7IwDTvWVi1/builds/vQBuGdeeXGMbdptcm/openapi.json
