EInvoice.Sdk
0.1.0
.NET 8.0
This package targets .NET 8.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package EInvoice.Sdk --version 0.1.0
NuGet\Install-Package EInvoice.Sdk -Version 0.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EInvoice.Sdk" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EInvoice.Sdk" Version="0.1.0" />
<PackageReference Include="EInvoice.Sdk" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EInvoice.Sdk --version 0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EInvoice.Sdk, 0.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EInvoice.Sdk@0.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EInvoice.Sdk&version=0.1.0
#tool nuget:?package=EInvoice.Sdk&version=0.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
EInvoice.Sdk
.NET client for the EInvoice API — extract structured data from ZUGFeRD / Factur-X PDFs and generate XRechnung XML or ZUGFeRD PDFs for the German (2025–2028) and French e-invoicing mandates.
- Targets .NET 10, .NET 8 and .NET Framework 4.7.2+ / netstandard2.0
- Invoices are processed statelessly on servers hosted in Germany and are never stored
- Errors surface as typed exceptions with field-level validation details
Install
dotnet add package EInvoice.Sdk
Quick start
using EInvoice.Sdk;
using var client = new EInvoiceClient("your-api-key");
// 1. Extract data from an existing ZUGFeRD / Factur-X PDF
await using var pdf = File.OpenRead("incoming-invoice.pdf");
InvoiceModel invoice = await client.ExtractAsync(pdf);
Console.WriteLine($"{invoice.InvoiceNumber}: {invoice.Tax.GrossTotal} {invoice.CurrencyCode}");
// 2. Generate XRechnung XML (BuyerReference is required — BR-DE-15)
var model = new InvoiceModel(
InvoiceNumber: "2026-001",
IssueDate: new DateOnly(2026, 6, 12), // DateTime on .NET Framework
CurrencyCode: "EUR",
BusinessProcess: null,
BuyerReference: "04011000-12345-67", // Leitweg-ID (B2G) or agreed reference (B2B)
Seller: new TradeParty("Seller GmbH", new Address("Musterstraße 1", "12345", "Berlin", "DE"), VatId: "DE123456789"),
Buyer: new TradeParty("Buyer AG", new Address("Beispielweg 2", "54321", "Hamburg", "DE"), VatId: "DE987654321"),
Lines: [new TradeLineItem("Consulting", Quantity: 8, QuantityUnit: "HUR", NetUnitPrice: 120m, TaxPercent: 19)],
Tax: new TaxSummary(NetTotal: 960m, TaxTotal: 182.40m, GrossTotal: 1142.40m));
byte[] xml = await client.GenerateXRechnungAsync(model);
await File.WriteAllBytesAsync("xrechnung.xml", xml);
// 3. Embed the invoice into a PDF as ZUGFeRD (COMFORT / EN 16931 by default)
await using var source = File.OpenRead("invoice-visual.pdf");
byte[] zugferdPdf = await client.GenerateZugferdAsync(model, source);
await File.WriteAllBytesAsync("invoice-zugferd.pdf", zugferdPdf);
ASP.NET Core
Register the client once and inject IEInvoiceClient anywhere:
// Program.cs
builder.Services.AddEInvoiceClient(o => o.ApiKey = builder.Configuration["EInvoice:ApiKey"]);
// Endpoint or service
app.MapPost("/invoices/{id}/xrechnung", async (string id, IEInvoiceClient einvoice, MyInvoiceStore store) =>
{
InvoiceModel model = store.ToInvoiceModel(id);
byte[] xml = await einvoice.GenerateXRechnungAsync(model);
return Results.File(xml, "application/xml", $"{id}.xml");
});
AddEInvoiceClient returns an IHttpClientBuilder, so the standard resilience
extensions apply:
builder.Services
.AddEInvoiceClient(o => o.ApiKey = builder.Configuration["EInvoice:ApiKey"])
.AddStandardResilienceHandler(); // Microsoft.Extensions.Http.Resilience
Error handling
try
{
byte[] xml = await client.GenerateXRechnungAsync(model);
}
catch (EInvoiceValidationException ex) // 422 — invalid invoice model
{
foreach (var error in ex.Errors)
Console.WriteLine($"{error.Field}: {error.Message}");
}
catch (EInvoiceRateLimitException) // 429 — monthly plan limit reached
{
// back off / upgrade plan
}
catch (EInvoiceApiException ex) // any other API error (401, 400, …)
{
Console.WriteLine($"{ex.StatusCode}: {ex.Message}");
}
Notes
- BuyerReference (BT-10) is mandatory for XRechnung (rule BR-DE-15): use the Leitweg-ID for invoices to German public authorities, or any reference agreed with the buyer for B2B. It is optional for ZUGFeRD.
- Maximum upload size is 10 MB per request.
- On .NET Framework / netstandard2.0, date properties are
DateTimeinstead ofDateOnly; the wire format (yyyy-MM-dd) is identical.
Links
- API documentation: einvoice-api.de
- Source: github.com/K-S-K/EInvoiceAPI
| 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 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Microsoft.Extensions.Http (>= 8.0.1)
- System.Text.Json (>= 8.0.5)
-
net10.0
- Microsoft.Extensions.Http (>= 10.0.9)
-
net8.0
- Microsoft.Extensions.Http (>= 8.0.1)
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 | 113 | 6/13/2026 |