# Test key

Each widget has a test key, `pk_test_…`, beside its live key. It is a dry run on the rental's real cars and prices. You try the whole widget, Pay and the done page included, and nothing lands on the rental: no car is held, no booking is made and no money moves.

## Where to find it

In Mellow, open **Settings · Widget** and the widget. The **Test** card below Install holds the code with the test key, and **Copy code** copies it. **Rotate test key** in the page's **Show more** makes a new one: the old test key stops at once, and the live key does not change.

## Where it works

- **Your own machine.** The test key passes from `http://localhost`, `http://127.0.0.1` and `http://[::1]`, on any port, http or https. The live key never does.
- **Your sites.** The test key also passes from the widget's own sites, so you can try a page on the real site before you change to the live key.

## What it does

- The reads give the live answers: the same locations, car types, products, availability and prices.
- Pay runs every check of a real hold, the bot check included, and prices it the same, with the same refusals, such as `none_free`. Then it keeps no car.
- The payment goes to the processor's sandbox. When the processor's sandbox is not set up in Mellow, Pay shows **Open test payment**, which opens Mellow's own test page in a new tab, with **Pay** and **Refuse card**. The widget moves to done by itself once you pay there.
- The done step shows "Test booking TEST-4F2A", with no links to manage the booking or to check in. `mellow-booked` gives `reference` 0.
- The bot check runs with Cloudflare's test sitekey, which always passes.
- A test key may call only the reads, the holds and their payments, the widget's settings and the currencies. Any other route answers 403 `forbidden`.

## Change to the live key

1. Add the site to the widget's **Sites** in Mellow, as `https://www.example.com`.
2. Change `auth="pk_test_…"` to `auth="pk_live_…"`. The rental stays the same.
