WP Manifestindependent plugin directory
manifest / ecommerce / wp-license-server

WP License Server

License server powered by Creem.io — validate, activate & deactivate licenses via REST API. Auto-creates WordPress users on first activation.

by Greenlight · github.com/wpsoul/wp-license-server · website

★ 0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/wpsoul/wp-license-server/archive/refs/heads/main.zip

A WordPress plugin that provides a license server powered by Creem.io. Validate, activate, and deactivate software licenses via REST API, with automatic WordPress user creation on first activation.

Features

  • License Management — Validate, activate, and deactivate licenses through a REST API
  • Auto User Creation — Automatically creates WordPress users when a license is activated with an email
  • Multiple Licenses per User — Users can hold multiple licenses, all tracked in user meta
  • Email Opt-in — Collect marketing email consent during activation (allow_email_send)
  • Billing Portal — Generate Creem.io billing portal links for customers
  • Custom Role — Registers a "License Holder" role on activation
  • Activity Log — Tracks all license operations with IP address, timestamps, and details
  • Admin Dashboard — Stats overview, activity log, licensed users list, email subscribers, and API docs
  • Customer Portal Block — A Gutenberg block where license holders self-serve: see activated device counts, view & deactivate individual devices/sites, and open the billing portal
  • Test / Live Mode — Switch between Creem.io sandbox and production environments

Requirements

  • WordPress 5.6+
  • PHP 7.4+
  • A Creem.io account with an API key

Installation

  1. Download or clone this repository into wp-content/plugins/wp-license-server/
  2. Activate the plugin in Plugins > Installed Plugins
  3. Go to Settings > License Server
  4. Enter your Creem.io API key and click Test Connection
  5. Configure user creation settings as needed

Configuration

Setting Description
API Key Your Creem.io API key (x-api-key header)
Test Mode Toggle between test-api.creem.io and api.creem.io
Auto-create User Create a WordPress user on first license activation
Default Role Role assigned to auto-created users (defaults to "License Holder")

REST API

All endpoints accept POST requests with a JSON body.

Base URL: https://your-site.com/wp-json/wpls/v1/

Validate License

POST /wpls/v1/license/validate
Parameter Type Required Description
license_key string Yes The license key to validate
instance_id string Yes The instance/device ID

Response:

{
  "valid": true,
  "license_id": "lic_abc123",
  "license_key": "creem_lic_abc123",
  "status": "active",
  "activation": 1,
  "activation_limit": 5,
  "expires_at": "2027-01-01T00:00:00Z",
  "created_at": "2026-01-01T00:00:00Z"
}

Activate License

POST /wpls/v1/license/activate
Parameter Type Required Description
license_key string Yes The license key to activate
instance_name string Yes A name for this device/instance
email string No Customer email — triggers auto user creation
allow_email_send boolean No true if the user opts in to marketing emails

Response:

{
  "activated": true,
  "license_id": "lic_abc123",
  "license_key": "creem_lic_abc123",
  "instance_id": "inst_xyz789",
  "status": "active",
  "activation": 1,
  "activation_limit": 5,
  "expires_at": "2027-01-01T00:00:00Z",
  "created_at": "2026-01-01T00:00:00Z",
  "user_created": true
}

Deactivate License

POST /wpls/v1/license/deactivate
Parameter Type Required Description
license_key string Yes The license key
instance_id string Yes The instance ID to remove

Response:

{
  "deactivated": true,
  "license_id": "lic_abc123",
  "status": "active",
  "activation": 0,
  "activation_limit": 5
}

Billing Portal

POST /wpls/v1/license/billing-portal
Parameter Type Required Description
license_key string Yes The license key (user must exist)

Response:

{
  "portal_url": "https://creem.io/portal/..."
}

Example: cURL

curl -X POST https://your-site.com/wp-json/wpls/v1/license/activate \
  -H "Content-Type: application/json" \
  -d '{
    "license_key": "creem_lic_abc123",
    "instance_name": "My Desktop",
    "email": "customer@example.com",
    "allow_email_send": true
  }'

Customer Portal Block

A Gutenberg block — License Portal (wpls/license-portal) — gives license holders a front-end self-service area. Add it to any page or post.

What customers can do:

  • See how many devices are activated per license (X of Y devices) and a total summary.
  • View each activated device/site with its name and activation date.
  • Deactivate/revoke a specific device (calls Creem.io deactivate).
  • Open the Creem.io billing portal to manage their subscription.

Access:

  • Logged-in users see their own licenses automatically.
  • Guests unlock the portal by entering their license key + the email on the account (the same email used at activation/checkout).

Block settings (sidebar): the portal heading and a toggle to show/hide the "Manage Billing" button.

Note on the device list: Creem.io's API does not expose the full list of a license's activated instances, so the per-device list is reconstructed from the plugin's own Activity Log (every activate/deactivate that went through this server). The headline activation count uses Creem.io's authoritative activation / activation_limit values.

Portal AJAX actions

The block talks to admin-ajax.php (nonce-protected, ownership re-checked server-side on every call):

Action Description
wpls_portal_lookup Guest unlock — verifies license key + email, returns the portal
wpls_portal_deactivate Deactivates a device/instance from a license
wpls_portal_billing Returns a Creem.io billing portal URL for the license

File Structure

wp-license-server/
├── wp-license-server.php        # Plugin bootstrap, activation hook, DB setup
├── assets/
│   ├── css/admin.css            # Admin UI styles
│   ├── js/admin.js              # Admin UI scripts
│   └── js/portal.js             # Front-end portal interactivity
├── blocks/
│   └── license-portal/
│       ├── block.json           # Block metadata
│       ├── index.js             # Block editor script (no build step)
│       └── style.css            # Front-end portal styles
└── includes/
    ├── class-admin.php          # Admin page, AJAX handlers, settings UI
    ├── class-creem-client.php   # Creem.io HTTP client
    ├── class-portal.php         # Customer portal block: render + AJAX
    ├── class-rest-api.php       # REST API endpoints
    └── class-user-manager.php   # User creation, license meta, email subscribers

User Meta

When a user is created or updated via license activation, the following meta is stored:

Meta Key Description
wpls_licenses Array of all licenses keyed by license ID
wpls_last_validated Timestamp of last license operation
_allow_email_send 1 if user opted in to receive emails

Changelog

1.6.0

  • Added License Portal Gutenberg block — a front-end self-service area for license holders
  • Customers can view activated device counts, deactivate individual devices/sites, and open the billing portal
  • Dual access: logged-in users see their portal automatically; guests unlock via license key + email
  • Device list reconstructed from the Activity Log; activation counts from Creem.io

1.3.0

  • Added license_key, expires_at, and created_at to API responses
  • Added "License Holder" custom role
  • Moved settings page under Settings menu
  • Added allow_email_send parameter to activation endpoint
  • Added email subscribers list in admin UI
  • Support for multiple licenses per user

1.1.0

  • Initial release with validate, activate, deactivate, and billing portal endpoints
  • Auto user creation on activation
  • Admin dashboard with stats, logs, and API docs

License

GPL v2 or later