Skip to content

Endpoint: Deactivate

Alejandro Mostajo edited this page Feb 26, 2018 · 2 revisions

API's deactivate endpoint will let you deactivate a license key.

Call and parameters

$response = Api::deactivate($client, $getClosure, $setClosure);

Parameters

Parameter Type Description
$client Client An instance of the client.
$getClosure Closure A function that should return an instance of LicenseRequest.
$setClosure Closure A function used removed and delete the activated license string.

Response

Type Description
null If response is empty.
object The decoded response as an object. Use $response->error to check if response had an error. Use $response->errors for the list of errors. Use $response->message for the message returned by the API.

Usage

The following example will show how to deactivate a license key and how to delete the stored license string.

$response = Api::deactivate(
    Client::instance(), // Client instance
    function() {

        // ---------------------------------------------
        // Code here...
        // Code to load the LICENSE STRING saved on activation.
        // Apply decryption if necessary.
        // ---------------------------------------------

        // MUST RETURN AN INSTANCE OF LicenseRequest

        return new LicenseRequest($licenseString);

    }, // getClosure
    function($licenseString) {

        // ---------------------------------------------
        // Code here...
        // Code to delete the LICENSE STRING saved on activation.
        // ---------------------------------------------
        
        // as sample
        if ($licenseString === null)
            delete_license();

    } // setClosure
);
Clone this wiki locally