-
Notifications
You must be signed in to change notification settings - Fork 26
License
Branko Conjic edited this page Feb 8, 2024
·
2 revisions
Activate a license key and receive an instance ID in return.
import { type ActivateLicense, activateLicense } from '@lemonsqueezy/lemonsqueezy.js';
const licenseKey = '38b1460a-5104-4067-a91d-77b872934d51';
const { statusCode, error, data } = await activateLicense(licenseKey, 'Test');
/**
* Activate a license key.
*
* @param licenseKey The license key.
* @param instanceName A label for the new instance to identify it in Lemon Squeezy.
* @returns A response object containing `activated`, `error`, `license_key`, `instance`, `meta`.
*/
declare function activateLicense(licenseKey: string, instanceName: string): Promise<FetchResponse<ActivateLicense>>;
{
statusCode: number | null;
error: Error | null;
data: ActivateLicense | null;
}
Validate a license key or license key instance.
import { type ValidateLicense, validateLicense } from '@lemonsqueezy/lemonsqueezy.js';
const licenseKey = '38b1460a-5104-4067-a91d-77b872934d51';
const { statusCode, error, data } = await validateLicense(licenseKey);
With the optional instanceId
:
import { type ValidateLicense, validateLicense } from '@lemonsqueezy/lemonsqueezy.js';
const licenseKey = '38b1460a-5104-4067-a91d-77b872934d51';
const instanceId = '47596ad9-a811-4ebf-ac8a-03fc7b6d2a17';
const { statusCode, error, data } = await validateLicense(licenseKey, instanceId);
/**
* Validate a license key or license key instance.
*
* @param licenseKey The license key.
* @param [instanceId] (Optional) If included, validate a license key instance, otherwise a license key. If no `instance_id` is provided, the response will contain "instance": `null`.
* @returns A response object containing `valid`, `error`, `license_key`, `instance`, `meta`.
*/
declare function validateLicense(licenseKey: string, instanceId?: string): Promise<FetchResponse<ValidateLicense>>;
{
statusCode: number | null;
error: Error | null;
data: ValidateLicense | null;
}
Deactivate a license key instance.
import { type DeactivateLicense, deactivateLicense } from '@lemonsqueezy/lemonsqueezy.js';
const licenseKey = '38b1460a-5104-4067-a91d-77b872934d51';
const instanceId = '47596ad9-a811-4ebf-ac8a-03fc7b6d2a17';
const { statusCode, error, data } = await deactivateLicense(licenseKey, instanceId);
/**
* Deactivate a license key instance.
*
* @param licenseKey The license key.
* @param instanceId The instance ID returned when activating a license key.
* @returns A response object containing `deactivated`, `error`, `license_key`, `meta`.
*/
declare function deactivateLicense(licenseKey: string, instanceId: string): Promise<FetchResponse<DeactivateLicense>>;
{
statusCode: number | null;
error: Error | null;
data: DeactivateLicense | null;
}