Skip to content

Deactivate License

Deactivate a license from a domain, freeing up a seat.

POST /public/v1/licenses/deactivate

Request

json
{
  "public_key": "pk_your_public_key",
  "license_key": "MYPLUGIN-XXXX-XXXX-XXXX-XXXX",
  "domain": "https://example.com"
}
FieldRequiredDescription
public_keyYesYour product's public key
license_keyYesThe license key to deactivate
domainConditionalDomain to deactivate (required if no activation_id)
activation_idConditionalActivation ID (required if no domain)

Response

json
{
  "success": true,
  "message": "Activation deactivated"
}

Example

bash
curl -X POST https://api.packedge.dev/public/v1/licenses/deactivate \
  -H "Content-Type: application/json" \
  -d '{
    "public_key": "pk_your_public_key",
    "license_key": "MYPLUGIN-XXXX-XXXX-XXXX-XXXX",
    "domain": "https://example.com"
  }'

PHP Example

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

    $body = json_decode(wp_remote_retrieve_body($response), true);

    if (isset($body['success']) && $body['success']) {
        delete_option('my_plugin_activation_id');
        return true;
    }

    return false;
}