PaymentsLemonSqueezy Integration

Setting Up LemonSqueezy Integration

Follow these steps to integrate LemonSqueezy for handling subscriptions, one-time payments, and subscription plans in your application.

Step 1: Create a LemonSqueezy Account

  1. Go to the LemonSqueezy website and sign up for an account.
  2. Once logged in, set up your store and take note of the Store ID.

Step 2: Generate API Key

  1. Navigate to the API section in your LemonSqueezy dashboard.
  2. Create an API key and copy it. This key is required for server-side interactions.

Step 3: Add Environment Variables

  1. Open your .env.local file.
  2. Add the following environment variables:
    LEMONSQUEEZY_STORE_ID= YOUR_STORE_ID
    LEMONSQUEEZY_API_KEY= YOUR_API_KEY
    LEMONSQUEEZY_WEBHOOK_SECRET= YOUR_WEBHOOK_SECRET
    

Step 4: Set Up Product and Variant IDs

  1. In your LemonSqueezy store, create your products (subscription or single payment).
  2. Under each product, copy get the Variant ID.
  3. Update the lib/subscriptions.ts file with your product Variant IDs.
export const basicPlan: ISubscriptionPlan = {
  name: 'Basic Plan',
  type: 'basic',
  // Replace these IDs with the actual variant IDs from LemonSqueezy
  monthlyPlanId: '269320',
  yearlyPlanId: '269321',
};
 
export const proPlan: ISubscriptionPlan = {
  name: 'Pro Plan',
  type: 'pro',
  // Replace these IDs with the actual variant IDs from LemonSqueezy
  monthlyPlanId: '269322',
  yearlyPlanId: '269323',
};