Code Example

$curl = curl_init();

$endpoint = '{{domain}}/wp-json/wclm/v3/get-license-details';
$parameters = array(
        // The License Key
        'license_key' => 'FFFF-FFFF-FFFF-FFFF'
    );

curl_setopt_array($curl, array(
     CURLOPT_URL => $endpoint,
     CURLOPT_RETURNTRANSFER => true,
     CURLOPT_MAXREDIRS => 10,
     CURLOPT_TIMEOUT => 0,
     CURLOPT_FOLLOWLOCATION => true,
     CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
     CURLOPT_CUSTOMREQUEST => 'POST',
     CURLOPT_POSTFIELDS => $parameters,
     CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'],
     CURLOPT_SSL_VERIFYPEER => false,
     CURLOPT_HTTPHEADER => array(
         // Authenticated user token
         'Authorization: Bearer {{User Token}}'
     ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

API Responses

{
    "response": {
        "result": "error",
        "code": "100",
        "message": "Invalid license key",
        "api_timestamp": 'current timestamp'
    },
    "signature": "Signature or OpenSSL error"
}
{
    "response": {
        "license_id": "453",
        "product_id": "236",
        "variation_id": "0",
        "license_key": "FFFF-FFFF-FFFF-FFFF",
        "image_license_key": null,
        "license_status": "inactive",
        "owner_first_name": "Test",
        "owner_last_name": "Test",
        "owner_email_address": "contact@domain.ltd",
        "activation_date": "2021-04-13",
        "creation_date": "2021-04-13",
        "expiration_date": "2022-04-12",
        "valid": "365",
        "order_id": "259",
        "product_name": "Product name",
        "variation_name": "Variation name",
        "sold_date": "2021-04-12",
        "delivery_limit": "1",
        "remaining_delivery_times": "1",
        "activation_limit": "3",
        "remaining_activations": "3",
        "device_ids": [
            "domain.ltd",
            "domain2.ltd"
        ],
        "license_key_meta": [
            {
                "id": "15",
                "meta_key": "example_key_1",
                "meta_value": "example value 1"
            },
            {
                "id": "16",
                "meta_key": "example_key_2",
                "meta_value": "example value 2"
            }
        ],
        "api_timestamp": 'current timestamp'
    },
    "signature": "Signature or OpenSSL error"
}

The license status returned by this endpoint is as-is in the database(expiration status is not calculated based on the expiration date). Custom license statuses set using the API can be accessed using this endpoint.

It is recommended to set custom data as meta keys instead; the plugin can overwrite the license status at any time if you have the auto-expire option enabled.

{
    "response": {
        "result": "error",
        "code": "900",
        "message": "The authenticated user doesn't own this license key",
        "api_timestamp": 'current timestamp'
    },
    "signature": "Signature or OpenSSL error"
}

WordPress’s built-in REST API responses.

{
    "code": "rest_forbidden",
    "message": "Sorry, you are not allowed to do that.",
    "data": {
        "status": 403
    }
}

Was this article helpful to you? Yes No