Test mode
Last updated
Last updated
While working on your product, you will develop on localhost
.
To test your payment workflow, Lemon Squeezy supports Test mode.
To turn Test mode on, go to Lemon Squeezy and click the toggle at the bottom of the page.
Now it's time to configure the webhook for the Test mode.
With Test mode on, go to Settings > Webhooks and click on the plus icon to add a new Webhook.
Your development website runs on localhost:3000
, so Lemon Squeezy cannot reach it from the web.
To solve this problem you can use a tool called ngrok
.
ngrok
generates a publicly available web URL that redirects to your localhost
.
Follow the instructions to install ngrok for your operating system on the official website.
Once installed, run your Next.js app with npm run dev
. The app will run at http://localhost:3000
.
Run ngrok
with the command:
You will see something similar to the following console UI in your terminal.
According to this example, the Lemon Squeezy Webhook URL will be (the initial part of the URL will change in your case):
Now go to Lemon Squeezy, Settings > Webhooks, click on the plus icon to add a new Webhook and insert the URL.
You can now open the Lemon Squeezy Test Checkout of your products and test the complete purchasing flow.
Use the following credit card numbers to test the different payment methods.
Visa: 4242 4242 4242 4242
Mastercard: 5555 5555 5555 4444
American Express: 3782 822463 10005
Insufficient funds: 4000 0000 0000 9995
Expired card: 4000 0000 0000 0069
3D Secure: 4000 0027 6000 3184
The Test mode of Lemon Squeezy is like a brand new store. It means that you need to create the Test products, and use their checkout URLs.
Use Environment Variables to store the products checkout URLs.
This way you can use the Lemon Squeezy Test mode checkout URLs locally (.env
file) and the production Lemon Squeezy checkout URLs in production (set them in the Environment Variables on Vercel, Netlify, or any other hosting service you're using).
The file src/config/pricing.constants
contains the different plans of your product.
If you are launching a pre-order page instead, update the file src/config/lifetime.constants.ts