Skip to content

Activations

Activations track which sites are using a license. When a customer installs your plugin and enters their license key, the site is activated against the license.

How It Works

  1. Customer enters license key in your WordPress plugin
  2. Plugin calls the activate endpoint with the key and domain
  3. PackEdge verifies the license is valid and has available seats
  4. An activation record is created, tracking the domain and IP
  5. activatedCount on the license is incremented

Activate

POST https://api.packedge.dev/v1/licenses/activate
json
{
  "license_key": "MYPLUGIN-XXXX-XXXX-XXXX-XXXX",
  "domain": "https://example.com"
}

Response:

json
{
  "success": true,
  "activation_id": "act_xxx"
}

If the same domain is already activated, the existing activation is reused (idempotent).

Deactivate

POST https://api.packedge.dev/v1/licenses/deactivate
json
{
  "license_key": "MYPLUGIN-XXXX-XXXX-XXXX-XXXX",
  "domain": "https://example.com"
}

Seat Limits

Each license has a seats field defining the maximum number of concurrent activations. When the limit is reached, new activations are rejected with an error.

Activation Status

StatusDescription
activeCurrently using the license
deactivatedPreviously active, now deactivated

Managing Activations

In the dashboard, you can view all activations for a license and manually deactivate any of them. Revoking a license automatically deactivates all its activations.

PHP Example

php
function activate_license($key) {
    $response = wp_remote_post('https://api.packedge.dev/v1/licenses/activate', [
        'body' => json_encode([
            'license_key' => $key,
            'domain' => home_url(),
        ]),
        'headers' => ['Content-Type' => 'application/json'],
    ]);

    $body = json_decode(wp_remote_retrieve_body($response), true);
    return $body['success'] ?? false;
}

function deactivate_license($key) {
    $response = wp_remote_post('https://api.packedge.dev/v1/licenses/deactivate', [
        'body' => json_encode([
            'license_key' => $key,
            'domain' => home_url(),
        ]),
        'headers' => ['Content-Type' => 'application/json'],
    ]);

    $body = json_decode(wp_remote_retrieve_body($response), true);
    return $body['success'] ?? false;
}