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.
Last updated
SaaSBold comes with LemonSqueezy integration for managing subscriptions. This part of the documentation, will show you how to integrate LemonSqueezy into your SaaS boilerplate.
Last updated
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.
Here are the Steps to Integrate a LemonSqueezy:
To begin integrating, you need to create a store in LemonSqueezy.
Login to LemonSqueezy: Log in to your LemonSqueezy account and Go to the Dashboard.
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:
Next, we have to create a product in our LemonSqueezy store:
Navigate to Products: Go to Products
and click on the "New Product" button. It will open up a sidebar.
Product Details: Now, Fill in the product name and create variants. For this demo, we created three variants.
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.
To interact with LemonSqueezy, Now we need the API key. Let's Generate the API Key
Go to API Settings: Navigate to Settings
-> API
and click on the Plus Icon.
Generate Key: Generate the API key and copy it. Update your environment variable with the API key:
We’ve created the products and generated the API key. Now, we have to integrate Webhook to save the subscription data on the Database.
Navigate to Webhooks: Go to Settings
-> Webhook
and click on the Plus Icon, it will open up a sidebar like this:
Add Webhook URL: Add the webhook URL as follows:
Add Signing Secret: Provide a signing secret of your choice (it could be anything you want). Copy the secret and update your environment variable:
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.
Save Webhook: Click the "Save Webhook" button to finalize the integration.
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.
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.