Lemon.js Methods

Global LemonSqueezy object, offers methods for setup, refreshing listeners, opening and closing URLs, and handling affiliate tracking.


Available methods

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

MethodDescription
LemonSqueezy.Setup(options)Initializes 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

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
}

Was this page helpful?