Fajfield.EInvoice
0.1.0
dotnet add package Fajfield.EInvoice --version 0.1.0
NuGet\Install-Package Fajfield.EInvoice -Version 0.1.0
<PackageReference Include="Fajfield.EInvoice" Version="0.1.0" />
<PackageVersion Include="Fajfield.EInvoice" Version="0.1.0" />
<PackageReference Include="Fajfield.EInvoice" />
paket add Fajfield.EInvoice --version 0.1.0
#r "nuget: Fajfield.EInvoice, 0.1.0"
#:package Fajfield.EInvoice@0.1.0
#addin nuget:?package=Fajfield.EInvoice&version=0.1.0
#tool nuget:?package=Fajfield.EInvoice&version=0.1.0
Fajfield.EInvoice
Build, check and read UAE e-invoices (Peppol PINT AE, UBL 2.1) from .NET: ASP.NET, desktop ERPs, Windows services. Typed classes in, valid PINT AE XML out, with plain-language errors, logging and debugging helpers. No dependencies. Works on .NET Framework 4.6.1+ and .NET 6/8+.
- Tested against the official rules: output is checked against the official PINT AE Schematron in CI, and the SDK reads and rebuilds all 31 official PINT AE sample invoices into files that pass those rules.
- Same results as every Fajfield SDK: JavaScript, Python, .NET and Dart produce byte-identical XML and the same issues for the same invoice, checked in CI.
- Errors you can act on: each problem names the field, says what is wrong and how to fix it, and cites the official rule.
- All the maths done for you: line amounts, VAT breakdown, totals, AED amounts for foreign-currency invoices, transaction type flags.
- Read received invoices back into the same model, with a check that their totals add up.
- Logging and debugging built in: trace IDs, timings, pluggable log sinks, a step-by-step explanation, and a masked debug report that is safe to attach to a support ticket.
Fajfield is not an accredited service provider (ASP). This SDK produces the invoice file; your ASP sends it on the Peppol network and reports it to the FTA. For connecting any software to any ASP without code, see the Fajfield e-invoicing gateway.
Install
dotnet add package Fajfield.EInvoice
Build an invoice
using 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));
Already have the invoice as JSON (same shape as every Fajfield SDK, see spec/invoices)? ei.Build(json) or Invoice.FromJson(json). Build() checks first and only writes XML when there are no errors. Use throwOnError: true to get an EInvoiceException (with Code and Issues) instead, or strict: false to write it anyway.
Errors in plain words
✗ 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]
✗ 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]
✗ lines[0].vat.exemptionCode: Line 1 is exempt, so the exemption reason code is required.
→ For example 'DL8.46.2'. [ibr-167-ae]
Each issue has Severity, Code, Path, Message, Hint, Rule. Match on Code (stable) to highlight the right field in your own screens.
Logging and debugging
var ei = new EInvoicing(LogLevel.Debug); // while integrating: console
var recent = new MemorySink(500); // production: JSON lines + recent entries
var ei2 = new EInvoicing(LogLevel.Info, Logger.JsonSink(line => myLog.Write(line)), recent);
// Microsoft.Extensions.Logging, Serilog, NLog: one lambda
var ei3 = new EInvoicing(LogLevel.Info, e => ilogger.LogInformation("{Event} {Message} {TraceId}", e.Event, e.Message, e.TraceId));
Every entry for one invoice carries the same trace ID (result.TraceId).
Console.WriteLine(EInvoicing.Explain(invoice)); // how every amount was calculated
var report = EInvoicing.DebugReport(invoice, logs: recent.Entries, traceId: result.TraceId); // masked by default
File.WriteAllText("support-report.json", report.ToJson());
Other helpers: Debugging.DescribeTransactionType("10000001") → ["Free zone supply", "Export"], Debugging.Describe("vat", "AE") → "Reverse charge", Debugging.Redact(invoice), Debugging.Mask(value), EInvoicing.Calculate(invoice).
Read a received invoice
var 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 send
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 (the 8 flags of BTAE-02) |
| Amounts | Line discounts and charges, price discounts, document allowances and charges, prepaid amounts, rounding |
| Currency | Any currency, with the AED VAT total, AED line amounts and AED total the UAE requires |
| Parties | TRN, TIN, Peppol address, trade licence / Emirates ID / passport / cabinet decision, addresses, contacts |
| Items | Goods/services type, HS code, service accounting code (SAC), GTIN, reverse charge type |
| Payment | Payment means, bank account, card (last 4 digits), payment terms |
Coming next: Oman (PINT OM), Saudi Arabia (ZATCA), India (IRP).
Not tax advice
This SDK is software. It follows the published PINT AE specification and validation rules; your accountant or tax adviser decides how each transaction should be invoiced. Always test with your ASP before going live.
License
MIT. Made by Fajfield: research and development for ERP, warehouse, POS and business data.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.1.0 | 53 | 12/1/2026 |