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.
The status model
Section titled “The status model”Every license has one of seven statuses:
| Code | Status | Meaning |
|---|---|---|
| 0 | pending | Created/sold but not yet delivered or activated. |
| 1 | active | Valid and usable — validations pass. |
| 2 | inactive | Delivered, zero active devices, still valid to activate. |
| 3 | expired | Past expiry (+ grace). Validations fail until renewed. |
| 4 | suspended | Temporary admin hold. Reversible. |
| 5 | revoked | Permanently killed by admin. Reversible only by an explicit reinstate. |
| 6 | terminated | Hard, non-reversible kill switch. |
Transitions are enforced by the license service:
pending → (deliver) → inactive → (activate device) → activeactive → (last device deactivated) → inactiveactive → (past expiry + grace) → expired → (renew) → activeany except terminated → (suspend) → suspended → (reinstate) → previousany except terminated → (revoke) → revoked → (reinstate) → inactiveany → (terminate) → terminated [terminal]Creating a license
Section titled “Creating a license”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.
Key source: generator vs. pool
Section titled “Key source: generator vs. pool”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.
Expiry
Section titled “Expiry”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.
License meta
Section titled “License meta”Attach arbitrary data to a license:
wplm_add_license_meta( $license_id, 'plan', 'pro' );$plan = wplm_get_license_meta( $license_id, 'plan' );Importing & exporting
Section titled “Importing & exporting”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.