Lemon Squeezy
Last updated December 18, 2025

Overview

Lemon Squeezy is a payment platform designed for digital products and SaaS subscriptions. It handles VAT, tax compliance, and provides a hosted checkout experience similar to Gumroad.

Account Setup

  1. Go to lemonsqueezy.com and sign up
  2. Complete your store setup
  3. Connect a payment method (Stripe or PayPal)
  4. Verify your account and business details

Get API Keys

  1. In your Lemon Squeezy dashboard, go to "Settings" → "API"
  2. Click "Generate API Key"
  3. Name it (e.g., "Production" or "Development")
  4. Copy the API key - this is your LEMON_SQUEEZY_API_KEY
  5. Important: Store this securely - you won't be able to see it again
  6. You'll also need your Store ID, found in "Settings" → "Store"

Create Products

  1. Go to "Products" in your Lemon Squeezy dashboard
  2. Click "New Product"
  3. Fill in product details:
    • Name: Your subscription tier
    • Price: Set subscription pricing
    • Billing interval: Monthly, yearly, etc.
  4. Configure product settings (description, images, etc.)
  5. Save the product
  6. Copy the Variant ID (you'll need this for checkout links)
  7. Repeat for each subscription tier

Configure Webhooks

Webhooks notify your app when subscription events occur.

Step 1: Create Webhook

  1. Go to "Settings" → "Webhooks" in your Lemon Squeezy dashboard
  2. Click "Create Webhook"
  3. Set the endpoint URL:
    • Development: http://localhost:3000/api/webhooks/lemonsqueezy (use ngrok for local testing)
    • Production: https://yourdomain.com/api/webhooks/lemonsqueezy
  4. Select events to listen to:
    • subscription_created
    • subscription_updated
    • subscription_cancelled
    • order_created
    • payment_success
  5. Save the webhook
  6. Copy the Signing Secret (shown after creation) - this is your LEMON_SQUEEZY_WEBHOOK_SECRET

Environment Variables

Add these variables to your .env.local file:

# Lemon Squeezy
LEMON_SQUEEZY_API_KEY="your-api-key"
LEMON_SQUEEZY_STORE_ID="your-store-id"
LEMON_SQUEEZY_WEBHOOK_SECRET="your-webhook-secret"

# Product Variant IDs
NEXT_PUBLIC_LEMON_SQUEEZY_STARTER_VARIANT_ID="variant_xxxxxxxxxxxxx"

# App URL
NEXT_PUBLIC_APP_URL="http://localhost:3000"

Important:

  • LEMON_SQUEEZY_API_KEY comes from "Settings" → "API"
  • LEMON_SQUEEZY_STORE_ID comes from "Settings" → "Store"
  • LEMON_SQUEEZY_WEBHOOK_SECRET comes from webhook configuration
  • Variant IDs come from your products

Testing

  1. Use Lemon Squeezy's test mode
  2. Restart your dev server: npm run dev
  3. Navigate to your pricing/checkout page
  4. Click through to Lemon Squeezy checkout
  5. Use test card: 4242 4242 4242 4242
  6. Complete checkout
  7. Verify webhook events are received
  8. Check subscription status in your database

Test Mode: Lemon Squeezy uses Stripe's test mode when your connected Stripe account is in test mode. Use Stripe test cards for testing.

Testing Webhooks Locally: Use ngrok to expose your local server:

ngrok http 3000

Update your webhook endpoint URL in Lemon Squeezy dashboard with the ngrok URL.