Timed Trials
Timed trials let customers evaluate your app for a limited period before buying. A trial activation is keyless, so the user starts one without entering a license key. Cryptlex trials are verified and node-locked, so a trial does not reset if the user reinstalls your app or reformats the machine. Each trial activation appears in the admin portal under Trials -> Trial Activations.
How a trial works
- Start the trial on first run with
ActivateTrial(). Call it once, ideally on a button click, not on every start, since each call re-validates against the Cryptlex servers. - Verify on every start with
IsTrialGenuine(), after yourIsLicenseGenuine()check, and read the time left withGetTrialExpiryDate(). This works offline. - If verification returns any other status, the trial has either not been activated on this machine yet or could not be validated. Handle the returned status before deciding to call
ActivateTrial(). - When the trial expires, the functions return
LA_TRIAL_EXPIRED; prompt the user to buy a license.
Extending a trial
You can extend a trial to give a customer more time to evaluate your product:
- Ask the customer for their trial ID. Your app gets it with
GetTrialId(). - In the admin portal, open
Trials -> Trial Activations, search for the trial ID, and from the actions menu chooseUpdate Expiration Date, pick the new date, and clickUpdate. - In your app, call
SyncTrialActivation()to pull the new expiry date to the client without reactivation. It also refreshes trial activation metadata if you have set any.
Sample code
For the full flow and per-language samples, see Using LexActivator.
// On every start, after the IsLicenseGenuine() check
status = IsTrialGenuine();
if (LA_OK == status) {
// trial is active
unsigned int trialExpiryDate = 0;
GetTrialExpiryDate(&trialExpiryDate);
} else if (LA_TRIAL_EXPIRED == status) {
// trial has expired, prompt the user to buy a license
} else {
// trial has not started, start it (for example, on a button click)
status = ActivateTrial();
}Last updated: