Is this a client side library?
Closed this issue · 2 comments
I noticed this in the readme:
Do not use this package directly in the browser, as this will expose your API key. This would give anyone full API access to your Lemon Squeezy account and store(s).
I may be in the wrong place - but how can I use lemon.js in particular, handling events on the client side?
Thanks
Hey @coleridge72,
"lemonsqueezy.js" is a Javascript SDK for the Lemon Squeezy API: https://docs.lemonsqueezy.com/api
The SDK is designed for backend use and does not offer methods for frontend interaction.
"lemon.js" is a simple frontend JavaScript library for bringing some Lemon Squeezy functionalities, such as:
- Open Lemon Squeezy Checkout & Payment Method Update overlays (iframes)
- Listen to & handle checkout & payment details overlay events
For example, in React, you could do something like this:
useEffect(() => {
window.createLemonSqueezy();
window.LemonSqueezy.Setup({
eventHandler: (event) => {
// Do whatever you want with this event data
console.log(event);
},
});
}, []);
assuming you have already loaded lemon.js script in your app.
Thanks for clarifying!