Getting Started

Learn how to install, configure, and start selling with LicenShield in under 10 minutes.

Installation

Installing LicenShield is just like installing any other WordPress plugin:

  1. Download the licenshield.zip file from your purchase confirmation email
  2. In your WordPress admin, go to Plugins → Add New → Upload Plugin
  3. Select the ZIP file and click Install Now
  4. After installation, click Activate Plugin
💡

After activation, you'll see a new "LicenShield" menu item in your WordPress admin sidebar.

Configuration

Navigate to LicenShield → Settings to configure the plugin:

General Settings

  • Company Name — Your business name (used in emails)
  • Support Email — Where customers can reach you
  • License Prefix — Custom prefix for license keys (e.g., "WPLS")

Redirect URLs

  • Success URL — Where to redirect after successful purchase
  • Cancel URL — Where to redirect if purchase is cancelled

Stripe Setup

Connect your Stripe account to start accepting payments:

  1. Log in to your Stripe Dashboard
  2. Go to Developers → API Keys
  3. Copy your Publishable Key and Secret Key
  4. Paste them into LicenShield Settings → Stripe tab
⚠️

Start with Test Mode keys to test your setup before going live. Switch to Live Mode when you're ready to accept real payments.

Webhook Configuration

Webhooks allow Stripe to notify LicenShield about payment events:

  1. In Stripe, go to Developers → Webhooks
  2. Click Add endpoint
  3. Enter your webhook URL: https://yoursite.com/wp-json/ls/v1/webhook/stripe
  4. Select events: checkout.session.completed, customer.subscription.deleted
  5. Copy the Signing Secret to LicenShield settings

Products

Products represent your plugins or themes that customers can purchase.

To create a product, go to LicenShield → Products → Add New:

  • Name — Product name (e.g., "My Awesome Plugin")
  • Slug — Unique identifier for API calls
  • Price — Cost in your currency
  • Activation Limit — How many sites per license (0 = unlimited)
  • License Duration — Days until expiration (0 = lifetime)

Licenses

Licenses are automatically generated when a customer completes a purchase. Each license includes:

  • Unique license key
  • Customer email
  • Activation count and limit
  • Expiration date (if applicable)
  • Status (active, expired, suspended)

Orders

All transactions are recorded in LicenShield → Orders. Each order shows:

  • Order number and date
  • Customer email
  • Product purchased
  • Amount paid
  • Payment status

API Reference

LicenShield provides a REST API for license validation and management.

POST /wp-json/ls/v1/validate

Validate a license key and check if it's active.

ParameterTypeDescription
license_key requiredstringThe license key to validate
site_url requiredstringThe site URL requesting validation
product_slugstringProduct identifier (optional)
POST /wp-json/ls/v1/activate

Activate a license on a specific site.

ParameterTypeDescription
license_key requiredstringThe license key
site_url requiredstringSite URL to activate
site_namestringFriendly name for the site
POST /wp-json/ls/v1/deactivate

Deactivate a license from a site.

ParameterTypeDescription
license_key requiredstringThe license key
site_url requiredstringSite URL to deactivate

Webhooks

LicenShield processes webhooks from Stripe to handle:

  • checkout.session.completed — Creates license and order when payment succeeds
  • customer.subscription.deleted — Suspends license when subscription is cancelled
  • invoice.payment_failed — Notifies about failed payments

PHP SDK (WordPress)

For WordPress plugins and themes. Includes automatic updates integration.

Installation

  1. Download licenshield-php-sdk.zip from Settings → Developer
  2. Extract and copy class-licenshield-client.php to your plugin folder
  3. Include the file in your main plugin file

Basic Usage

<?php
// Include the SDK
require_once plugin_dir_path( __FILE__ ) . 'class-licenshield-client.php';

// Initialize the client
$client = new LicenShield_Client(
    'https://licenshield.com',      // Your LicenShield URL
    'my-plugin-slug',                // Product slug
    'My Plugin Name',                // Product name
    '1.0.0'                          // Current version
);

// Validate a license
$result = $client->validate( $license_key, home_url() );

if ( $result['valid'] ) {
    // License is valid - enable premium features
    update_option( 'my_plugin_license_status', 'valid' );
} else {
    // License invalid or expired
    update_option( 'my_plugin_license_status', 'invalid' );
    // Show notice: $result['message']
}

Automatic Updates

// Enable automatic updates (call in plugin init)
$client->init_updates( __FILE__ );

// Users will see "Update Available" in WordPress
// Updates require valid license to download

Activation/Deactivation

// Activate license on this site
$result = $client->activate( $license_key, home_url() );

// Deactivate when plugin is deactivated
register_deactivation_hook( __FILE__, function() use ( $client, $license_key ) {
    $client->deactivate( $license_key, home_url() );
});
💡

The PHP SDK includes 24-hour response caching and 7-day offline grace period automatically.

JavaScript SDK

For Chrome extensions, Electron apps, web apps, and Node.js applications.

Installation

// Browser: Include the script
<script src="licenshield-sdk.min.js"></script>

// Node.js: Copy to your project
const LicenShield = require('./licenshield-sdk');

Basic Usage

// Initialize
const client = new LicenShield({
    apiUrl: 'https://licenshield.com',
    productSlug: 'my-extension',
    productName: 'My Chrome Extension',
    version: '1.0.0'
});

// Validate license
const result = await client.validate(licenseKey);

if (result.valid) {
    console.log('License valid until:', result.expires);
    // Enable premium features
} else {
    console.log('Invalid:', result.message);
}

Chrome Extension Example

// background.js
chrome.runtime.onInstalled.addListener(async () => {
    const { licenseKey } = await chrome.storage.sync.get('licenseKey');
    
    if (licenseKey) {
        const result = await client.validate(licenseKey);
        await chrome.storage.local.set({ 
            isLicensed: result.valid,
            features: result.features || {}
        });
    }
});

// Check license status from popup or content scripts
const { isLicensed } = await chrome.storage.local.get('isLicensed');

Feature Flags

// Check specific features
const result = await client.validate(licenseKey);

if (result.features?.dark_mode) {
    enableDarkMode();
}

if (result.features?.export) {
    showExportButton();
}

The JS SDK uses localStorage for caching and includes machine fingerprinting for activation tracking.

Python SDK

For CLI tools, desktop apps (PyQt, Tkinter), and scripts.

Installation

# Copy licenshield.py to your project
# Requires: requests library
pip install requests

Basic Usage

from licenshield import LicenShieldClient

# Initialize
client = LicenShieldClient(
    api_url='https://licenshield.com',
    product_slug='my-cli-tool',
    product_name='My CLI Tool',
    version='1.0.0'
)

# Validate license
result = client.validate(license_key)

if result['valid']:
    print(f"Licensed to: {result['customer_email']}")
    print(f"Expires: {result['expires']}")
else:
    print(f"Invalid license: {result['message']}")
    sys.exit(1)

CLI Tool Example

import click
from licenshield import LicenShieldClient

client = LicenShieldClient(...)

@click.group()
def cli():
    pass

@cli.command()
@click.option('--key', prompt='License Key')
def activate(key):
    """Activate your license"""
    result = client.activate(key)
    if result['success']:
        # Save to config file
        save_config({'license_key': key})
        click.echo('✓ License activated!')
    else:
        click.echo(f'✗ {result["message"]}')

@cli.command()
def run():
    """Run the tool (requires license)"""
    key = load_config().get('license_key')
    if not key or not client.validate(key)['valid']:
        click.echo('Please activate your license first')
        return
    # Run your tool...
💡

License cache is stored in ~/.licenshield/ with 7-day offline grace period.

C#/.NET SDK

For Windows desktop apps (WPF, WinForms), Unity games, and .NET applications.

Installation

// Add LicenShield.cs to your project
// Requires: System.Net.Http, Newtonsoft.Json (or System.Text.Json)

Basic Usage

using LicenShield;

// Initialize
var client = new LicenShieldClient(
    apiUrl: "https://licenshield.com",
    productSlug: "my-windows-app",
    productName: "My Windows App",
    version: "1.0.0"
);

// Validate license
var result = await client.ValidateAsync(licenseKey);

if (result.Valid)
{
    Console.WriteLine($"Licensed until: {result.Expires}");
    // Enable features
}
else
{
    MessageBox.Show($"License error: {result.Message}");
}

WPF Example

public partial class MainWindow : Window
{
    private LicenShieldClient _license;
    
    public MainWindow()
    {
        InitializeComponent();
        _license = new LicenShieldClient(...);
        CheckLicense();
    }
    
    private async void CheckLicense()
    {
        var savedKey = Properties.Settings.Default.LicenseKey;
        
        if (string.IsNullOrEmpty(savedKey))
        {
            ShowActivationDialog();
            return;
        }
        
        var result = await _license.ValidateAsync(savedKey);
        
        if (!result.Valid)
        {
            ShowActivationDialog();
        }
        else
        {
            EnablePremiumFeatures();
        }
    }
}

Unity Example

public class LicenseManager : MonoBehaviour
{
    private LicenShieldClient client;
    
    void Start()
    {
        client = new LicenShieldClient(
            "https://licenshield.com",
            "my-unity-game",
            "My Game",
            Application.version
        );
    }
    
    public async Task<bool> ValidateLicense(string key)
    {
        var result = await client.ValidateAsync(key);
        PlayerPrefs.SetInt("IsLicensed", result.Valid ? 1 : 0);
        return result.Valid;
    }
}

Go SDK

For CLI tools, servers, and microservices.

Installation

// Copy licenshield.go to your project
// No external dependencies required

Basic Usage

package main

import (
    "fmt"
    "github.com/yourorg/licenshield"
)

func main() {
    client := licenshield.NewClient(
        "https://licenshield.com",
        "my-cli-tool",
        "My CLI Tool",
        "1.0.0",
    )
    
    result, err := client.Validate(licenseKey)
    if err != nil {
        fmt.Println("Error:", err)
        return
    }
    
    if result.Valid {
        fmt.Printf("Licensed to: %s\n", result.CustomerEmail)
        fmt.Printf("Expires: %s\n", result.Expires)
    } else {
        fmt.Printf("Invalid: %s\n", result.Message)
    }
}

CLI Tool with Cobra

var activateCmd = &cobra.Command{
    Use:   "activate [license-key]",
    Short: "Activate your license",
    Args:  cobra.ExactArgs(1),
    Run: func(cmd *cobra.Command, args []string) {
        result, _ := client.Activate(args[0])
        if result.Success {
            viper.Set("license_key", args[0])
            viper.WriteConfig()
            fmt.Println("✓ License activated!")
        } else {
            fmt.Printf("✗ %s\n", result.Message)
        }
    },
}

var rootCmd = &cobra.Command{
    Use: "mytool",
    PersistentPreRun: func(cmd *cobra.Command, args []string) {
        // Skip license check for activate command
        if cmd.Name() == "activate" {
            return
        }
        
        key := viper.GetString("license_key")
        result, _ := client.Validate(key)
        if !result.Valid {
            fmt.Println("Please run: mytool activate YOUR-KEY")
            os.Exit(1)
        }
    },
}

All SDKs include machine fingerprinting, 24-hour response caching, and 7-day offline grace period.

Frequently Asked Questions

How do customers receive their license keys?

License keys are automatically emailed to customers immediately after purchase. They can also be displayed on the success page.

Can I migrate from another licensing system?

Yes, you can import existing licenses. Contact support for assistance with bulk imports.

What happens when a license expires?

The license status changes to "expired" and validation requests will return invalid. The customer can renew to reactivate.

Is there an activation limit per license?

You control this per-product. Set a limit (e.g., 3 sites) or allow unlimited activations.