Lemon Squeezy
There are a few steps you need to take to get your Lemon Squeezy account ready for production and start collecting payments.
Get the API Keys and Webhook Signing Secret
Login to your Lemon Squeezy account
Go to the Lemon Squeezy dashboard and login with your credentials.
Activate your store
Go to the Settings
tab and then click on General
.
Finish step 1 (add your business details) and 2 (verify your identity) to activate your store.
Getting verified can take a few days.
Copy the products to live mode
Make sure the Test mode
switch is checked.
Go the Store
and Products
.
Click on the ...
beside the product and click on Copy to live mode
.
Do this for all the products you have created.
Copy the Variant IDs
We need to copy the variant IDs to the subscriptionPlans.ts
configuration object again, but this time for the production environment.
Uncheck the Test mode
switch.
Click on your product.
Below the Variants
section you can click on the ...
icon beside the variant and then click on Copy ID
to copy the variant ID.
Go to the packages/utils/src/constants/subscriptionPlans.ts
file and update the lookup keys with the corresponding variant ID you just copied.
Make sure you update the lookup keys for the production environment.
Repeat this for the other products/variants as well until you have updated all of them.
Configure the webhooks
Go to the Settings
tab and then click on Webhooks
.
Click on the plus icon to add a new webhook.
Enter the production endpoint URL where you want to receive the webhook events followed by /api/lemonsqueezy/webhook
.
If your production url is using a subdomain, make sure to add the subdomain to the URL.
For example:
For the signing secret you may use the same one you used in the test environment or generate a new one with this command:
Save the signing secret in a safe place, we are going to need it later when we deploy the app.
For the events, select the following:
subscription_created
subscription_updated
Save the webhook.
Get the Production API keys
Make sure the Test mode
switch is unchecked.
Click on the Settings
tab and then click on the Stores
tab.
Copy the Store ID
next to your store url, it begins with #
followed by a number and store it somewhere safe, we are going to need it later when we deploy the app.
Click on the API
tab and then click the plus icon to create a new API key.
Copy the API key
and store it somewhere safe.
Configure the Customer Portal
We did this step earlier in the test/development environment. We need to do it again in the production environment.
The customer billing portal allows your customers to manage their subscriptions and can be accessed through the billing page in your app.
However, we need to activate it first in the Lemon Squeezy dashboard.
Turn off test mode
Make sure the Test mode
switch is unchecked.
Setup the customer portal
Click on the Design
tab.
Click on Portal
and then enable the Customer portal
option.
Add a link to your app in the Link URL
field (production url). This is the URL where the customer will be redirected after managing their subscription.
Beneath subscriptions enable:
Cancel subscriptions
Update subscriptions
and select all your products/plans.
Click on the Publish
button when you are happy with the changes.
Disable the store (optional)
You can also disable the Store under the Store
tab if you don't want to show a Lemon Squeezy store in the customer portal.
Theming (optional)
Play around with the theming options in the different tabs to match the customer portal with your app's design.
Next Steps
There are many more settings you can configure in the Lemon Squeezy dashboard, I encourage you to explore them and see what fits your business needs.
We're going to need the API key, Store ID and webhook signing secret in the hosting section, so make sure you have them saved in a safe place.
Last updated on