Biqydu.Fakturownia.Net.Abstractions 2.0.1

dotnet add package Biqydu.Fakturownia.Net.Abstractions --version 2.0.1
                    
NuGet\Install-Package Biqydu.Fakturownia.Net.Abstractions -Version 2.0.1
                    
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="Biqydu.Fakturownia.Net.Abstractions" Version="2.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Biqydu.Fakturownia.Net.Abstractions" Version="2.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Biqydu.Fakturownia.Net.Abstractions" />
                    
Project file
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 Biqydu.Fakturownia.Net.Abstractions --version 2.0.1
                    
#r "nuget: Biqydu.Fakturownia.Net.Abstractions, 2.0.1"
                    
#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 Biqydu.Fakturownia.Net.Abstractions@2.0.1
                    
#: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=Biqydu.Fakturownia.Net.Abstractions&version=2.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Biqydu.Fakturownia.Net.Abstractions&version=2.0.1
                    
Install as a Cake Tool

Biqydu.Fakturownia.Net

NuGet NuGet Downloads License: MIT

A clean, fully-typed .NET 8+ client for the Fakturownia.pl invoicing API.

Enjoying the SDK? Drop a ⭐ on GitHub — it really helps others discover it!

Why this project?

While Fakturownia.pl is popular in Poland, there was no up-to-date, dedicated SDK for modern .NET. I built this to fill that gap with a focus on reliability:

  • Financial precision: Uses decimal for all monetary values to avoid rounding errors (no double or float here).
  • Resilient by default: Includes Polly policies to handle transient errors and 429 (rate limit) responses automatically.
  • Security: Built-in masking for api_token in logs to prevent accidental leaks.
  • Native PDF streaming: Downloads are returned as a Stream, so you can pipe them directly to a file or web response without loading everything into memory.

Packages

The SDK is split into three parts so you don't have to pull in dependencies you don't need:

  • Biqydu.Fakturownia.Net.Abstractions: Just the models and interfaces. Low footprint, no logic.
  • Biqydu.Fakturownia.Net: The main client implementation.
  • Biqydu.Fakturownia.Net.DependencyInjection: Extensions for IServiceCollection. Start here if you are using ASP.NET Core.

Installation

dotnet add package Biqydu.Fakturownia.Net.DependencyInjection

Configuration

In your Program.cs:

builder.Services.AddFakturownia(options =>
{
    options.ApiToken = "YOUR_API_TOKEN_HERE";
    options.Subdomain = "your-company"; // e.g. "acme" → acme.fakturownia.pl
});

Basic Usage

Creating an Invoice

const decimal priceNet = 12500.00m;
const int quantity = 3;
var taxRate = VatRates.ToRate(VatRates.Vat23) ?? 0;

var request = new InvoiceRequest
{
    BuyerName = "Global Client Sp. z o.o.",
    BuyerTaxNo = "PL5250001090",
    Currency = Currencies.EUR,
    Lang = Languages.EN,
    SellDate = DateTime.Today.ToString("yyyy-MM-dd"),
    IssueDate = DateTime.Today.ToString("yyyy-MM-dd"),
    Positions =
    [
        new InvoicePosition
        {
            Name = "Backend development services - March 2026",
            Tax = "23",
            Quantity = quantity,
            TotalPriceGross = (priceNet * quantity) * (1 + taxRate),
            QuantityUnit = "service"
        }
    ]
};

var invoice = await fakturowniaClient.CreateInvoiceAsync(request);
Console.WriteLine($"Invoice created: {invoice.Number}");

Downloading the PDF

await using var pdfStream = await fakturowniaClient.GetInvoicePdfAsync(invoice.Id);
await using var fileStream = File.Create($"FV_{invoice.Number.Replace("/", "-")}.pdf");
await pdfStream.CopyToAsync(fileStream);

Sending by Email

await fakturowniaClient.SendByEmailAsync(invoice.Id);

Advanced Examples

Adding Discounts and GTU Codes

const decimal priceNet = 12500.00m;
const int quantity = 3;
const decimal discountPercent = 5m;
// Helper to get decimal rate (e.g., 0.23) from string constant
var taxRate = VatRates.ToRate(VatRates.Vat23) ?? 0;

// 1. Calculate unit price after discount
var priceAfterDiscount = Math.Round(priceNet * (1 - (discountPercent / 100)), 2);
// 2. Calculate total net for all items
var totalNet = Math.Round(priceAfterDiscount * quantity, 2);
// 3. Calculate final gross amount
var totalGross = Math.Round(totalNet * (1 + taxRate), 2);

var request = new InvoiceRequest
{
    BuyerName = "Global Client Sp. z o.o.",
    BuyerTaxNo = "PL5250001090",
    Currency = Currencies.EUR,
    Lang = Languages.EN,
    ShowDiscount = LogicalStatus.Yes,
    DiscountKind = DiscountKinds.PercentUnit,
    SellDate = DateTime.Today.ToString("yyyy-MM-dd"),
    IssueDate = DateTime.Today.ToString("yyyy-MM-dd"),
    Positions = [
        new InvoicePosition
        {
            Name = "Dell XPS 15 Laptop",
            Tax = VatRates.Vat23,
            PriceNet = priceNet,         // Unit price BEFORE discount
            Quantity = quantity,
            GtuCode = GtuCodes.Gtu06,    // Required for some electronics in Poland
            DiscountPercent = discountPercent,
            TotalPriceGross = totalGross // Manually calculated to avoid rounding issues
        }
    ]
};

var response = await client.CreateInvoiceAsync(request);

Currency Exchange

request.ExchangeCurrency = Currencies.PLN;
request.ExchangeKind = "nbp";

Lump-sum Tax

position.LumpSumTax = "8.5"; // only if your company uses lump-sum taxation

Error Handling

try
{
    var invoice = await client.CreateInvoiceAsync(request);
}
catch (FakturowniaException ex)
{
    Console.WriteLine($"HTTP Status: {ex.StatusCode}");
    Console.WriteLine($"Fakturownia response: {ex.ResponseBody}");
    // ex contains validation errors, rate limits, auth issues, etc.
}

Logging & Debugging

The SDK integrates with Microsoft.Extensions.Logging and is optional but very useful.

Just enable console (or any other) logging in your app:

builder.Logging.AddConsole();
builder.Logging.SetMinimumLevel(LogLevel.Debug);

The api_token is automatically masked in logs for security.

Documentation

Contributing

Contributions are welcome!

  1. Fork the project
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

Distributed under the MIT License. See the LICENSE file for details.


Note: This is an unofficial .NET SDK for Fakturownia.pl and is not affiliated with or supported by them.

Maintained by Biqydu. Bug reports and PRs are welcome.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Biqydu.Fakturownia.Net.Abstractions:

Package Downloads
Biqydu.Fakturownia.Net

Professional, type-safe .NET 8+ SDK for Fakturownia.pl. Built for financial precision, high-performance invoicing, and seamless JPK_V7 compliance.

Biqydu.Fakturownia.Net.DependencyInjection

Dependency Injection and Polly resilience extensions for Fakturownia.pl SDK.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.1 170 4/4/2026
2.0.0 148 4/3/2026
1.1.1 144 4/2/2026
1.1.0 147 3/26/2026
1.0.4 146 3/25/2026
1.0.3 142 3/25/2026
1.0.2 141 3/25/2026
1.0.1 142 3/24/2026
1.0.0 138 3/24/2026

v2.0.0: MAJOR BREAKING CHANGE.
           - Relocated all Constants and Enums to root namespaces for better DX.
           - Added full JPK_V7 support (GtuCodes, VatRates).
           - Added LogicalStatus, DiscountKinds, and KSeF roles.
           - Added VatRates.ToRate() helper.