JB License Manager for WooCommerce

Description

JB License Manager for WooCommerce turns your WordPress + WooCommerce site into a complete software licensing server. Sell plugins, themes, SaaS tools, or any digital product and automatically deliver encrypted license keys, control which domains can use each license, and revoke access instantly โ€” all from your own WordPress dashboard.

๐Ÿ”‘ Core Licensing

  • Automatic key generation โ€” cryptographically random keys with customizable prefix (e.g. MYAPP-XXXXXX-XXXXXX-XXXXXX)
  • WooCommerce auto-delivery โ€” license key is emailed to the customer the moment an order is completed, processing, or payment confirmed
  • Multi-domain activation โ€” each license can allow 1 to unlimited domains (configured per product)
  • Domain allow / disallow โ€” admin or customer can block a specific domain without revoking the whole license
  • Instant remote deactivation โ€” when a domain is disallowed, the client plugin detects it within 15 seconds via WordPress Heartbeat and immediately locks premium features โ€” no click required on the client site
  • Expiry by months or years โ€” set 1 Month, 3 Months, 6 Months, 1 Year, 2 Years, or any duration (1โ€“120 months / 1โ€“10 years)
  • Status management โ€” Active, Inactive, Suspended, Expired, Revoked
  • Automatic expiry โ€” daily cron marks licenses expired and sends reminder emails
  • Domain-level encryption โ€” activated domain names are hashed and never stored in plain text

๐Ÿ›’ WooCommerce Integration

  • Dedicated License product tab โ€” enable licensing per product with one click
  • Set max domains, validity period, and key prefix per product
  • Auto-fill license settings from product when creating a manual license
  • License key shown on the order details page inside WooCommerce
  • My Account Licenses โ€” full customer portal with all purchased licenses
  • Customer can view, copy, and allow/disallow their own domains without contacting support
  • Per-domain popup card showing activation date, last validated time, and IP address

๐ŸŒ REST API

Full public and admin REST API at /wp-json/jblm/v1/:

Public endpoints (license key authentication):

  • POST /activate โ€” register a domain against a license key
  • POST /validate โ€” verify a license key + domain (12-hour cached on client)
  • POST /deactivate โ€” release a domain slot
  • POST /status โ€” lightweight heartbeat check (does not update last_validated)

Admin endpoints (API key or logged-in admin):

  • GET /licenses โ€” list all licenses with pagination, search, status filter
  • POST /licenses โ€” create a license programmatically
  • GET /licenses/{id} โ€” get single license with activations
  • PUT /licenses/{id} โ€” update status, max_domains, expiry
  • DELETE /licenses/{id} โ€” revoke a license
  • GET /licenses/{id}/activations โ€” list all domain activations
  • GET /stats โ€” dashboard stats (total, active, expired, expiring, revoked)

๐Ÿ“Š Admin Dashboard

  • Stats cards โ€” Total / Active / Expiring Soon / Expired / Revoked at a glance
  • Filterable table โ€” search by email or key, filter by status
  • Click-to-copy license keys
  • View Sites popup modal โ€” see all activated domains per license, allow/disallow with one click, quick status change
  • Domain progress bar โ€” visual fill showing slots used vs. available
  • Expiry countdown โ€” “14d left” shown in amber when expiring soon
  • Activity Logs page โ€” last 500 events with time, license key, action, domain, IP, and result
  • Settings page โ€” key prefix, expiry reminder days, email from name/address, email subject and template, REST API key

โœ‰๏ธ Email Notifications

  • License delivery email โ€” sent automatically on WooCommerce order completion
  • Expiry reminder email โ€” sent N days before expiry (configurable)
  • Status change email โ€” sent when license is suspended or revoked
  • Fully customizable HTML template with placeholder tags: {license_key}, {expires_at}, {max_domains}, {order_id}, {customer_email}, {site_name}, {site_url}

๐Ÿ“ค CSV Export / Import

  • Export all or filtered licenses to CSV with one click
  • CSV includes: ID, License Key, Customer Email, Status, Max Domains, Active Domains, Expiry, Order ID, Product ID, Created At, Active Domain URLs
  • Bulk import licenses from CSV โ€” only customer_email required; other columns optional
  • Drag-and-drop upload zone in admin
  • Duplicate keys automatically skipped on import with per-row error reporting

๐Ÿ”’ Security

  • All domain names stored as SHA-256 hashes โ€” even database access cannot reveal which domains are activated
  • Encryption secret key auto-generated on activation and stored securely in the database. Optionally define JBLM_SECRET_KEY in wp-config.php to use a custom value
  • All AJAX handlers protected with wp_nonce and current_user_can() checks
  • All API inputs sanitized with sanitize_text_field(), sanitize_email(), intval()
  • All outputs escaped with esc_html(), esc_attr(), esc_url()
  • All database queries use $wpdb->prepare() with parameterized placeholders

๐Ÿ“ฆ Client SDK

Include the bundled jblm-client.php in your plugin or theme see sample below:

<?php
/**
 * Plugin Name: Your Plugin Name
 * Version: 1.0.0
 */

// ============================================================
// STEP 1 โ€” Load the license client
// Copy jblm-client.php into your plugin folder, then include it.
// ============================================================
require_once plugin_dir_path( __FILE__ ) . 'jblm-client.php';


// ============================================================
// STEP 2 โ€” Set up your license
// Replace the two values below:
//   - 'https://yoursite.com'   the site where you installed JB License Manager
//   - 'your-plugin-slug'       any unique name for your plugin (no spaces)
// ============================================================
$license = new JBLM_Client(
    'https://yoursite.com',   //  CHANGE THIS
    'your-plugin-slug'        //  CHANGE THIS  e.g. 'my-seo-plugin'
);


// ============================================================
// STEP 3 โ€” Register AJAX (required for Activate/Deactivate buttons)
// Just copy this line as-is. Don't change anything.
// ============================================================
add_action( 'plugins_loaded', function() use ( $license ) {
    $license->register_ajax_hooks();
});


// ============================================================
// STEP 4 โ€” Block your premium features if license is not active
// Put this check at the top of any function that has premium code.
// If the license is invalid, the function will stop here.
// ============================================================
function my_premium_feature() {
    global $license;

    if ( ! $license->is_valid() ) {
        return; //  stops here if no valid license
    }

    // Your premium code goes below this line 
    echo 'Premium feature is running!';
}


// ============================================================
// STEP 5 โ€” Show the License Key field on your settings page
// Call this inside the function that renders your settings page.
// It will show an input box + Activate / Deactivate buttons.
// ============================================================
function my_plugin_settings_page() {
    global $license;

    echo '<h1>My Plugin Settings</h1>';

    // This one line draws the full license box โ€” input + buttons
    $license->render_settings_field();

    // ... rest of your settings fields
}

The SDK handles:
* License activation, validation (12 h cache), deactivation
* WordPress Heartbeat integration for instant deactivation โ€” no click needed
* Built-in settings page with Activate / Check Status / Deactivate buttons
* Friendly Urdu/English error messages for common failure cases

โšก Performance

  • License validation results cached as WordPress transients (12 hours by default)
  • Heartbeat status check (/status) does not write to the database โ€” read-only
  • Index on license_key, domain_hash, user_id, status, and created_at columns
  • WooCommerce integration only loads when WooCommerce is active

Privacy Policy

JB License Manager for WooCommerce stores the following data in your WordPress database:

  • License keys (hashed) and associated customer email addresses
  • Domain names (stored as SHA-256 hashes โ€” not in plain text)
  • IP addresses of activation and validation requests
  • Timestamps of all license events

This data is stored solely on your own WordPress server. No data is transmitted to any third-party service by this plugin.

External connections: Client sites that use the bundled SDK connect to your WordPress store URL to activate, validate, and check license status. This is a direct connection between two sites you control.

If you collect or process personal data (such as customer email addresses), ensure your site has an appropriate privacy policy as required by GDPR, CCPA, or your local regulations.

Developer SDK

The client-side SDK (for your own plugins/themes to validate licenses against this server) is available as a separate download from the plugin’s GitHub page. It is NOT included in the WordPress.org version of this plugin.

The WordPress.org version of this plugin is the license server โ€” it stores and manages licenses. It does not lock any features behind a license check.

Screenshots

  • Dashboard โ€” stats cards, filterable license table with domain progress bars.
  • Create License โ€” product auto-fill, validity period picker, expiry preview chip.
  • Export / Import โ€” drag-and-drop CSV upload, column schema reference.
  • Settings โ€” general, email, and REST API configuration with encryption status banner.
  • Product configuration โ€” Product configuration set vaildity Period and max domain.

Installation

Automatic Installation

  1. Log in to your WordPress admin panel.
  2. Go to Plugins Add New.
  3. Search for JB License Manager for WooCommerce.
  4. Click Install Now then Activate.

Manual Installation

  1. Download the plugin ZIP file.
  2. Go to Plugins Add New Upload Plugin.
  3. Choose the ZIP file and click Install Now.
  4. Click Activate Plugin.

After Activation

  1. Go to License Manager Settings and configure your email sender, key prefix, and (optionally) generate a REST API key.
  2. Edit any WooCommerce product, open the License tab, enable licensing, and set max domains and validity.
  3. When a customer completes checkout, a license key is automatically generated and emailed.
  4. Include jblm-client.php in your plugin/theme and point it to your store URL.

FAQ

Do I need WooCommerce?

WooCommerce is required for automatic license delivery on purchase. You can still create and manage licenses manually without WooCommerce, but automatic order integration requires it.

Can I use this without WooCommerce for SaaS?

Yes. Create licenses manually via License Manager Create License or via the REST API (POST /wp-json/jblm/v1/licenses). The REST API accepts Bearer token or cookie authentication.

How does instant deactivation work?

When an admin or customer disallows a domain, the database record is updated immediately. The client plugin uses WordPress Heartbeat (every 15 seconds in admin) to ping your server’s lightweight /status endpoint. When it receives valid: false, it clears the local cache and reloads the page โ€” premium features disappear within 15 seconds without any manual action on the client site.

Is customer data sent anywhere outside my site?

No. All license data is stored in your own WordPress database. The only external connection is between client sites (running the SDK) and your own WordPress site (the license server). No data is sent to third-party servers by this plugin.

How are domain names stored?

Domain names are stored as SHA-256 hashes, not in plain text. Even if your database is compromised, the activated domain names cannot be read directly.

Can customers manage their own licenses?

Yes. The WooCommerce My Account Licenses page allows customers to view all their licenses, see which domains are activated, and allow or disallow domains themselves โ€” no support tickets needed.

What happens when a license expires?

A daily cron job checks for expiring licenses. When a license expires, its status is set to expired and the customer receives an expiry reminder email N days before (configurable). The /validate endpoint returns license_expired and the client SDK disables premium features.

Can I import existing licenses?

Yes. Go to License Manager Export / Import and upload a CSV file. Only the customer_email column is required. Existing license keys in the CSV are automatically skipped to prevent duplicates.

How do I secure the REST API?

Generate an API key in License Manager Settings REST API. Send it as the X-JBLM-API-Key header with all admin endpoint requests. Public endpoints (activate, validate, deactivate, status) are authenticated by the license key itself.

Is the plugin translation-ready?

Yes. All user-facing strings use the jblm text domain. You can translate the plugin using Loco Translate, WPML String Translation, or by submitting translations to translate.wordpress.org.

What PHP version is required?

PHP 7.2 or higher. PHP 8.0, 8.1, 8.2, and 8.3 are all supported and tested.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“JB License Manager for WooCommerce” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

2.0.0

  • Initial release
  • WooCommerce auto-delivery on order complete/processing
  • Multi-domain activation with domain hashing
  • REST API (activate, validate, deactivate, admin CRUD)
  • Customer My Account portal
  • CSV export and import
  • Admin dashboard, create, settings, and logs pages
  • Auto-generate encryption secret key on activation (stored in database)
  • Daily cron for expiry reminders