Skip to content

Payments ​

Nuxt SaaS Kit comes with support for Lemon Squeezy out of the box. This allows you to start accepting payments from your customers right away.

Setting up Lemonsqueezy ​

  • To get started, create an account or login into your Lemonsqueezy
  • Create a new store and retrive your store URL and store ID. To do so, go to Settings > Stores. You'll find the Store ID next to the Store URL. Copy the Store URL and ID and update the environment variable:
LEMONSQUEEZY_STORE_ID="YOUR_STORE_ID"
LEMONSQUEEZY_STORE_URL="YOUR_STORE_URL"
  • Next, you have to create a product in the created store. Fill in the form fields. After completing the creation of the product. We'll be using the information in the pricing-plans.ts file:
ts
export type BillingFrequency = 'month' | 'year'

export type Plan = {
  id: number
  title: string
  description: string
  features: string[]
  prices: {
    price?: number
    currency?: string
    frequency: BillingFrequency
    productId?: string
    variantId?: string
  }[]
  cta: string
  mostPopular: boolean
}

export const currency = 'USD'

export const defaultPlans: Plan[] = [
    {
        // add your pricing plans
    }

]

Example ​

ts
{
    id: 1,
    title: 'Basic',
    description: 'The essentials to provide your best work for clients',
    features: [
      '5 products',
      'Up to 1,000 subscribers',
      'Basic analytics',
      '48-hour support response time',
    ],
    prices: [
      {
        price: 24,
        frequency: 'month',
        productId: 'jd8jde-sdjju-wca',
        variantId: '',
      },
      {
        price: 200,
        frequency: 'year',
        productId: '',
        variantId: '',
      },
    ],
    cta: 'Start your trial',
    mostPopular: false,
  },

Generate your API Key ​

To integrate with Lemonsqueezy, you need an API Key.

  • Go to Settings > API to create an API Key
  • Follow the process to generate the API Key. Copy the key and add it to your .env file
LEMONSQUEEZY_API_KEY="YOUR_API_KEY"

Webhook Integration ​

To integrate Lemonsqueezy to able to save data on the database, you need to configure webhook.

  • Go to Settings > Webhooks to create a new webhook.
  • Add your webhook URL
  • Generate a new webhook signing secret and copy it into the .env file
LEMONSQUEEZY_SIGNING_SECRET="YOUR_SECRET"
  • Select the actions below to be triggered by the webhook:

    • subscription_created
    • subscription_updated
    • subscription_cancelled
    • subscription_resumed
    • subscription_expired
    • subscription_paused
    • subscription_unpaused
    • subscription_payment_failed
    • subscription_payment_success
    • subscription_payment_recovered
    • subscription_payment_refunded
    • subscription_plan_changed