★ Lifetime licenses available on every product
SupportLicense APIMy downloads

License API

Every paid product comes with a license key. Your plugin or PHP project calls these endpoints to activate the key on a website, check it, or free up the slot.

EndpointWhat it does
POST /api/license/activateAdds the domain to the key (if slots are left)
POST /api/license/deactivateRemoves the domain so the key can be used elsewhere
POST /api/license/checkIs the key valid and active on this domain?

Parameters (JSON or form data): license_key, domain, and optionally product (the product slug). Domains are normalised: https://www.Example.com/shop becomes example.com.

Example request

curl -X POST https://www.afojet.com/api/license/activate \
  -H "Content-Type: application/json" \
  -d '{"license_key":"AFO-XXXX-XXXX-XXXX-XXXX","domain":"example.com","product":"my-plugin"}'

Example response

{
  "success": true,
  "message": "activated",
  "status": "valid",            // valid | expired | revoked
  "product": "my-plugin",
  "latest_version": "1.2.0",
  "plan": "1 Year",
  "expires": "2027-10-25T00:00:00.000Z",   // or "lifetime"
  "activations": 1,
  "max_activations": 1,
  "activations_left": 0,
  "domain_active": true
}

Errors return success: false with an error code: invalid_license, wrong_product, license_expired, license_revoked, activation_limit_reached, domain_not_active, invalid_domain, rate_limited.

Automatic updates for WordPress plugins

Mark the product as a WordPress plugin in the admin and fill in "Requires WordPress", "Tested up to" and the plugin folder name. Then add our updater class to your plugin. WordPress will show"There is a new version available", the View details box (description, changelog, screenshots, requirements, banner) and one-click updates — only for sites with a valid, activated licence.

Download class-afojet-updater.php

// my-plugin.php
require_once __DIR__ . '/includes/class-afojet-updater.php';
new Afojet_Updater( __FILE__, array(
    'slug'           => 'my-plugin',          // plugin folder name
    'version'        => '1.2.0',              // this plugin's version
    'license_option' => 'my_plugin_license',  // where the key is saved
) );

// On your settings page, when the customer saves a key:
$result = Afojet_Updater::activate( $_POST['license_key'], 'my-plugin', 'my_plugin_license' );

// Anywhere you need to check it:
if ( Afojet_Updater::is_valid( 'my-plugin', 'my_plugin_license' ) ) { /* premium features */ }

The update check calls https://www.afojet.com/api/wp/info?slug=my-plugin&version=1.2.0&license_key=…&domain=…. Anyone can read the plugin information; the download link is only included for a valid licence that is active on that site, and it expires after 24 hours.

Plugins made for the old store (EDD)

Plugins built with Easy Digital Downloads Software Licensing keep working unchanged: send edd_action (activate_license, deactivate_license, check_license, get_version), license, item_id or item_name and url to https://www.afojet.com as before. Answers use EDD's format.

WordPress / PHP snippet

<?php
// Put this in your plugin / PHP project.
function afojet_license_call($action, $key, $product_slug) {
    $res = wp_remote_post('https://www.afojet.com/api/license/' . $action, [
        'timeout' => 15,
        'body'    => [
            'license_key' => $key,
            'domain'      => home_url(),      // or $_SERVER['HTTP_HOST'] outside WordPress
            'product'     => $product_slug,
        ],
    ]);
    if (is_wp_error($res)) return null;
    return json_decode(wp_remote_retrieve_body($res), true);
}

// $r = afojet_license_call('activate', $key, 'my-plugin');
// if ($r && $r['success']) { update_option('my_plugin_license', $key); }