Skip to content

Licenses

A license is a signed, encrypted key issued to a customer. WPLM stores every key encrypted at rest (XChaCha20-Poly1305) with a SHA-256 hash for fast lookup, and signs a payload with Ed25519 so clients can verify it offline.

Every license has one of seven statuses:

CodeStatusMeaning
0pendingCreated/sold but not yet delivered or activated.
1activeValid and usable — validations pass.
2inactiveDelivered, zero active devices, still valid to activate.
3expiredPast expiry (+ grace). Validations fail until renewed.
4suspendedTemporary admin hold. Reversible.
5revokedPermanently killed by admin. Reversible only by an explicit reinstate.
6terminatedHard, non-reversible kill switch.

Transitions are enforced by the license service:

pending → (deliver) → inactive → (activate device) → active
active → (last device deactivated) → inactive
active → (past expiry + grace) → expired → (renew) → active
any except terminated → (suspend) → suspended → (reinstate) → previous
any except terminated → (revoke) → revoked → (reinstate) → inactive
any → (terminate) → terminated [terminal]

License Manager → Licenses → Add New. Set the product, owner, seats (max activations), expiry, grace period, and overage strategy.

You can also create licenses programmatically:

$license = wplm_create_license( array(
'key_string' => 'ABCD-EFGH-IJKL-MNOP', // or generate one first
'product_id' => 42,
'user_id' => get_current_user_id(),
'max_activations' => 3,
'expires_at' => '2027-01-01 00:00:00',
) );

…or over the REST API (POST /wp-json/wplm/v1/licenses). See the REST and PHP API sections for full details.

A licensed product issues keys in one of two ways:

  • Generate from a generator — a key is created on the fly from a generator (charset, chunks, prefix…).
  • Draw from an existing pool — pre-generated keys are consumed one at a time.

If a product is set to draw from a pool that is empty (and has no generator), the purchase is blocked with a clear stock error.

Licenses support two expiry models, which can combine:

  • Absolute expiry (expires_at) — a fixed end date.
  • Relative expiry (valid_for_days) — N days counted from the first activation (set automatically on first activate).

A grace period (grace_days) keeps a license usable for a few days past expiry before validations hard-fail.

Attach arbitrary data to a license:

wplm_add_license_meta( $license_id, 'plan', 'pro' );
$plan = wplm_get_license_meta( $license_id, 'plan' );

Under Settings → Tools you can:

  • Export every license as a CSV (includes plaintext keys).
  • Import licenses from a CSV (rows whose key already exists are skipped).

The Licenses list also offers bulk Revoke, Suspend, and Export CSV actions for the selected rows.