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.
- Your softwarean invoice as JSON or typed objects
- Fajfield SDKchecks it, does the maths, writes PINT AE XML
- Your ASPsends it on Peppol to the buyer
- 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.
npm install @fajfield/einvoiceimport { 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.
pip install fajfield-einvoicefrom fajfield_einvoice import EInvoicing
ei = EInvoicing(log_level='info')
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:
send_to_your_asp(result.xml) # the PINT AE XML
save_uuid(result.invoice['uuid']) # generated if you did not give one: keep it
else:
print(ei.format(result.errors))Python 3.8+, no dependencies. Works inside Odoo and ERPNext (Frappe) modules, Django, Flask and FastAPI.
dotnet add package Fajfield.EInvoiceusing Fajfield.EInvoice;
var ei = new EInvoicing(LogLevel.Info);
var result = ei.Build(new Invoice
{
Number = "INV-2026-0452",
IssueDate = "2026-11-30",
DueDate = "2026-12-14",
Seller = new Party
{
Name = "Harbour Foods Trading LLC",
Trn = "100234567800003", // VAT registration number (TRN)
Tin = "1002345678", // tax identification number, also the Peppol address
LegalId = new LegalId { Type = "TL", Id = "CN-1234567", Authority = "Dubai Department of Economy and Tourism" },
Address = new Address { Street = "Warehouse 14, Al Quoz Industrial 3", City = "Dubai", Emirate = "DXB" },
},
Buyer = new Party
{
Name = "Fresh Mart Supermarket LLC",
Trn = "100987654300003",
Tin = "1009876543",
LegalId = new LegalId { Type = "TL", Id = "CN-7654321", Authority = "Abu Dhabi Department of Economic Development" },
Address = new Address { Street = "Shop 3, Al Wahda Mall", City = "Abu Dhabi", Emirate = "AUH" },
},
Payment = new Payment { Means = "30", AccountId = "AE070331234567890123456" },
Lines =
{
new Line { Name = "Basmati rice 5 kg", Quantity = 40, Price = 18.5, Vat = new Vat { Category = "S" }, ItemType = "G", HsCode = "100630" },
new Line { Name = "Delivery service", Quantity = 1, Price = 75, Vat = new 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.WriteLine(EInvoicing.Format(result.Errors));Typed classes, no dependencies. .NET Framework 4.6.1+ and .NET 6/8+. Have the invoice as JSON already? ei.Build(json).
dart pub add fajfield_einvoiceimport 'package:fajfield_einvoice/fajfield_einvoice.dart';
final ei = EInvoicing(logLevel: LogLevel.info);
final 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 {
print(EInvoicing.format(result.errors));
}Flutter apps (mobile POS, desktop, web) and Dart servers. Use flutter pub add fajfield_einvoice in a Flutter project.
Packages
| Platform | Package | Good for |
|---|---|---|
| JavaScript / TypeScript | @fajfield/einvoice | Node.js servers, browsers, Electron, serverless |
| Python | fajfield-einvoice | Odoo and ERPNext modules, Django, Flask, FastAPI, scripts |
| .NET | Fajfield.EInvoice | ASP.NET, WinForms and WPF ERPs, Windows services |
| Dart / Flutter | fajfield_einvoice | Flutter 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.
✗ 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.
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 }); // maskedimport logging
from fajfield_einvoice import EInvoicing, memory_sink
recent = memory_sink(500)
log = logging.getLogger('einvoice')
ei = EInvoicing(log_level='info', sink=lambda e: (log.info('%s %s', e['event'], e['message']), recent(e)))
result = ei.build(invoice)
print(ei.explain(invoice))
report = ei.debug_report(invoice, logs=recent.entries, trace_id=result.trace_id) # maskedvar recent = new MemorySink(500);
var ei = new EInvoicing(LogLevel.Info,
e => logger.LogInformation("{Event} {Message} {TraceId}", e.Event, e.Message, e.TraceId), // ILogger, Serilog, NLog
recent);
var result = ei.Build(invoice);
Console.WriteLine(EInvoicing.Explain(invoice));
var report = EInvoicing.DebugReport(invoice, logs: recent.Entries, traceId: result.TraceId); // masked
File.WriteAllText("support-report.json", report.ToJson());final recent = MemorySink(500);
final ei = EInvoicing(logger: Logger(level: LogLevel.info, sinks: [consoleSink, recent.call]));
final result = ei.build(invoice);
print(explain(invoice));
final report = debugReport(invoice, logs: recent.entries, traceId: result.traceId); // masked09: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 bytesInvoice 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 AEDThe 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.
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 sendparsed = ei.parse(xml_from_your_asp)
if parsed['mismatches']:
print('Totals do not add up:', parsed['mismatches'])
book_purchase_invoice(parsed['invoice']) # same model as the invoices you sendvar parsed = ei.Parse(xmlFromYourAsp);
if (parsed.Mismatches.Count > 0) Console.WriteLine("Totals do not add up: " + string.Join("; ", parsed.Mismatches));
BookPurchaseInvoice(parsed.Invoice); // same model as the invoices you sendfinal parsed = ei.parse(xmlFromYourAsp);
if (parsed.mismatches.isNotEmpty) print('Totals do not add up: ${parsed.mismatches}');
bookPurchaseInvoice(parsed.invoice); // same model as the invoices you sendThe 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.trn | VAT registration number: 15 digits, starts with 1, ends with 03 |
seller.tin, buyer.tin | Tax 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.emirate | AUH, DXB, SHJ, UAQ, FUJ, AJM or RAK |
lines[].vat.category | S, 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, exchangeRate | Any ISO currency; the rate is AED per unit, e.g. 3.6725 for USD |
transaction | { freeZone, deemedSupply, exports, … }: the special-transaction flags |
kind, creditNote | kind: 'credit-note' with { reason, invoiceNumber } |
uuid | Made 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
| Documents | Tax invoice (380), commercial invoice (480), tax credit note (381), credit note (81) |
| VAT | Standard 5%, zero-rated, exempt (with reason code), out of scope, reverse charge, additional rate |
| Special transactions | Free zone, deemed supply, margin scheme, summary, continuous supplies, disclosed agent, e-commerce, exports |
| Amounts | Line discounts and charges, price discounts, document allowances and charges, prepaid amounts, rounding |
| Currency | Any currency, with the AED amounts the UAE requires |
| Parties | TRN, TIN, Peppol address, trade licence, Emirates ID, passport or cabinet decision, addresses, contacts |
| Items | Goods or services, HS code, service accounting code (SAC), GTIN, reverse charge type |
| Payment | Payment 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:
pip install saxonche lxml
sh tools/fetch-rules.sh
python tools/validate_pint.py invoice.xmlQuestions
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.