GoCardlessDeveloper Docs
Create a sandbox account

Testing and Sandbox#

View as Markdown

The sandbox is a separate GoCardless environment where you can build and test your integration without moving real money. You can create customers, mandates, and payments, then trigger failures and chargebacks on demand.

How the sandbox works#

The sandbox and live environments are completely separate. Each has its own account, dashboard, access tokens, and data. Nothing you create in the sandbox carries over to live.

Payments and mandates move through their lifecycle at the same speed as in live. For example, a Bacs mandate takes 3 working days to activate. Use the scenario simulators to move a resource to the state you need straight away.

ServiceSandboxLive
APIhttps://api-sandbox.gocardless.com/https://api.gocardless.com/
Dashboardhttps://manage-sandbox.gocardless.comhttps://manage.gocardless.com
Hosted payment pageshttps://pay-sandbox.gocardless.comhttps://pay.gocardless.com
OAuth (Connect)https://connect-sandbox.gocardless.comhttps://connect.gocardless.com
Health checkhttps://api-sandbox.gocardless.com/health_checkhttps://api.gocardless.com/health_check

The GoCardless MCP also works with your sandbox account. Choose Sandbox when you connect.

Use test data only

Do not use real customer email addresses or banking information in the sandbox.

Get started#

  1. Create a sandbox account.
  2. In the sandbox dashboard, go to the Developers page, select Create, then Access token. Copy the token straight away, because you can only view it once.
  3. Make your first request against the sandbox API.

The Set up guide walks through these steps and how to configure a client library. To see a working request, follow Send your first API request.

What you can test#

I want to testUse
A payment failing or being charged backScenario Simulators
A customer completing a payment or mandate with a bank accountTest Bank Details
Bank authorisation with BankIDBankID Scenario Simulators
My webhook handlerTesting Webhooks (Dashboard)
My webhook handler on my local machineTesting Webhooks (CLI)
Requests to the API without writing codePostman Collection
Bank Account DataTesting Bank Account Data
A partner integration, including OAuthTesting your integration

Differences from live#

The sandbox behaves like live in most ways, but these differences can catch you out.

Customer emails are restricted#

The sandbox only sends customer notification emails to addresses that belong to a user on your organisation, or that use a disposable email domain. You can also use sub-addresses of a user's email. For example, if you@example.com is a user on your organisation, emails to you+test@example.com are sent. Emails to any other address are not sent.

Webhooks identify their environment#

Each webhook includes an Origin header with the environment that sent it: https://api-sandbox.gocardless.com for the sandbox and https://api.gocardless.com for live. Use it to tell sandbox and live webhooks apart. See Webhooks.

Some endpoints are restricted in live#

Some endpoints are restricted in live unless your account has been approved. Check the Restrictions page before you rely on an endpoint that works in the sandbox. Creating payments with Billing Requests works the same way in both environments.

Before you go live#

Make sure your integration handles the paths that go wrong as well as the happy path. Use the scenario simulators to test each of these:

ScenarioHow to test it
Payment succeeds and is paid outpayment_paid_out, or billing_request_fulfilled_and_payment_paid_out from checkout
Payment failspayment_failed
Payment fails later than usualpayment_late_failure (not Autogiro)
Payment is charged backpayment_charged_back
Mandate failsmandate_failed (not SEPA, since SEPA mandates are submitted with the first payment)
Mandate expiresmandate_expired (not Autogiro, BECS NZ or PAD)
Customer switches bank accountmandate_transferred (Bacs only)
Webhook is delivered more than onceThere is no simulator. Resend a webhook with Testing Webhooks (Dashboard) or the CLI

When you're ready, follow the Go-live checklist.

What's next#