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
- Go to lemonsqueezy.com and sign up
- Complete your store setup
- Connect a payment method (Stripe or PayPal)
- Verify your account and business details
Get API Keys
- In your Lemon Squeezy dashboard, go to "Settings" → "API"
- Click "Generate API Key"
- Name it (e.g., "Production" or "Development")
- Copy the API key - this is your
LEMON_SQUEEZY_API_KEY - Important: Store this securely - you won't be able to see it again
- You'll also need your Store ID, found in "Settings" → "Store"
Create Products
- Go to "Products" in your Lemon Squeezy dashboard
- Click "New Product"
- Fill in product details:
- Name: Your subscription tier
- Price: Set subscription pricing
- Billing interval: Monthly, yearly, etc.
- Configure product settings (description, images, etc.)
- Save the product
- Copy the Variant ID (you'll need this for checkout links)
- Repeat for each subscription tier
Configure Webhooks
Webhooks notify your app when subscription events occur.
Step 1: Create Webhook
- Go to "Settings" → "Webhooks" in your Lemon Squeezy dashboard
- Click "Create Webhook"
- Set the endpoint URL:
- Development:
http://localhost:3000/api/webhooks/lemonsqueezy(use ngrok for local testing) - Production:
https://yourdomain.com/api/webhooks/lemonsqueezy
- Development:
- Select events to listen to:
subscription_createdsubscription_updatedsubscription_cancelledorder_createdpayment_success
- Save the webhook
- 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_KEYcomes from "Settings" → "API"LEMON_SQUEEZY_STORE_IDcomes from "Settings" → "Store"LEMON_SQUEEZY_WEBHOOK_SECRETcomes from webhook configuration- Variant IDs come from your products
Testing
- Use Lemon Squeezy's test mode
- Restart your dev server:
npm run dev - Navigate to your pricing/checkout page
- Click through to Lemon Squeezy checkout
- Use test card:
4242 4242 4242 4242 - Complete checkout
- Verify webhook events are received
- 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.