Skip to main content

License check

Check whether a grantee is licensed to perform actions in your system.

Features, capabilities, and plans that belong to your user are checkable.

import { getGrantee } from '@salable/js';

const { hasCapability } = await getGrantee({
apiKey: 'your-salable-api-key',
productUuid: 'your-products-uuid',
granteeId: 'your-grantees-id',

// Check for a capability
const isUserLicensedToPerformAction = hasCapability('acme-inc-whitelabelling');
// or a feature
const isUserLicensedToPerformAction = hasCapability('csv-export');
// or a plan
const isUserLicensedToPerformAction = hasCapability('pro');
Grace Period

If the customer's payment fails, and you would like to give them a grace period to rectify this — you can use the optional grace parameter to extend the license capability check by a specified number of days.

This is not currently supported on @salable/js.