---
title: "Lemon Squeezy · Nuxt Scripts"
description: "Use Lemon Squeezy in your Nuxt app."
canonical_url: "https://scripts.nuxt.com/scripts/v0/payments/lemon-squeezy"
meta:
  "og:description": "Use Lemon Squeezy in your Nuxt app."
  "og:image": "https://scripts.nuxt.com/_og/d/c_Docs%2Ctitle_Lemon%2BSqueezy%2Cdescription_Use%2BLemon%2BSqueezy%2Bin%2Byour%2BNuxt%2Bapp.%2Cheadline_Payments%2Cp_Ii9zY3JpcHRzL3YwL3BheW1lbnRzL2xlbW9uLXNxdWVlenki%2Cs__5-m50oi8VfpR-wz.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Lemon Squeezy · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/d/c_Docs%2Ctitle_Lemon%2BSqueezy%2Cdescription_Use%2BLemon%2BSqueezy%2Bin%2Byour%2BNuxt%2Bapp.%2Cheadline_Payments%2Cp_Ii9zY3JpcHRzL3YwL3BheW1lbnRzL2xlbW9uLXNxdWVlenki%2Cs__5-m50oi8VfpR-wz.png"
---

> Index of every page on this site: [llms.txt](https://scripts.nuxt.com/llms.txt)

**Payments**

# **Lemon Squeezy**

[Copy for LLMs](https://scripts.nuxt.com/scripts/v0/payments/lemon-squeezy.md)

[**Lemon Squeezy**](https://www.lemonsqueezy.com/) is a popular payment gateway that allows you to accept payments online.

Nuxt Scripts provides a [**useScriptLemonSqueezy**](#usescriptlemonsqueezy) composable and a headless Facade Component [**ScriptLemonSqueezy**](#scriptlemonsqueezy) component to interact with lemon squeezy.

## ScriptLemonSqueezy

The `**ScriptLemonSqueezy**` component is headless [**Facade Component**](https://scripts.nuxt.com/docs/v0/guides/facade-components) wrapping the **useScriptLemonSqueezy** composable, providing a simple, performance optimized way to load Lemon Squeezy in your Nuxt app.

```vue
<template>
<ScriptLemonSqueezy>
  <NuxtLink href="https://harlantest.lemonsqueezy.com/buy/52a40427-36d2-4450-a514-ae80d9e1a333?embed=1">
    Buy me - $9.99
  </NuxtLink>
</ScriptLemonSqueezy>
</template>
```

It works by injecting a `**.lemonsqueezy-button**` class onto any `**a**` tags within the component then loading in the Lemon Squeezy script with the `**visibility**` [**Element Event Trigger**](https://scripts.nuxt.com/docs/v0/guides/script-triggers#element-event-triggers).

### Demo

[**Buy me - $9.99 **](https://harlantest.lemonsqueezy.com/buy/52a40427-36d2-4450-a514-ae80d9e1a333?embed=1) [**Buy me - pay what you want **](https://harlantest.lemonsqueezy.com/buy/76bbfa74-a81a-4111-8449-4f5ad564ed76?embed=1)

**Lemon Squeezy is not loaded**

It loads in when the DOM element is within the viewport.

### Component API

See the [**Facade Component API**](https://scripts.nuxt.com/docs/v0/guides/facade-components#facade-components-api) for full props, events, and slots.

### Events

***`**lemon-squeezy-event**`***

Events emitted by the Lemon.js script are forwarded through this event. The payload is an object with an `**event**` key and a `**data**` key.

```ts
export type LemonSqueezyEventPayload = { event: 'Checkout.Success', data: Record<string, any> }
  & { event: 'Checkout.ViewCart', data: Record<string, any> }
  & { event: 'GA.ViewCart', data: Record<string, any> }
  & { event: 'PaymentMethodUpdate.Mounted' }
  & { event: 'PaymentMethodUpdate.Closed' }
  & { event: 'PaymentMethodUpdate.Updated' }
  & { event: string }
```

## useScriptLemonSqueezy

The `**useScriptLemonSqueezy**` composable lets you have fine-grain control over the Lemon Squeezy SDK. It provides a way to load the Lemon Squeezy SDK and interact with it programmatically.

```ts
export function useScriptLemonSqueezy<T extends LemonSqueezyApi>(_options?: LemonSqueezyInput) {}
```

Please follow the [**Registry Scripts**](https://scripts.nuxt.com/docs/v0/guides/registry-scripts) guide to learn more about advanced usage.

### LemonSqueezyApi

```ts
export interface LemonSqueezyApi {
  /**
   * Initialises Lemon.js on your page.
   * @param options - An object with a single property, eventHandler, which is a function that will be called when Lemon.js emits an event.
   */
  Setup: (options: {
    eventHandler: (event: { event: 'Checkout.Success', data: Record<string, any> }
      & { event: 'Checkout.ViewCart', data: Record<string, any> }
      & { event: 'GA.ViewCart', data: Record<string, any> }
      & { event: 'PaymentMethodUpdate.Mounted' }
      & { event: 'PaymentMethodUpdate.Closed' }
      & { event: 'PaymentMethodUpdate.Updated' }
      & { event: string }
    ) => void
  }) => void
  /**
   * Refreshes `lemonsqueezy-button` listeners on the page.
   */
  Refresh: () => void

  Url: {
    /**
     * Opens a given Lemon Squeezy URL, typically these are Checkout or Payment Details Update overlays.
     * @param url - The URL to open.
     */
    Open: (url: string) => void

    /**
     * Closes the current opened Lemon Squeezy overlay checkout window.
     */
    Close: () => void
  }
  Affiliate: {
    /**
     * Retrieve the affiliate tracking ID
     */
    GetID: () => string

    /**
     * Append the affiliate tracking parameter to the given URL
     * @param url - The URL to append the affiliate tracking parameter to.
     */
    Build: (url: string) => string
  }
  Loader: {
    /**
     * Show the Lemon.js loader.
     */
    Show: () => void

    /**
     * Hide the Lemon.js loader.
     */
    Hide: () => void
  }
}
```

## Example

Using the Lemon Squeezy SDK with a payment link.

```vue
<script setup lang="ts">
const { proxy } = useScriptLemonSqueezy()
onMounted(() => {
  proxy.Setup()
})
</script>

<template>
  <a href="https://harlantest.lemonsqueezy.com/buy/52a40427-36d2-4450-a514-ae80d9e1a333?embed=1" class="lemonsqueezy-button" />
</template>
```

[Edit this page](https://github.com/nuxt/scripts/edit/0.x/docs/content/payments/lemon-squeezy.md)

[Markdown For LLMs](https://scripts.nuxt.com/scripts/v0/payments/lemon-squeezy.md)

[**Hotjar** Use Hotjar in your Nuxt app.](https://scripts.nuxt.com/scripts/v0/marketing/hotjar) [**PayPal** Use PayPal in your Nuxt app.](https://scripts.nuxt.com/scripts/v0/payments/paypal)

**On this page **

- [ScriptLemonSqueezy](#scriptlemonsqueezy)
- [useScriptLemonSqueezy](#usescriptlemonsqueezy)
- [Example](#example)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scripts.nuxt.com/#website","@type":"WebSite","description":"Nuxt Scripts lets you load third-party scripts with better performance, privacy, security and DX. It includes many popular third-parties out of the box.","name":"Nuxt Scripts","url":"https://scripts.nuxt.com/","publisher":{"@id":"https://scripts.nuxt.com/#identity"}},{"@id":"https://scripts.nuxt.com/scripts/v0/payments/lemon-squeezy#webpage","@type":"WebPage","description":"Use Lemon Squeezy in your Nuxt app.","name":"Lemon Squeezy","url":"https://scripts.nuxt.com/scripts/v0/payments/lemon-squeezy","breadcrumb":{"@id":"https://scripts.nuxt.com/scripts/v0/payments/lemon-squeezy#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/scripts/v0/payments/lemon-squeezy"]}],"primaryImageOfPage":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/#identity","@type":"Organization","name":"Nuxt Scripts","url":"https://scripts.nuxt.com","logo":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/scripts/v0/payments/lemon-squeezy#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Nuxt Scripts","item":"https://scripts.nuxt.com/","position":1},{"@type":"ListItem","name":"Scripts","item":"https://scripts.nuxt.com/scripts","position":2},{"@type":"ListItem","name":"V0","item":"https://scripts.nuxt.com/scripts/v0","position":3},{"@type":"ListItem","name":"Payments","item":"https://scripts.nuxt.com/scripts/v0/payments","position":4},{"@type":"ListItem","name":"Lemon Squeezy","item":"https://scripts.nuxt.com/scripts/v0/payments/lemon-squeezy","position":5}]},{"@id":"https://scripts.nuxt.com/#logo","@type":"ImageObject","caption":"Nuxt Scripts","contentUrl":"https://scripts.nuxt.com/logo.svg","inLanguage":"en","url":"https://scripts.nuxt.com/logo.svg"}]}
```

## Sitemap

See the full [sitemap](https://scripts.nuxt.com/sitemap.md) for all pages.
