1 Deactivating a License
Michel edited this page 2024-11-04 18:59:38 -05:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Deactivating a License

The DeactivateLicense.php file allows you to deactivate a license from a specific domain or device. This action is useful when freeing up a license for use elsewhere. This guide will walk you through configuring and using DeactivateLicense.php to manage license deactivation.

Prerequisites

  • Ensure CoreConfig.php is configured with your API URL and secret key.
  • Verify that LicenseAPI.php is included in your project, as it provides the core method for deactivating licenses.

How to Use DeactivateLicense.php

Step 1: Set Up the Deactivation Data

  1. Open DeactivateLicense.php.

  2. Define the deactivation data as an associative array. Heres an example with basic fields:

    $deactivationData = [ 'license_key' => 'YOUR_LICENSE_KEY', // License key to deactivate 'registered_domain' => 'example.com', // Optional: Domain to deactivate 'registered_devices' => 'Device12345' // Optional: Device identifier ];

    Use either registered_domain, registered_devices, or both, depending on where the license is registered and needs to be deactivated.

Step 2: Call the deactivate Method

  1. Instantiate DeactivateLicense.

  2. Call the deactivate() method with the $deactivationData array. Heres how:

    require_once 'DeactivateLicense.php';

    $deactivateLicense = new DeactivateLicense(); $deactivateLicense->deactivate($deactivationData);

    This sends a request to deactivate the license from the specified domain and/or device.

Step 3: Handle the Response

DeactivateLicense.php provides a response indicating the success or failure of the deactivation. Heres what to expect:

  • Success: If deactivation is successful, youll see a message confirming that the license was removed from the specified domain or device.
  • Error: If theres an issue (e.g., the license is already inactive), an error message will be displayed.

Example Usage

Below is a complete example of using DeactivateLicense.php to deactivate a license:

require_once 'DeactivateLicense.php';

$deactivationData = [ 'license_key' => 'YOUR_LICENSE_KEY', 'registered_domain' => 'example.com', 'registered_devices' => 'Device12345' ];

$deactivateLicense = new DeactivateLicense(); $deactivateLicense->deactivate($deactivationData);

Deactivation Error Handling

The DeactivateLicense.php script includes error handling for the following scenarios:

  • Already Inactive: Notifies the user if the license is already inactive on the specified domain or device.
  • Missing Domain or Device: Alerts the user if the specified domain or device is not found.

For detailed response handling, review the code in DeactivateLicense.php.

Next Steps

After configuring and testing license deactivation, you can proceed to additional actions: