-
-
Notifications
You must be signed in to change notification settings - Fork 29
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.
- 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.
-
Open
DeactivateLicense.php
. -
Define the deactivation data as an associative array. Here’s 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.
-
Instantiate
DeactivateLicense
. -
Call the
deactivate()
method with the$deactivationData
array. Here’s 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.
DeactivateLicense.php
provides a response indicating the success or failure of the deactivation. Here’s what to expect:
- Success: If deactivation is successful, you’ll see a message confirming that the license was removed from the specified domain or device.
- Error: If there’s an issue (e.g., the license is already inactive), an error message will be displayed.
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);
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
.
After configuring and testing license deactivation, you can proceed to additional actions:
Updated and maintained by Epikly