# Testing (/docs/testing)

Test mode is the sandbox. There is no separate environment: the same API, with a test key, on test data.

## Test and live [#test-and-live]

| | Test | Live |
| --- | --- | --- |
| Secret key | `sk_test_…` | `sk_live_…` |
| Data | Test objects only | Live objects only |
| Cards | Test cards, no money moves | Real cards |
| Availability | Always | After your account is approved (`403 account_not_live` before) |

Every object has `livemode`. Keys, webhook endpoints, events and idempotency keys are all per mode: a test key never sees live objects, and a test endpoint never receives live events. Switch the dashboard between **Test** and **Live** in the top bar.

## Test cards [#test-cards]

The hosted checkout page shows the test cards for the processor behind test mode. Use any future expiry date and any CVC.

### RunePay test processor [#runepay-test-processor]

The default test processor simulates outcomes from the card number:

| Card number | Result | Processor token |
| --- | --- | --- |
| `4242 4242 4242 4242` | Succeeds: `payment.succeeded`, then `checkout.session.completed` | `tok_success` |
| `4000 0027 6000 3184` | Asks for a bank check (3D Secure). The page shows **Approve** and **Fail** buttons for the check | `tok_3ds` |
| `4000 0000 0000 0002` | Declined with `decline_code: "do_not_honor"`: `payment.failed` | `tok_decline` |
| Any other valid number | Succeeds | `tok_success` |

The test processor also has a `tok_pending` outcome (a payment that stays pending until settled by hand), used by RunePay's own tests. The hosted checkout does not offer it.

### Rebilly sandbox [#rebilly-sandbox]

When test mode runs on the Rebilly sandbox, the page shows Rebilly's cards instead:

| Card number | Result |
| --- | --- |
| `5555 5555 5555 4444` | Succeeds |
| `4111 1111 1111 1111` | Asks for a bank check (when 3D Secure is on for the sandbox gateway) |
| `4000 0000 0000 0002` | Is declined |

## Test the rest of the flow [#test-the-rest-of-the-flow]

- **Refunds:** `POST /refunds` with a succeeded test payment's id. A full refund sends `refund.succeeded` and `payment.refunded`; a partial one sends `refund.succeeded`.
- **Webhooks:** point a test endpoint at a tunnel to your machine (for example `cloudflared` or `ngrok`); localhost URLs are refused. Use [replay](/docs/webhooks#replay-an-event) to resend an event while you work on your handler.
- **Errors:** send a bad request on purpose, such as a string `"unit_amount": "19.99"` inside `line_items[0].price_data`, to see the [error shape](/docs/api/errors).

<Callout title="Planned" type="warn">
Test helpers to simulate disputes and move the settlement clock (`POST /test_helpers/…`, test mode only) are planned. Until then, disputes and payouts can't be triggered from the API in test mode.
</Callout>