# Testing and going live

> Build on testnet with free USD₮, check every flow, then switch to mainnet.

## Testnet

Testnet is a separate USD Network (`usdnet-testnet-1`) with free USD₮ that has no value. Everything for business works the same.

| | Testnet |
| --- | --- |
| API | `https://usd.net/explorer/testnet/api/v1` |
| Explorer | [usd.net/explorer/testnet](https://usd.net/explorer/testnet) |
| Wallet | usd.net/wallet → Settings → Network → Testnet |
| Test USD₮ | `POST /faucet { "address": "0x…" }`: 100 USD₮ per address every 24 hours, one request a minute per IP |
| Deposits | `solana-devnet` and `base-sepolia` |
| SDK | `new USDNet({ key, network: 'testnet' })`, `USDNet.configure({ network: 'testnet' })` |

Register `http://localhost:<port>` as an origin to try Connect from your machine. Testnet data can be reset, so don't rely on it for long.

## A checklist before launch

- Connect: approve, cancel, close the popup, popup blocked, a second connect replacing the mandate.
- Charges: success, retry with the same id, over `perTx`, over `daily`, user with too little USD₮, revoked mandate.
- Payouts: success, retry with the same id, many at once, server wallet too low.
- Webhooks: signature check on the raw body, duplicates skipped, slow handler still answers `2xx` within 5 s.
- The server key only in your server's secret store; the webhook secret too.
- Monitoring on the server wallet's balance, so payouts never run dry.
- A sweep from the server wallet to the business wallet.

## Going live

1. On mainnet, open your business wallet and create a partner record with your production sites.
2. Put the new `.env` values in production. Mainnet and testnet records, keys and signatures are separate.
3. Fund the server wallet with USD₮ on USD.NET (from your business wallet, or by depositing to its own address).
4. Switch `network` to `'mainnet'` in the SDK and in `USDNet.configure`.
