LemonSqueezy

SaaSBold comes with LemonSqueezy integration for managing subscriptions. This part of the documentation, will show you how to integrate LemonSqueezy into your SaaS boilerplate.

Overview

LemonSqueezy is a user-friendly platform for subscription management. This guide will provide step-by-step instructions for integrating LemonSqueezy, covering store creation, product setup, API key generation, and webhook configuration.

Note: If you want to use another payment provider for integration, skip this step. Instead, follow the Stripe or Paddle guides to integrate subscriptions.

Here are the Steps to Integrate a LemonSqueezy:

Create a Store

To begin integrating, you need to create a store in LemonSqueezy.

  1. Login to LemonSqueezy: Log in to your LemonSqueezy account and Go to the Dashboard.

  2. Create a Store: Click on the three dots and select "Create a Store."

Now that you have created the Store, we have the Store ID.

Store ID: Go to Settings -> Stores. You will see all your stores listed here. Find the Store ID next to the Store URL. Copy the Store ID and update the environment variable:

LEMON_SQUEEZY_STORE_ID="YOUR_STORE_ID"

Create Products

Next, we have to create a product in our LemonSqueezy store:

  1. Navigate to Products: Go to Products and click on the "New Product" button. It will open up a sidebar.

  1. Product Details: Now, Fill in the product name and create variants. For this demo, we created three variants.

  1. Variant IDs: After creating the product variants, copy the Variant IDs and update the pricingData.ts file with these IDs.

You can copy the Variant ID from each of the Variants.


Generate API Key

To interact with LemonSqueezy, Now we need the API key. Let's Generate the API Key

  1. Go to API Settings: Navigate to Settings -> API and click on the Plus Icon.

  2. Generate Key: Generate the API key and copy it. Update your environment variable with the API key:

LEMON_SQUEEZY_API_KEY="YOUR_API_KEY"

Webhook Integration

We’ve created the products and generated the API key. Now, we have to integrate Webhook to save the subscription data on the Database.

  1. Navigate to Webhooks: Go to Settings -> Webhook and click on the Plus Icon, it will open up a sidebar like this:

  1. Add Webhook URL: Add the webhook URL as follows:

yoursite.com/api/lemon-squeezy/webhook
  1. Add Signing Secret: Provide a signing secret of your choice (it could be anything you want). Copy the secret and update your environment variable:

LEMON_SQUEEZY_WEBHOOK_SIGNATURE="YOUR_SECRET"
  1. Select Actions: Select the actions to be triggered by the webhook. For the initial setup, select all actions. You can customize this later if needed.

  2. Save Webhook: Click the "Save Webhook" button to finalize the integration.


Tips

  • Testing: Use LemonSqueezy's test mode to thoroughly test the integration before going live.

  • Documentation: Refer to LemonSqueezy’s official documentation for detailed instructions and troubleshooting.

  • Security: Ensure that API keys and webhook secrets are stored securely and not exposed.

  • Event Selection: Select only the webhook events necessary for your application to minimize unnecessary data processing.

Summary

By following these steps, you will have integrated LemonSqueezy into your SaaSBold boilerplate, enabling seamless subscription management. Be sure to test the integration thoroughly to ensure all functionalities work correctly.

Last updated