# The checklist before the first clinic

> What must be proven in test before a real clinic is switched on.

Before a real clinic is switched on, every flow should have gone all the way in test, with your own code at both ends. Everything you do shows up in this portal: the calls under API logs, the deliveries under Webhooks and the orders under Orders. The guide Test in the sandbox says how each step is tried, and what can't be tried yet.

- Market: Sweden (`se`). Norway differs in currency, payment methods and what happens when nobody pays: https://developers.rivr.io/guides/go-live.md?market=no
- Language: English (`en`). Svenska: https://developers.rivr.io/guides/go-live.md?lang=sv
- 4 min read · 7 steps
- Page in the portal: https://developers.rivr.io/guides/go-live

Every example targets the sandbox (`https://api.test.rivr.io`) and needs test credentials. A platform client's tokens come from `https://auth.test.rivr.io`, an organisation key's from `https://auth.test.rivr.tech`.

## 1. Tokens fetched and cached

*Journal system → Rivr*

The platform token lists the clinics, the merchant token is cached per clinic and renewed before it expires. No token request per API call.

**In the portal:** [See your calls](https://developers.rivr.io/logs)

## 2. An order paid at the clinic

*Journal system → Rivr*

Create an order for a device, pay it, and see the journal show paid only once `Completed` has arrived.

**In the portal:** [Pay on a virtual device](https://developers.rivr.io/device)

## 3. Webhooks acknowledged and verified

*Rivr → Journal system*

Every delivery should have received `2xx` within five seconds. Also send your receiver a webhook with a bad signature and see it rejected, and the same webhook twice and see the journal change only once.

Two CLI commands run the checks for you. `rivr verify --url <your receiver>` runs eight checks in signed test deliveries, among them a bad signature, one without a signature, a duplicate, characters outside ASCII as JSON escapes and the events of one order in the wrong order, and checks the answers. `rivr journey --forward-to <your receiver>` runs five scenarios from a clinic's day with real test orders in the sandbox (card, declined card, Swish, invoice and an order the clinic cancels) and hands Rivr's own webhooks to your receiver. Both exit with an error code when something fails. `rivr verify` can run in your CI, and `rivr journey` runs with your sign-in to the portal. That the journal changes only once you see in your own journal.

**In the portal:** [See the deliveries](https://developers.rivr.io/webhooks)

## 4. A cancellation and a refund

*Journal system → Rivr*

Cancel an unpaid order and refund a paid one. The journal should change status only once `Cancelled` and `Refunded` have arrived.

**In the portal:** [Manage test orders](https://developers.rivr.io/orders)

## 5. Pending leaves the receivable alone

*Rivr → Journal system*

An order takes more than a day to reach the recourse flow on its own. Replay a `Pending` webhook and then a `Completed` one against your receiver, and see the books move only on the second.

## 6. A settlement booked

*Journal system → Rivr*

Fetch a settlement, match its orders to the journal, and run the same job again — nothing may be booked twice.

**In the portal:** [See settlements](https://developers.rivr.io/settlements)

## 7. Pilot clinic

*Rivr → Journal system*

When everything above holds, you and Rivr pick a pilot clinic together, and the first real orders are followed up jointly.

**In the portal:** [The guide From sandbox to production](https://developers.rivr.io/guides/sandbox-to-production)

## Next guide

- [From sandbox to production](https://developers.rivr.io/guides/sandbox-to-production.md): What differs between the sandbox and production, area by area, and the order in which you go live: platform client, addresses, live in the portal, key, webhook endpoint, CLI, patients, payment methods and clinics.
- [Connect as a platform](https://developers.rivr.io/guides/connect.md): One set of credentials for the whole journal system, one token per clinic.
- [Receive webhooks](https://developers.rivr.io/guides/webhooks.md): The webhook is the truth about an order. How to receive it safely, and only once.
- [Errors and retries](https://developers.rivr.io/guides/errors-retries.md): One way to handle errors against /api/public: read the code, decide whether to send the call again, wait the right time and send the same Idempotency-Key again.
