Once Lemon.js is loaded on your page, you'll have access to a global LemonSqueezy object. It has the following available methods:

LemonSqueezy.Setup(options)Initialises Lemon.js on your page. Setup options
LemonSqueezy.Refresh()Refreshes lemonsqueezy-button listeners on the page, useful for SPAs
LemonSqueezy.Url.Open(url)Opens a given Lemon Squeezy URL, typically these are Checkout or Payment Details Update overlays
LemonSqueezy.Url.Close()Closes the current opened Lemon Squeezy overlay checkout window
LemonSqueezy.Affiliate.GetID()Retrieve the affiliate tracking ID
LemonSqueezy.Affiliate.Build(url)Append the affiliate tracking parameter to the given URL

We're constantly shipping new updates and features to make the developer experience better. You can help us improve the experience by chatting to us about your experience.

Setup Method Options

The LemonSqueezy.Setup() method takes an object, this object can have the following values:

  • eventHandler - Callback Function
eventHandler: (event) => { // Do whatever you want with this event data }
Handling events