.NET SDK for Poland
CorpMerch.SDK on NuGet — .NET 8, HttpClientFactory, AOT-friendly source-gen models for Poland.
Architecture — Install and initialise for Poland
NuGet: dotnet add package CorpMerch.SDK. Init in Program.cs: builder.Services.AddCorpMerch(o => { o.ApiKey = builder.Configuration["CorpMerch:ApiKey"]; o.Country = "Poland"; });. Uses HttpClientFactory with Polly v8 retry policies. VAT 23% applied server-side; KSeF channel for invoices. .NET 8 / .NET Standard 2.1.
How to wire it up — Quickstart with cancellation
var order = await _cm.Orders.CreateAsync(new OrderCreateOptions { IdempotencyKey = Guid.NewGuid().ToString(), Buyer = new() { VatId = "EU…" }, Lines = [new() { Sku = "TSH-001", Qty = 200 }] }, cancellationToken);. Source-generated System.Text.Json serializers — AOT-friendly, fast cold-start in Azure Functions and AWS Lambda.
Operations and edge cases — Webhook verification (ASP.NET Core)
Map an endpoint: app.MapPost("/wh", async (HttpRequest req, ICorpMerchWebhooks wh) => { var ev = await wh.ConstructEventAsync(req); return Results.Ok(); });. Throws SignatureVerificationException on bad signature — wired to a 400 response. Minimal APIs and MVC both supported. Krajowy System e-Faktur (KSeF) acknowledgement ids on InvoiceEvent.AcknowledgementId.
FAQ
Framework support?
.NET 8 and .NET Standard 2.1. .NET Framework 4.8 supported on the legacy 1.x SDK.
AOT and trimming?
Yes — source-generated System.Text.Json, no reflection at runtime. Ready for AOT publish and trimmed builds.
Polly retries?
Built-in retry, timeout and circuit-breaker via Polly v8. Configurable through AddCorpMerch(o => { o.Retry.MaxAttempts = 5; }).
F# support?
Yes — pure .NET assembly, works from F#. Discriminated-union wrappers shipped in a companion package.
VAT 23% and KSeF?
country: 'Poland' applies VAT 23%. Webhook events for invoices include KSeF acknowledgement id.