> ## Documentation Index
> Fetch the complete documentation index at: https://docs.modempay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Test mode and going live

> Build without moving real money, then switch on live payments with confidence.

Every Modem Pay account has two separate worlds: **test** and **live**. You build and try everything in test mode. When it works, you switch your keys and go live. Your code doesn't change.

## What's different in test mode

| | Test mode | Live mode |
| - | - | - |
| Keys | `sk_test_…`, `pk_test_…` | `sk_live_…`, `pk_live_…` |
| Money | Nothing real moves | Real payments and payouts |
| Data | Test payments, customers, links, sub-accounts, webhooks | Live ones, completely separate |
| Webhooks | Your test webhook URL | Your live webhook URL |
| Needs KYC | No | Yes |

The mode comes from the key. A test key only ever sees test data. A live key only ever sees live data. If you get a `404` for something you know exists, check you're using a key from the same mode.

Use the **Test mode** switch in the dashboard to see your test data.

## Try your integration

**1. Take a test payment**

Follow the [Quickstart](https://docs.modempay.com/documentation/quickstart.md), or from your terminal:

```bash theme={null}
npm install -g modem-pay-cli
modempay login
modempay transaction init --amount 100
```

**2. Receive webhooks on your machine**

```bash theme={null}
modempay listen --forward-url http://localhost:3000/webhook
```

Every test event is forwarded to your local server, signed exactly as in production. See [Modem Pay CLI](https://docs.modempay.com/documentation/cli.md).

**3. Test the unhappy paths**

Cancel a payment, close the checkout, send a webhook your server rejects. Your system should handle each one.

```bash theme={null}
modempay trigger charge.failed
modempay trigger charge.cancelled
```

## Go-live checklist

> [accordion] 1. Get verified (KYC)
>
> Submit your business documents in the dashboard. You can't take live payments until they're approved. The dashboard shows exactly which documents are still missing.

> [accordion] 2. Create live keys the safe way
>
> Create a **restricted** live key for each system, with only the permissions it needs. Add IP allowlists for your servers, and payout limits on any key that can send money. See [API keys](https://docs.modempay.com/documentation/authentication.md).

> [accordion] 3. Store keys as secrets
>
> Put live keys in environment variables or a secrets manager. Never in your code, your website or your mobile app.

> [accordion] 4. Add your live webhook
>
> Add your live webhook URL in the dashboard and store its signing secret. Live and test webhooks have different secrets. Check that your endpoint [verifies signatures](https://docs.modempay.com/documentation/core/webhooks.md#verify-the-signature).

> [accordion] 5. Mark orders paid from the webhook
>
> Don't rely on the customer reaching your `return_url`. People close tabs. Fulfil orders when you receive `charge.succeeded`, or after [verifying the payment](https://docs.modempay.com/documentation/payment-intents/management.md) on your server.

> [accordion] 6. Use idempotency keys for payouts
>
> Send a unique `Idempotency-Key` with every payout so a retry can never pay twice.

> [accordion] 7. Run one small real payment
>
> Pay yourself 10 GMD on your live site and check the order, the webhook and your balance.

> [!NOTE]
>
> Data never moves between modes. Payment links, customers, coupons, sub-accounts and webhooks you made in test mode need to be created again in live mode.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.