Code Example

$curl = curl_init();

$endpoint = '{{domain}}/wp-json/wclm/v3/register-license-key';
$parameters = array(
        // 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;

This endpoint can be used to allow your customers to claim license keys sold by your resellers. For a license key to be claimable, it has to have the license status “unregistered”.

This endpoint will create a new order (with $0 total) and assign the license key to it.

API Responses

{
    "response": {
        "result": "success",
        "code": "915",
        "message": "Unregistered license key assigned",
        "api_timestamp": 'current timestamp'
    },
    "signature": "Signature or OpenSSL error"
}
{
    "response": {
        "result": "error",
        "code": "910",
        "message": "Unregistered license key not found",
        "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