C# SDK

The .NET licensing SDK for SaaS, desktop, and custom software.
Stop building custom licensing integrations. This framework-agnostic SDK connects .NET applications to the License Manager for WooCommerce (Pro) REST API.

πŸš€ Accelerate Your Software Monetization

If you are building a SaaS, desktop application, or custom software, your focus should be on your productβ€”not on writing REST API integrations for licensing.

This SDK provides native .NET access to the License Manager for WooCommerce (Pro) ecosystem, including license activation, validation, updates, downloads, and public client operations.

πŸ›‘οΈ Why Choose This SDK?

  • Zero manual API coding: REST endpoints are mapped to asynchronous .NET methods.
  • Framework agnostic: Works with ASP.NET, worker services, desktop applications, and standalone .NET software.
  • Secure client API: Distributed applications can use the public API without shipping WooCommerce consumer secrets.
  • Enterprise ready: Designed for licensing and multi-tier SaaS fulfillment.

πŸ’Ž Professional API Support Matrix

The SDK supports the License Manager for WooCommerce (Pro) REST APIs.

πŸ”‘ Core Licensing

FeatureSDK MethodAPI Endpoint
List Licensesclient.Licenses.ListAsync()GET /licenses
Retrieve Licenseclient.Licenses.GetAsync(key)GET /licenses/{key}
Create Licenseclient.Licenses.CreateAsync(data)POST /licenses
Update Licenseclient.Licenses.UpdateAsync(key, data)PUT /licenses/{key}
Delete Licenseclient.Licenses.DeleteAsync(key)DELETE /licenses/{key}
Activate Licenseclient.Licenses.ActivateAsync(key)GET /licenses/activate/{key}
Reactivate Licenseclient.Licenses.ReactivateAsync(key, params)GET /licenses/activate/{key}
Deactivate Licenseclient.Licenses.DeactivateAsync(key)GET /licenses/deactivate/{key}
Validate Licenseclient.Licenses.ValidateAsync(key)GET /licenses/validate/{key}

βš™οΈ License Generators

FeatureSDK MethodAPI Endpoint
List Generatorsclient.Generators.ListAsync()GET /generators
Retrieve Generatorclient.Generators.GetAsync(id)GET /generators/{id}
Create Generatorclient.Generators.CreateAsync(data)POST /generators
Update Generatorclient.Generators.UpdateAsync(id, data)PUT /generators/{id}
Delete Generatorclient.Generators.DeleteAsync(id)DELETE /generators/{id}
Generate Keys (Pro)client.Generators.GenerateAsync(id, data)POST /generators/{id}/generate

πŸš€ Merchant & SaaS (Pro)

FeatureSDK MethodAPI Endpoint
Customer Licensesclient.Customers.GetLicensesAsync(id)GET /customers/{id}/licenses
Products/Pingclient.Products.PingAsync(data)POST /products/ping
Products/Updateclient.Products.UpdateAsync(key)GET /products/update/{key}
Download Productsclient.Products.DownloadUrl(key)GET /products/download/latest/{key}
Retrieve Applicationclient.Applications.GetAsync(id)GET /application/{id}
Download Applicationclient.Applications.DownloadUrl(id, token)GET /application/download/{token}

🌐 Public Client API

The public client does not use WooCommerce consumer credentials and is intended for distributed applications.

FeatureSDK MethodAPI Endpoint
ActivatepublicClient.ActivateAsync(body)POST /wp-json/lmfwc/v1/public/activate
ReactivatepublicClient.ReactivateAsync(body)POST /wp-json/lmfwc/v1/public/reactivate
DeactivatepublicClient.DeactivateAsync(body)POST /wp-json/lmfwc/v1/public/deactivate
ValidatepublicClient.ValidateAsync(body)POST /wp-json/lmfwc/v1/public/validate
Installed CheckpublicClient.InstalledAsync(body)POST /wp-json/lmfwc/v1/public/installed

πŸ’Ž The Revenue Model: Free SDK + Pro Engine

The SDK is the client-side tool bundled with your software. The merchant backend requires the Pro Engine.

PhaseClient SDK (This Free Repo)Pro Engine (Your WooCommerce Store)
PurposeConnects your software to your store.Handles orders, payments, and keys.
AvailabilityFree for developers.Purchase Required Here

πŸ“¦ 3-Minute Developer Quick Start

Step 1: Install the SDK

Requirements: .NET SDK 10.0 or newer. The library targets net10.0.

Install the package when it is available on NuGet:

dotnet add package LicenseManagerForWooCommerce.Sdk

Alternatively, clone the repository and add a project reference:

<ItemGroup>
  <ProjectReference Include="..\LicenseManagerForWooCommerce.Sdk\LicenseManagerForWooCommerce.Sdk.csproj" />
</ItemGroup>

Step 2: Initialization

For server-side or trusted applications, use WooCommerce REST API credentials from secure configuration:

using LicenseManagerForWooCommerce.Sdk;

var client = new LicenseManagerClient(
    storeUrl: Environment.GetEnvironmentVariable("LMW_STORE_URL")!,
    consumerKey: Environment.GetEnvironmentVariable("LMW_CONSUMER_KEY")!,
    consumerSecret: Environment.GetEnvironmentVariable("LMW_CONSUMER_SECRET")!);

Options-based configuration is also supported:

var client = new LicenseManagerClient(new LicenseManagerClientOptions
{
    StoreUrl = "https://your-store.com",
    ConsumerKey = "ck_...",
    ConsumerSecret = "cs_...",
    Timeout = TimeSpan.FromSeconds(120),
});

Step 3: Basic Activation Pattern

try
{
    var result = await client.Licenses.ActivateAsync("ABCD-1234-EFGH-5678");
    // Store the activation token from result for future operations.
}
catch (LicenseManagerException ex)
{
    Console.WriteLine($"Error: {ex.ApiErrorMessage}");
}

Successful calls return System.Text.Json.JsonElement. API failures throw LicenseManagerException, which exposes ApiErrorCode, ApiErrorMessage, and HttpStatusCode.

πŸ—οΈ Framework Integration

ASP.NET, Worker Services, and Trusted Applications

Use LicenseManagerClient with credentials stored in environment variables, .NET User Secrets, encrypted configuration, or a secrets manager. Register or reuse an HttpClient through your application’s dependency-injection container when appropriate.

Desktop, Mobile, and Distributed Software

Use LicenseManagerPublicClient with the public key from the license product. Do not ship the WooCommerce consumer secret in end-user software.

var publicClient = new LicenseManagerPublicClient(
    Environment.GetEnvironmentVariable("LMW_STORE_URL")!);

await publicClient.ValidateAsync(new
{
    PublicKey = Environment.GetEnvironmentVariable("LMW_PUBLIC_KEY"),
    LicenseKey = "ABCD-1234-EFGH-5678",
    Domain = "my-app.example.com",
});

The public client sends public_key, license_key, and domain in the JSON request body.

πŸ§ͺ Integration Testing

The repository includes a live integration runner and mocked unit tests.

Run the unit tests without a live store:

dotnet test LicenseManagerForWooCommerce.Sdk.slnx -c Release

Configure the integration runner with environment variables, then run:

dotnet run --project LmwSdk.IntegrationRunner/LmwSdk.IntegrationRunner.csproj -c Release
VariableRequiredDescription
LMW_STORE_URLYesWooCommerce site URL
LMW_CONSUMER_KEYYesWooCommerce REST API key
LMW_CONSUMER_SECRETYesWooCommerce REST API secret
LMW_LICENSE_KEYFor license testsExisting license key
LMW_GENERATOR_IDFor generator testsNumeric generator ID
LMW_CUSTOMER_IDFor customer testsWooCommerce customer ID
LMW_APPLICATION_IDFor application testsPro application ID
LMW_PUBLIC_KEYFor public API testsLicense product public key
LMW_PUBLIC_DOMAINNoDomain; defaults to the machine hostname
LMW_ACTIVATION_TOKENNoExisting activation token
LMW_RUN_MUTATIONSNoSet to 1 only when write tests are intended
LMW_HTTP_TIMEOUT_SECONDSNoHTTP timeout; defaults to 30 seconds
LMW_POST_LICENSE_JSONNoRaw JSON body for license creation
LMW_PUT_LICENSE_JSONNoRaw JSON body for license update
LMW_DELETE_LICENSE_KEYNoDisposable license key for deletion

Use a staging store when running mutations. Leave LMW_RUN_MUTATIONS unset for read-only endpoint checks.

πŸ” Credentials

Create WooCommerce REST API credentials under WooCommerce β†’ Settings β†’ Advanced β†’ REST API.

  • consumer_key starts with ck_.
  • consumer_secret starts with cs_.
  • Store credentials in secure configuration, never in shared source code.
  • For distributed applications, use the public client and product public key instead of shipping the consumer secret.

πŸš€ Get the Pro Merchant Engine Today

Unlock the full licensing backend by upgrading to the Pro edition of License Manager for WooCommerce.

On this page

    Scroll to Top
    license Manager For WooCommerce

    Privacy Overview

    This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.