-
Notifications
You must be signed in to change notification settings - Fork 26
lemonSqueezySetup
Branko Conjic edited this page Feb 8, 2024
·
2 revisions
Initialization configuration.
Only three functions (
activateLicense
,validateLicense
,deactivateLicense
) operate without requiring an API key. To use other functions, you must employlemonSqueezySetup
to configure theapiKey
before utilization.
Create a new API key: https://app.lemonsqueezy.com/settings/api.
import { lemonSqueezySetup } from '@lemonsqueezy/lemonsqueezy.js';
lemonSqueezySetup({
apiKey: 'Your Lemon Squeezy API Key',
});
import { lemonSqueezySetup } from '@lemonsqueezy/lemonsqueezy.js';
lemonSqueezySetup({
apiKey: import.meta.env.LEMON_SQUEEZY_API_KEY,
onError(error) {
console.log(error);
},
});
type Config = {
/**
* `Lemon Squeezy` API Key
*/
apiKey?: string;
/**
* Fires after a fetch response error
*
* @param error Error
* @returns void
*/
onError?: (error: Error) => void;
};
/**
* Lemon squeezy setup.
*
* @param config The config.
* @returns User configuration.
*/
declare function lemonSqueezySetup(config: Config): Config;