Skip to content

Activating a License

Michel edited this page Nov 4, 2024 · 1 revision

Activating a License

The ActivateLicense.php file allows you to activate a license for a specific domain or device, securely communicating with the SLM Plus API. This guide will walk you through configuring and using ActivateLicense.php to manage license activation.

Prerequisites

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

How to Use ActivateLicense.php

Step 1: Set Up the Activation Data

  1. Open ActivateLicense.php.

  2. Define the activation data as an associative array. Here’s an example of required fields:

    $activationData = [ 'license_key' => 'YOUR_LICENSE_KEY', // The license key to activate 'registered_domain' => 'example.com', // Domain to associate with the license 'registered_devices' => 'Device12345' // Optional: Device identifier ];

    Adjust these fields based on the specific domain or device information you want to activate.

Step 2: Call the activate Method

  1. Instantiate ActivateLicense.

  2. Call the activate() method with the $activationData array. Here’s how:

    require_once 'ActivateLicense.php';

    $activateLicense = new ActivateLicense(); $activateLicense->activate($activationData);

    This sends a request to activate the license on the specified domain and/or device.

Step 3: Handle the Response

ActivateLicense.php provides a response indicating the success or failure of the activation attempt. Here’s what to expect:

  • Success: If activation is successful, you’ll see a message confirming activation for the specified domain and/or device.
  • Error: If there’s an issue (e.g., maximum allowed domains or devices reached), an error message will be displayed.

Example Usage

Below is a complete example of using ActivateLicense.php to activate a license:

require_once 'ActivateLicense.php';

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

$activateLicense = new ActivateLicense(); $activateLicense->activate($activationData);

Activation Error Handling

The ActivateLicense.php script includes specific error handling to cover scenarios like:

  • Expired License: Notifies the user if the license is expired.
  • Blocked License: Alerts the user if the license is blocked.
  • Max Domains or Devices Reached: Provides a message if the license has reached its allowed limit of domains or devices.

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

Next Steps

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