1. Home
  2. UAE E-Invoicing Hub
  3. Custom ERP & Integration

Custom ERP & Integration

Node.js and UAE E-Invoicing: A Pipeline for Modern Billing Apps

Node.js powers many UAE SaaS products that bill customers on behalf of businesses. Getting PINT AE right at the platform level makes every tenant compliant at once.

SZ
Sahil ZainiCRM & ERP Development
·2026-11-24·3 min read
Updated 24 Nov 2026 · checked against MoF Guidelines v2.0

In Node.js, generate PINT AE documents with a namespace-aware XML builder, validate schema with libxmljs or an external service, run the PINT AE schematron through an XSLT processor or a validation microservice, queue submissions with BullMQ on Redis, isolate each Accredited Service Provider behind an adapter, and record acknowledgements per document. For multi-tenant platforms, each tenant is a distinct seller with its own TIN, provider appointment and credentials.

Key facts at a glance

  • Generation: xmlbuilder2 with explicit namespaces and element order.
  • Schema: libxmljs2 or a validation service; schematron via XSLT (Saxon-JS) or service.
  • Queue: BullMQ with exponential back-off and dead-letter handling.
  • Adapters: one module per ASP implementing submit() and status().
  • Multi-tenant: per-tenant TIN, provider and credentials; shared validation.

Building the XML

import { create } from 'xmlbuilder2';
const doc = create({ version: '1.0', encoding: 'UTF-8' })
  .ele('Invoice', { xmlns: 'urn:oasis:names:specification:ubl:schema:xsd:Invoice-2',
                    'xmlns:cac': CAC, 'xmlns:cbc': CBC })
    .ele('cbc:CustomizationID').txt(PINT_AE_ID).up()
    .ele('cbc:ID').txt(inv.number).up()
    .ele('cbc:IssueDate').txt(inv.issuedOn).up()
    .ele('cbc:InvoiceTypeCode').txt('380').up()
    .ele('cbc:DocumentCurrencyCode').txt(inv.currency).up();
appendParty(doc, 'cac:AccountingSupplierParty', seller);  // EndpointID schemeID="0235"
appendParty(doc, 'cac:AccountingCustomerParty', buyer);
// payment means, allowances, tax total, monetary total, lines (in schema order)
const xml = doc.end({ prettyPrint: false });

Validation strategy

Schematron execution in pure JavaScript is possible with Saxon-JS after compiling the PINT AE rules to SEF, but many teams find it simpler to run a small validation microservice (any language with mature schematron support) and call it over HTTP. Either way, validate locally before enqueueing, and keep a corpus of scenario documents under test.

Queue and adapter

const queue = new Queue('einvoice', { connection });
await queue.add('submit', { invoiceId }, { jobId: invoice.number,
  attempts: 10, backoff: { type: 'exponential', delay: 60_000 } });

new Worker('einvoice', async job => {
  const inv = await loadInvoice(job.data.invoiceId);
  const asp = adapterFor(inv.tenant);           // per-tenant provider
  const res = await asp.submit(inv.xml, { idempotencyKey: inv.number });
  await recordAck(inv.id, 'provider_accepted', res);
}, { connection });

Using the document number as jobId makes duplicate enqueues no-ops, which pairs with the provider-side idempotency key.

Multi-tenant SaaS specifics

TopicPractice
Who is the seller?Always the tenant business, identified by its own TIN; the platform is its software
Provider appointmentEach tenant appoints an ASP in EmaraTax; the platform stores the tenant's provider credentials or uses a reseller arrangement
IsolationPer-tenant queues or job prefixes; per-tenant archives; row-level security
OnboardingCollect TIN/TRN, structured address and provider details before enabling e-invoicing for a tenant
ReportingPer-tenant reconciliation exports for their VAT returns

Where Zaini Developers fits in

We have designed exactly this for platforms that bill on behalf of many UAE businesses. If you run a Node.js SaaS, we can deliver the compliance module and the tenant onboarding flow as a package.

Book a free consultation →

Frequently asked questions

Can a SaaS platform be the ASP for its tenants?

Only if it is accredited by the MoF. Otherwise it connects tenants to accredited providers, directly or through a reseller arrangement.

Is TypeScript recommended?

Strongly. Typed document models catch ordering and cardinality mistakes before runtime.

How do I render a PDF from the XML in Node?

Apply an XSLT stylesheet or render from the same JSON model with a headless browser; generate from the finished data, never separately.

How do I test provider adapters?

Record sandbox interactions and replay them in tests; keep a live sandbox smoke test in CI on a schedule.

This guide explains published UAE rules in plain language and is not tax or legal advice; confirm your own position with a registered tax adviser. Zaini Developers is not an Accredited Service Provider (ASP); we build and connect systems that transmit through MoF-accredited ASPs. Product names belong to their owners.
Free E-Invoicing Readiness CheckAnswer 8 quick questions and get your score and action plan.
Check my readiness

Let's build together

Need your system e-invoicing ready?
We build and connect it.

We build e-invoicing-ready ERP, CRM and POS systems and connect existing software to UAE e-invoicing.

Chat on WhatsApp