# 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.

<figure><img src="/files/5LDRAOdi3pMVJvEFVjE8" alt="" width="342"><figcaption><p>Lemon Squeezy Test mode</p></figcaption></figure>

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`.&#x20;

### Install ngrok

Follow the instructions to [install ngrok](https://ngrok.com/docs/getting-started/#step-1-install) 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:

{% code title="terminal" %}

```bash
ngrok http http://localhost:3000
```

{% endcode %}

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

```bash
ngrok                                                                   (Ctrl+C to quit)

Session Status                online
Account                       inconshreveable (Plan: Free)
Version                       3.0.0
Region                        United States (us)
Latency                       78ms
Web Interface                 http://127.0.0.1:4040
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):

```
https://84c5df474.ngrok-free.dev/api/webhooks/lemonsqueezy
```

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 <a href="#test-card-numbers" id="test-card-numbers"></a>

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`

{% hint style="info" %}
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.
{% endhint %}

### 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.

```typescript
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"],
  }
];

```

{% hint style="info" %}
If you are launching a pre-order page instead, update the file `src/config/lifetime.constants.ts`
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shipped.club/features/payments/lemon-squeezy/test-mode.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
