Sendclap 0.5.0

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

Sendclap for .NET

The official .NET client for Sendclap: license keys for the apps you sell, and the creator API for your server. Targets .NET 8+ and netstandard2.0 (Unity, .NET Framework 4.6.2+), HttpClient and System.Text.Json only. API docs: https://sendclap.com/docs

Install

dotnet add package Sendclap

License check

The license endpoints need no API key, so this code ships inside your app. Activate once when the customer enters their key, then validate on every start. ValidateAsync only throws when it could not reach Sendclap, so an offline customer keeps working for a 7-day grace period:

using Sendclap;

var licenses = new LicenseClient();
var instance = LicenseClient.InstanceName();
await licenses.ActivateAsync(key, instance); // once, when the key is entered

try {
    var r = await licenses.ValidateAsync(key, instance);
    if (r.Valid) settings.LicenseCheckedAt = DateTime.UtcNow;
    else if (r.Status == LicenseStatus.Disabled) Lock("This license was refunded."); // NotFound, Disabled, Expired or NotActivated
    else Lock("Invalid license.");
} catch (SendclapNetworkException) { // offline: accept the last good check for 7 days
    if (DateTime.UtcNow - settings.LicenseCheckedAt > TimeSpan.FromDays(7)) Lock("Could not verify the license.");
}

ValidateAsync returns NotFound for an unknown key and Disabled for a refunded or disputed one and Expired for a subscription key past License.ExpiresAt, and ActivateAsync throws DisabledLicenseException or ExpiredLicenseException for those. DeactivateAsync(key, instance) frees the seat, for example from a "Sign out of this computer" button, and throws InstanceNotFoundException if that instance wasn't activated.

LicenseClient.InstanceName() returns Environment.MachineName. It is sent to Sendclap and shown to the creator, and two machines with the same name share one activation, so pass your own stable id (such as a Guid saved on first run) if that matters. The instance id Sendclap returns is the name you pass (up to 200 characters).

Creator API

Never ship your sc_… API key inside an app. It can read your payments and customers. Use ApiClient only on your own server.

var api = new ApiClient(Environment.GetEnvironmentVariable("SENDCLAP_API_KEY"));
var checkout = await api.CreateCheckoutAsync(new CheckoutParams { Type = "product", ProductId = 1, Email = "buyer@example.com" });
// send the customer to checkout.Url, then poll:
var paid = (await api.GetCheckoutAsync(checkout.Id)).Status == "paid";

var page = await api.ListPaymentsAsync(status: "paid", limit: 20); // page.Data, page.HasMore, page.Next
if (page.HasMore) page = await api.ListPaymentsAsync(status: "paid", limit: 20, after: page.Next);
await foreach (var p in api.AllPaymentsAsync(status: "paid")) // follows Next across pages
    Console.WriteLine($"{p.Id} {p.Amount}");

Lists return a Page<T> (Data, HasMore, Next), newest first; limit defaults to 50 and is at most 500 and after is the previous page's Next. AllPaymentsAsync, AllMembersAsync, AllLicensesAsync and AllDisputesAsync return an IAsyncEnumerable<T> and take a CancellationToken.

Also: MeAsync, GetPaymentAsync(id), ListPaymentsAsync(status, type, email, limit, after), ListMembersAsync(limit, after), ListLicensesAsync(email, limit, after), ListDisputesAsync(limit, after), ListProductsAsync, ListMembershipsAsync and the public GetCreatorAsync(handle), which works with a null key. Both clients take baseUrl, timeout (default 15 s) and an HttpClient to share; every method takes a CancellationToken.

Errors

All exceptions derive from SendclapException, which has Status, Code (the server's machine-readable code) and Message. The typed ones are chosen by Code:

Exception Code When
InvalidLicenseException license_not_found 404: the key does not exist
DisabledLicenseException license_disabled 403: disabled after a refund or dispute
ExpiredLicenseException license_expired 403: subscription over (License.ExpiresAt, Product)
InstanceNotFoundException instance_not_found 404: DeactivateAsync for an instance that isn't activated
ActivationLimitException activation_limit 409: the key is activated on all the devices it allows (License, Product)
SendclapNetworkException network_error no response: offline, DNS, TLS or timeout (Status 0)
SendclapException anything else e.g. bad_request, invalid_api_key, not_found

Cancelling your own CancellationToken throws OperationCanceledException as usual.

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

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.5.0 48 11/17/2026
0.4.0 46 11/17/2026
0.3.0 77 11/14/2026
0.2.0 80 11/14/2026