Test mode

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.

Install ngrok

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:

ngrok http http://localhost:3000

You will see something similar to the following console UI in your terminal.

ngrok                                                                   (Ctrl+C to quit)

Session Status                online
Account                       inconshreveable (Plan: Free)
Version                       3.0.0
Region                        United States (us)
Latency                       78ms
Web Interface       
Forwarding                    https://84c5df474.ngrok-free.dev -> http://localhost:3000

Connections                   ttl     opn     rt1     rt5     p50     p90
                              0       0       0.00    0.00    0.00    0.00

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.

Test card numbers

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.

Test and Production 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.

export const pricingPlans = [
    title: "Hobby",
    monthlyPrice: 19,
    annualPrice: 199,
    monthlyCheckoutUrl: process.env.HOBBY_CHECKOUT_URL_MONHTLY,
    annualCheckoutUrl: process.env.HOBBY_CHECKOUT_URL_ANNUAL,
    features: ["Team", "Workspace", "Integrations"],

If you are launching a pre-order page instead, update the file src/config/lifetime.constants.ts

Last updated