First of all, thank you for choosing and trusting Dike to grow together!
This documentaion will guide you through the few steps necessary to empower your products with the Dike licenses manager platform.
Dike is mainly addressed to WordPress products, however you could use it also for other products (eg. javascript plugins) to take advantage of its licenses and support entitlement tracking.
As mandatory requirement, remember you must have a public web space where to upload a PHP file handling validation calls coming from your customer websites.
WHY?
In case Dike services stop (for whatever reason) or you want to stop using them, you will be able to address your customer validation calls and unlock products. Otherwise, Dike codes included in your products will block them and customers wouldn't be happy for sure.
To use the platform systems you must be able to read and manage PHP code. Knowing also HTML and CSS could be handy, but they shouldn't be a problem for any web developer!
The system works on any server running PHP (at least v5.5) and requires WordPress v4 and later.
No extra dependency. Neither jQuery.
Once registered, you are moved to the admin dashboard. However your account needs to be set up in order to have the platform ready.
in there you must upload your logo, set an operative e-mail address and your color scheme. Optionally specify the support platform link and enable trial licenses. The custom CSS field's aim is to customize your platform aspect.
sections are the natural solution to wrap products in case of bundles or specific sections. Even if you have only standalone products, you have to create them
Finally insert your products (NB: remember to use referral links!)
Once you do this, the platform will be ready to be used!
Your personal URL is: https://your-username.dikelicensing.com
Remember all Envato calls are signed with your username and app token you entered in the registration phase.
Be careful to not delete it!
Your customers must be uniquely addressed to your platform URL: it will autonomously handle registration and login.
Here are some infos about the process, in case you get related help requests.
All the e-mails listed in this documentation will be sent using the address you specified in the "Operative e-mail address"
In fact, to guarantee the maximum security level, the login system uses a bank-like numerical token expiring in an hour.
No concurrent sessions are allowed.
Everything is projected to be extremely straightforward and easy also for the "most problematic" customers you might have.
Here's the explaination taking LCweb as example:
Integrating Dike, your customers will need to follow the validation process in order to get the activation token and use your product. Remember to create a dedicated chapter in your product's documentation to guide them!
Dike creates a strictly personal WordPress dashboard panel related to your products, where customers have to activate their licenses.
Codes are strictly private and tailored on you. Head to this page and follow the step-by-step integration.
Is essential to understand how Dike works: you are about to lock your products forcing customers to perform additional steps.
Prior notes:
Activation tokens are given by your platform and their usage its tracked
The validation engine supports also localhost setups.
It's mandatory to have this URL structure though: localhost:PORT-NUMBER (eg. https://localhost:8888/ )
One of the best Dike advantages is the ability to give 7-days free trials to potential customers. This brings two big pros:
Trias are totally optional though.
You can enable them in your Account Settings page. Is also possible to disable trials for specific products, in the "edit product" form.
Trial licenses can be requested in your Dike platform area: https://your-username.dikelicensing.com/trial-license-request.
You can also add specific URL parameters in order to pre-fill and/or disable fields, in order to create specific, straightforward, landing pages.
Parameter name | Description |
---|---|
prod | Selects a product by default. Use the Envato marketplace |
domain | Fills the domain field. Use a domain name (eg. dikelicensing.com) |
Fills the e-mail field. Use a valid e-mail address | |
disabled | Disables one or more fields (to avoid data edit). Value is a string composed by one or more (comma split) field names. Available field names to use: prod, domain, email |
The Dike platform offers also an API endpoint to retrieve or validate specific data.
It is related to your account: https://your-username.dikelicensing.com/bridge.php
Here's an example using a cURL call, written as function to be quickly used 😉
<?php
/*
* Call Dike API endpoint
* @return (string|array)
* - a string if cURL or data decode error is found
* - an array containing response data
*/
function call_dike_api($action, $params) {
$params = array_merge(
array(
"action" => $action,
"api_key" => "YOUR-DIKE-API-KEY"
),
$params
);
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => "YOUR-DIKE-PLATFORM-URL/bridge.php",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => http_build_query($params),
CURLOPT_TIMEOUT => 5
));
if(curl_errno($ch) > 0) {
return curl_error($ch);
}
// return response
$response = @curl_exec($ch);
if(curl_getinfo($ch, CURLINFO_HTTP_CODE) != 200) {
return (string)$response;
}
// decode
$decoded_response = json_decode($response, true);
if(json_last_error() !== JSON_ERROR_NONE) {
return $response;
}
return $decoded_response;
}
Passing the customer username, returns an array containing licenses stored on your Dike platform, split by product ID
<?php
$params = array(
"username" => "THE-CUSTOMER-USERNAME"
);
$response = call_dike_api("user_licenses", $params);
if(is_string($response)) {
trigger_error($response); // error case
}
else {
$licenses = $response["licenses"];
/*
data structure
array(
PRODUCT_ID_1 => array(
array(.. license 1 data ..),
array(.. license 2 data ..),
array(.. license 3 data ..),
),
PRODUCT_ID_2 => array(
array(.. license 1 data ..),
array(.. license 2 data ..),
array(.. license 3 data ..),
),
);
*/
}
Passing the Envato product ID, domain and token customer username, returns specific license data or specific errors.
By default a successfull check also redeems the token on the checked token, use the related parameter to avoid this.
<?php
$params = array(
"product_id" => (int)THE-PRODUCT-ID,
"domain" => "THE-DOMAIN", // must be a clean domain, for "https://dikelicensing.com" you must use "dikelicensing.com"
"token" => "THE-TOKEN",
"redeem_it" => false, // to not redeem, otherwise true or omit the parameter
);
$response = call_dike_api("validate_domain_token", $params);
if(is_string($response)) {
trigger_error($response); // error case
}
else {
// error found
if(!$response["response"]) {
switch($response["err_code"]) {
case "token_not_found" :
echo "Token not found";
break;
case "domain_not_matching" :
echo "Token not linked to this domain";
break;
case "product_not_matching" :
echo "Token not linked to this product";
break;
case "token_expired" :
echo "Token expired";
break;
default :
echo "Unknown error ..";
break;
}
}
// valid license data
else {
$license_data = $response;
/*
output structure
array(
"token_subj" // production, staging or trial
"support_expir" // support expiration datetime as returned by Envato API. Zero if token_subj == "trial"
"token_exp" // token expiration time (GMT) in case of trial or staging
"username" // if token_subj == "trial", it's the applicant e-mail, otherwise the customer username
);
*/
}
}
Dike assigns a user token strictly related to the customer. It could come handy to perform extra operations such as quick user recognition just passing the username. For example it is used to register users in the LCweb support website just using username + token and being sure they already registered on the platform.
The account token can be found in the account management popup.
If validation is successful, returns also user e-mail.
The token is dynamic, don't worry if you notice it changing over time 😉
<?php
$params = array(
"username" => "THE-CUSTOMER-USERNAME",
"token" => "USER-ACCOUNT-TOKEN"
);
$response = call_dike_api("user_token_check", $params);
if(is_string($response)) {
trigger_error($response); // error case
}
else {
if(!$response["test_passed"]) {
// wrong token
}
else {
// valid token
echo $response["user_email"];
}
}
A true search engine for your customers and their data.
Please check carefully available parameters and the returned array structure
<?php
$params = array(
"search" => "whatever", // (string) search among username, e-mail or purchase code. Use the "*" char to target any user
"page" => 1, // (int) search results page
"params" => array( // (array|false) defining search parameters array or use false to use default ones
"per_page" => 10, // (int) how many users per page? (max 100)
"orderby" => "username", // (string) query sorting column. Available columns `username`, `signup_date`, `validation_date`, `purch_date`, `email`
"order" => "ASC", // (string) query sorting method (ASC or DESC)
"product_ids" => false, // (array|false) whether to restrict query to specific product IDs. If false is used, will search among all of your products
"signup_range" => false, // (array|false) start/end datetime ranges (at least one specified) or false to not restrict query by dike signup date
"purch_range" => array("2022-01-01 00:00:00", "2022-07-01 00:00:00"), // (array|false) start/end datetime ranges (at least one specified) or false to not restrict query by product purchase date
),
);
$response = call_dike_api("search_users", $params);
if(is_string($response)) {
trigger_error($response); // error case
}
else {
$tot_users = $response["tot_users"]; // (int) overall queried customers count
$tot_pages = $response["tot_pags"]; // (int) search pages
$curr_page = $response["curr_pags"]; // (int) returned page number
$users = $response["users"]; // (array) query response
/*
data structure
array(
USER-ID => array(
"username",
"email",
"signup_date", // GMT datetime related to customer registration on your platform
"products" => array(
PRODUCT_ID_1 => array(
array(.. license 1 data ..),
array(.. license 2 data ..),
array(.. license 3 data ..),
),
PRODUCT_ID_2 => array(
array(.. license 1 data ..),
array(.. license 2 data ..),
array(.. license 3 data ..),
),
)
)
);
*/
}
If you need support over Dike systems or its integration