When using Kotaqx License Whitelist for EDD, you may restrict license activations to a set of allowed URLs.
If a site attempts to activate a license on a URL that is not included in the whitelist, the activation request will fail with a specific error code.
This document explains how developers can detect this condition and respond accordingly.
Error Response Example
When calling:
?edd_action=activate_license
EDD Software Licensing returns a JSON response.
If the requested URL is not in the whitelist, the response includes the following error:
{
"item_id": 7,
"item_name": "My Digital Product",
"license": "invalid",
"success": false,
"checksum": "c7f7370deb8dxxxxx81581ba3c509788",
"error": "url_not_whitelisted",
"expires": "lifetime",
"payment_id": 1,
"customer_name": "Kotak Digital",
"customer_email": "[email protected]",
"price_id": false,
"license_limit": 0,
"site_count": 1,
"activations_left": "unlimited",
"is_local": true
}
The important piece of information is:
"error": "url_not_whitelisted"
What Does “url_not_whitelisted” Mean?
This error indicates that:
- The domain or site URL making the activation request
- Is not included in the allowed domain list for the license key
- And therefore cannot be activated
This is part of the License Whitelist enforcement provided by Kotaqx License Whitelist for EDD.
Detecting the Error in Your Code
PHP Example (Client Plugin / Theme)
$response = wp_remote_get( $activation_url );
if ( is_wp_error( $response ) ) {
// Network or request-level error.
return;
}
$data = json_decode( wp_remote_retrieve_body( $response ), true );
if ( isset( $data['error'] ) && $data['error'] === 'url_not_whitelisted' ) {
// The activation was rejected because the site URL is not permitted.
error_log( 'License activation failed: URL not whitelisted.' );
}
JavaScript Example (REST or AJAX-based Licensing)
fetch(activationUrl)
.then(response => response.json())
.then(data => {
if (data.error === 'url_not_whitelisted') {
console.error('Activation failed: URL not whitelisted.');
}
});
Handling the Error Gracefully
If you want to provide a user-friendly message inside your plugin UI, you may translate the error like:
“Your license cannot be activated because this website URL is not allowed.
Please contact support to add this site to your whitelist.”
Example in PHP:
if ( $data['error'] === 'url_not_whitelisted' ) {
$message = __(
'This site URL is not whitelisted for this license. Please contact support to add it.',
'text-domain'
);
}