Frameworks
.NET Core — Scell.io integration
No C# SDK — HttpClient via IHttpClientFactory
Scell.io does NOT publish an official C#/.NET SDK. In ASP.NET Core, integrate via `IHttpClientFactory` (typed client recommended). Register the client in `Program.cs` via `services.AddHttpClient<ScellClient>()`, configure `X-API-Key` header in factory. Compatible with .NET 8 LTS and 9. Use `IConfiguration` for the key.
Key facts
- No .NET SDK — `IHttpClientFactory`
- Typed client `services.AddHttpClient<ScellClient>()`
- Config via `appsettings.json` + `IConfiguration`
- Compatible with .NET 8 LTS and 9
- Polly for retry/circuit-breaker
Code example
// Program.cs
builder.Services.AddHttpClient<ScellClient>(client => {
client.BaseAddress = new Uri("https://api.scell.io/api/v1/");
client.DefaultRequestHeaders.Add("X-API-Key", builder.Configuration["Scell:ApiKey"]);
});
public class ScellClient(HttpClient http) {
public async Task<JsonElement> CreateInvoiceAsync(string buyer, decimal amount) {
var payload = new {
format = "factur-x",
buyer = new { name = buyer, is_individual = true },
lines = new[] { new { description = "Service", quantity = 1, unit_price = amount, vat_rate = 20.0 } }
};
var resp = await http.PostAsJsonAsync("invoices", payload);
resp.EnsureSuccessStatusCode();
return await resp.Content.ReadFromJsonAsync<JsonElement>();
}
}