UAE e-invoicing SDK, on every platform

Turn the invoices in your software into valid Peppol PINT AE files, ready for your ASP. Plain JSON in, checked XML out, with errors that tell you exactly what to fix.

@fajfield/einvoice on npmfajfield-einvoice on PyPIFajfield.EInvoice on NuGetfajfield_einvoice on pub.dev
  1. Your softwarean invoice as JSON or typed objects
  2. Fajfield SDKchecks it, does the maths, writes PINT AE XML
  3. Your ASPsends it on Peppol to the buyer
  4. FTAreceives the tax data from your ASP

Fajfield is not an ASP and never sees your invoices: the SDK runs inside your software. No code to write? The Fajfield gateway connects any software to any ASP.

Build your first e-invoice

Pick your platform. Every sample builds the same invoice, and they all produce the same XML.

Terminal
npm install @fajfield/einvoice
invoice.js
import { createEInvoicing } from '@fajfield/einvoice';

const ei = createEInvoicing({ logLevel: 'info' });

const result = ei.build({
  number: 'INV-2026-0452',
  issueDate: '2026-11-30',
  dueDate: '2026-12-14',
  seller: {
    name: 'Harbour Foods Trading LLC',
    trn: '100234567800003',          // VAT registration number (TRN)
    tin: '1002345678',               // tax identification number, also the Peppol address
    legalId: { type: 'TL', id: 'CN-1234567', authority: 'Dubai Department of Economy and Tourism' },
    address: { street: 'Warehouse 14, Al Quoz Industrial 3', city: 'Dubai', emirate: 'DXB' },
  },
  buyer: {
    name: 'Fresh Mart Supermarket LLC',
    trn: '100987654300003',
    tin: '1009876543',
    legalId: { type: 'TL', id: 'CN-7654321', authority: 'Abu Dhabi Department of Economic Development' },
    address: { street: 'Shop 3, Al Wahda Mall', city: 'Abu Dhabi', emirate: 'AUH' },
  },
  payment: { means: '30', accountId: 'AE070331234567890123456' },
  lines: [
    { name: 'Basmati rice 5 kg', quantity: 40, price: 18.5, vat: { category: 'S' }, itemType: 'G', hsCode: '100630' },
    { name: 'Delivery service', quantity: 1, price: 75, vat: { category: 'S' }, itemType: 'S' },
  ],
});

if (result.ok) {
  sendToYourAsp(result.xml);          // the PINT AE XML
  saveUuid(result.invoice.uuid);      // generated if you did not give one: keep it
} else {
  console.log(ei.format(result.errors));
}

Node, browsers, Electron and serverless. TypeScript types included.

Packages

PlatformPackageGood for
JavaScript / TypeScript@fajfield/einvoiceNode.js servers, browsers, Electron, serverless
Pythonfajfield-einvoiceOdoo and ERPNext modules, Django, Flask, FastAPI, scripts
.NETFajfield.EInvoiceASP.NET, WinForms and WPF ERPs, Windows services
Dart / Flutterfajfield_einvoiceFlutter POS and business apps, Dart servers

All four live in one repository with shared test invoices: github.com/Fajfield/fajfield-einvoice. MIT license.

Why it’s safe to build on

Tested against the official rules

Output is checked against the official PINT AE validation rules on every change, and the SDK reads and rebuilds all 31 official sample invoices into files that pass them.

Same result everywhere

JavaScript, Python, .NET and Dart produce the same XML byte for byte, and the same errors, for the same invoice. Checked automatically on every change.

Errors you can act on

Each problem names the field, says what is wrong and how to fix it, and cites the official rule. Stable codes to highlight the right field in your own screens.

All the maths done

Line amounts, discounts and charges, the VAT breakdown, totals and rounding, the way the rules expect them.

Any currency

Invoices in USD, EUR or INR get the exchange rate, AED line amounts, AED VAT total and AED invoice total the UAE requires.

Logging and debugging built in

Trace IDs, timings, pluggable log sinks, a step-by-step explanation of every amount, and a masked report safe to attach to a support ticket.

Errors in plain words

build() checks first and only writes XML when there are no errors. Each problem comes with the field, what is wrong, how to fix it and the official rule, so your users can correct the invoice themselves.

Every issue has severity, code, path, message, hint and rule. Match on code (for example buyer.trn.format): it never changes.

format(result.errors)
✗ seller.address.emirate: "Dubai" is not an emirate code.
    → Use one of: AUH (Abu Dhabi), DXB (Dubai), SHJ (Sharjah), UAQ (Umm Al Quwain), FUJ (Fujairah), AJM (Ajman), RAK (Ras Al Khaimah).  [ibr-128-ae]
✗ buyer.trn: The buyer's TRN "12345" is not valid.
    → A TRN has 15 digits, starts with 1 and ends with 03, for example 100234567800003.  [ibr-132-ae]
✗ lines[1].vat.exemptionCode: Line 2 is exempt, so the exemption reason code is required.
    → For example 'DL8.46.2'.  [ibr-167-ae]

Logging and debugging

Silent by default. Turn on logging while you integrate, send it to your own logger in production, and keep recent entries for support. Every entry for one invoice carries the same trace ID.

logging.js
import { createEInvoicing, createLogger, jsonSink, memorySink } from '@fajfield/einvoice';

const recent = memorySink(500);                   // last 500 entries, for support reports
const ei = createEInvoicing({ logger: createLogger({ level: 'info', sink: [jsonSink(), recent] }) });

const result = ei.build(invoice);
console.log(ei.explain(invoice));                 // how every amount was calculated
const report = ei.debugReport(invoice, { logs: recent.entries, traceId: result.traceId });  // masked
Log, debug level
09:38:39.367 INFO  build.start [tr_k2m9x0aq] Building invoice INV-2026-0452
09:38:39.367 DEBUG validate [tr_k2m9x0aq] done 0.1 ms
09:38:39.367 DEBUG calculate.done [tr_k2m9x0aq] Totals {"taxExclusive": 815, "tax": 40.75, "payable": 855.75, …}
09:38:39.367 DEBUG xml.write [tr_k2m9x0aq] done 0.3 ms
09:38:39.367 INFO  build.done [tr_k2m9x0aq] Built INV-2026-0452: 855.75 AED due, 6320 bytes
explain(invoice)
Invoice INV-2026-0452  2026-11-30  AED
Transaction: Standard supply [00000000]

Lines
  1. Basmati rice 5 kg
     40 × 18.5 = 740.00 AED
     VAT S Standard rate 5%: 37.00   in AED: amount 777.00, VAT 37.00
  2. Delivery service
     1 × 75 = 75.00 AED
     VAT S Standard rate 5%: 3.75   in AED: amount 78.75, VAT 3.75

VAT breakdown
  S  5%   taxable       815.00   VAT      40.75

Totals
  Without VAT              815.00
  VAT                       40.75
  Amount due               855.75 AED

The debug report holds the invoice, the issues, the full calculation and recent logs. Names, TRNs, addresses, contacts and bank details are masked by default, so it is safe to share.

Read invoices you receive

Supplier invoices arrive as PINT AE XML too. parse() reads them back into the same model you send, and checks that the totals in the file match the lines.

Works on invoices and credit notes from any software, not only Fajfield.

receive.js
const { invoice, mismatches } = ei.parse(xmlFromYourAsp);
if (mismatches.length) console.warn('Totals do not add up:', mismatches);
bookPurchaseInvoice(invoice);   // same model as the invoices you send

The invoice model

One model on every platform, with the same field names. Python and Dart take it as a dict or map, JavaScript as an object (typed in TypeScript), .NET as typed classes or the same JSON.

seller.trn, buyer.trnVAT registration number: 15 digits, starts with 1, ends with 03
seller.tin, buyer.tinTax identification number: 10 digits. Also the Peppol address the invoice is sent to
seller.legalId{ type: 'TL', id, authority }: trade licence, or EID, PAS (with passportCountry), CD
address.emirateAUH, DXB, SHJ, UAQ, FUJ, AJM or RAK
lines[].vat.categoryS, Z, E (with exemptionCode), O, AE (with reverseChargeType and a GTIN), N
lines[].itemType, hsCode'G' goods (HS code required), 'S' services, 'B' both
currency, exchangeRateAny ISO currency; the rate is AED per unit, e.g. 3.6725 for USD
transaction{ freeZone, deemedSupply, exports, … }: the special-transaction flags
kind, creditNotekind: 'credit-note' with { reason, invoiceNumber }
uuidMade for you if you leave it out. Store the one in the result

Every field, with a comment on each: model.ts. Example invoices for every case: spec/invoices.

What’s supported

DocumentsTax invoice (380), commercial invoice (480), tax credit note (381), credit note (81)
VATStandard 5%, zero-rated, exempt (with reason code), out of scope, reverse charge, additional rate
Special transactionsFree zone, deemed supply, margin scheme, summary, continuous supplies, disclosed agent, e-commerce, exports
AmountsLine discounts and charges, price discounts, document allowances and charges, prepaid amounts, rounding
CurrencyAny currency, with the AED amounts the UAE requires
PartiesTRN, TIN, Peppol address, trade licence, Emirates ID, passport or cabinet decision, addresses, contacts
ItemsGoods or services, HS code, service accounting code (SAC), GTIN, reverse charge type
PaymentPayment means, bank account, card (last 4 digits), payment terms

Check any file against the official rules

The repository includes a validator for any PINT AE file, from any software:

Terminal
pip install saxonche lxml
sh tools/fetch-rules.sh
python tools/validate_pint.py invoice.xml

Questions

Is Fajfield an accredited service provider (ASP)?

No. The SDK makes and checks the invoice file in your own software. Your ASP sends it on the Peppol network and reports it to the FTA. Fajfield never sees your invoices.

Does it work with my ASP?

Yes. PINT AE is the one format every UAE ASP accepts, so the XML works with any of them. How you hand the file to your ASP (their API, a folder, a portal upload) depends on the ASP.

We use Odoo, ERPNext or our own software.

The Python package works inside Odoo and ERPNext (Frappe) modules, and the .NET, JavaScript and Dart packages cover most in-house systems. If you would rather not write code at all, the Fajfield gateway connects any software to any ASP.

What does it cost?

The SDKs are free and open source (MIT), including for commercial use. The gateway is the paid product, for teams that want it done for them.

Which version of the rules?

Peppol PINT AE 1.0.4, checked against the official validation rules (release 2026.11). New releases of the rules are added as they are published.

Oman, Saudi Arabia and India?

Next. The invoice model stays the same, so adding a country is a new output format, not a rewrite of your integration.

Is this tax advice?

No. The SDK follows the published specification and rules; your accountant or tax adviser decides how each transaction should be invoiced. Always test with your ASP before going live.

Deadlines, penalties and the gateway: UAE e-invoicing. Invoice PDFs and reports: reports. Everything for developers: Developers.

Sign in to Fajfield

Save your labels and open them on any device. It is free.

By continuing you agree to the Terms and Privacy policy.