Skip to content

Validate License

Check if a license is valid for a product.

POST /public/v1/licenses/validate

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 validate
domainNoRequesting domain (for logging)

Response (Valid)

json
{
  "valid": true,
  "license": {
    "key": "MYPLUGIN-XXXX-XXXX-XXXX-XXXX",
    "status": "active",
    "seats": 5,
    "activatedCount": 2,
    "expiresAt": "2026-12-31T23:59:59.000Z"
  },
  "product": {
    "name": "My Plugin",
    "slug": "my-plugin"
  }
}

Response (Invalid)

json
{
  "valid": false,
  "error": "License has expired"
}

Example

bash
curl -X POST https://api.packedge.dev/public/v1/licenses/validate \
  -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
$response = wp_remote_post('https://api.packedge.dev/public/v1/licenses/validate', [
    '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 ($body['valid']) {
    // License is valid
    $expires_at = $body['license']['expiresAt'];
} else {
    // License is invalid
    $error = $body['error'];
}