Switch to Lemon Squeezy
How to change the default payment processor to Lemon Squeezy.
Lemon Squeezy is an all-in-one platform for running your SaaS business. It handles payments, subscriptions, global tax compliance, fraud prevention, multi-currency, and more. Here’s how to switch the default payment processor from Stripe to Lemon Squeezy.
1. Swap out the required dependencies
First, uninstall the existing dependencies from the Payments package…
… and install the new dependencies…
2. Update the environment variables
Next, update the environment variables across the project, for example:
Additionally, replace all instances of STRIPE_SECRET_KEY
with LEMON_SQUEEZY_API_KEY
in the packages/env/index.ts
file.
3. Update the payments client
Initialize the payments client in the packages/payments/index.ts
file with the new API key. Then, export the lemonSqueezySetup
function from the file.
4. Update the payments webhook handler
Remove the Stripe webhook handler from the API package…
… and create a new webhook handler for Lemon Squeezy:
There’s quite a lot you can do with Lemon Squeezy, so check out the following resources for more information:
Webhooks Overview
Learn how to handle webhooks from Lemon Squeezy
Signing Requests
Learn how to verify webhooks from Lemon Squeezy
5. Use Lemon Squeezy in your app
Finally, use the new payments client in your app.