This feature is available on all plans except Community and Sandbox (legacy).
Test environments provide a safe way to build and test storefronts, apps, and other functionality without affecting your live store data. In addition, orders and payments created in a test environment do not count towards your account’s revenue limit.
- In the admin dashboard, you’ll see a tag under the store name indicating the current environment. You can switch between environments with the store switcher dropdown.
- Once in test mode, create an API key scoped to the test environment from the Developer > API keys page. Any requests you make using this key will be routed to your test environment’s database, and will not affect live data.
- If you see a yellow “Test mode” banner at the top of the window, it means the current view is showing data from the test environment.
Schema and data
- Each environment has its own isolated database. The only objects shared between environments are users and account settings.
- Test environments are empty by default, and any changes made to it do not affect your live environment.
- If you want to migrate data between test and live environments, you can create a script that initializes two API clients, one with a test key, and one with a live key.
- API endpoints are the same for both environments.
- The API key used in a request determines which environment will handle the response, and can be identified by their prefix.
- Public keys have the pk_test_ or pk_live_ prefix.
- Secret keys have the sk_test_ or sk_live_ prefix.
- Any keys created before June 20, 2023 do not have a prefix, and are tied to the live environment.
- API calls made to test environments may be throttled in order to prioritize resource allocation for live environments.
Integrations that have test and live modes will only have test mode available. This includes:
- All payment gateways
Orders and payments
Test environments only allow payment gateways to use test mode, and cannot be used for live transactions.
Always use the test environment when making dummy orders and test transactions, as these will not be recognized as actual revenue by Swell. Only orders and payments from the live environment are used in revenue calculations and percentage-based fees.