1. Home
  2. Docs
  3. WooCommerce License Keys
  4. API
  5. Endpoint: Activation

Endpoint: Activation

Before continuing, please read the basics article 

Endpoint used to remotely activate (or register) a license key (or product).

Request parameters

action
string
This identifies the endpoint wanted. Should always be `license_key_activate`for this endpoint.

store_code
string
Store code provided in the License Keys API settings page. This is a security code used to validate the store.

sku
string
Product SKU.

license_key
string
Customer’s license key code.

domain
string
Domain. (optional) This parameter is not required for desktop products.

Request example

Use the following piece of code (at Code Pen) as example:

Responses

All responses are returned in JSON format.

Successful response

{
    "error": false,
    "status": 200,
    "message": "License Key activated successfully.",
    "data": {
        "expire": 1582657054,
        "activation_id": 1519628117,
        "expire_date": "2020-02-25 18:57",
        "timezone": "UTC",
        "the_key": "Cqu62al903ICv40am9nM68Y7o9-32",
        "url": "http://domain/my-account/view-license-key/?key=test-32",
        "has_expired": false,
        "status": "active",
        "allow_offline": true,
        "offline_interval": "days",
        "offline_value": 1,
        "downloadable": {
            "name": "v1.1.5",
            "url": "https://domain/product-1.1.5.zip"
        },
        "ctoken": "dsfejk8989"
    }
}

When the activation is successful, the response above will be returned. Data information:

expire
long
Expire date as a time value (Unix timestamp).

activation_id
long
Activation identifier. It also holds the date in which the activation was activated (Unix timestamp).

expire_date
string
Expire date formatted with selected WordPress date format.

timezone
string
Server’s timezone in which dates have been calculated.

the_key
string
Customers license key.

url
string
License Key url at WooCommerce’s “My Account” page.

has_expired
bool
Flag indicating if license key has expired.

status
string
Status tag. ‘active’ or ‘inactive’ based on expiration.

allow_offline
bool
Flag that indicates if product should be allowed on an offline environment.

offline_interval
string
Offline interval. (i.e. hours, days, months)

offline_value
string
Offline interval value. (i.e. 4 hours, 5 days, 1 months)

downloadable
object
Only available on paid extension. Contains the information of the downloadable product, this can be used for automatic updates.

ctoken
string
Only available on paid extension. The cart token used to create renewal or extension links in the product.

Failed response

{
    "error": true,
    "status": 500,
    "errors": {
        "license_key": [
            "Invalid license key."
        ],
        "activation_id": [
            "Invalid activation."
        ]
    }
}

View this article to change the way errors are returned.

Was this article helpful to you? Yes 1 No