Sandbox testing resources

Resources for payments testing including collections, sandbox environment and mock providers.

Testing payments in sandbox yourself enables you to see what the payment authorisation flow is like for your customers.

For test payments, you need to:

  • have sandbox enabled in Console
  • use sandbox URLs in API calls.

To enable the sandbox environment in Console, ensure that the Live toggle in the top-right corner is toggled off (it will be greyed out).

While live is toggled off, any changes you make in Console apply to sandbox but not the live environment.

In API calls to TrueLayer endpoints, use URLs that start with https://api.truelayer-sandbox.com. For example:

Sandbox endpointLive endpoint
https://api.truelayer-sandbox.com/v3/paymentshttps://api.truelayer.com/v3/payments

Test authorisation flows in sandbox

You can test two different types of authorisation flow:

  • redirect, in which a user is redirected to their bank app or site to log in with their credentials
  • embedded, in which a user inputs their bank credentials (and any other information required for a successful payment) within your UI, without being redirected to their bank

Select which flow you would like to test by choosing the relevant mock provider when you authorise a sandbox payment. To filter the providers that are available to select from, in the Create payment request:

  • set provider_selection.filter.countries as empty, or use the ISO-3166-1 alpha-2 country code (eg GB, IE, DE) for the relevant countries
  • set currency to GBP if you're testing UK banks, and EUR if you're testing EU banks.

📘

Sandbox payment limit

You cannot make a payment with an amount_in_minor over 5000000 to a merchant account in the sandbox environment.

You can also test different scenarios (eg payment success, rejection, cancellation) by entering different usernames on the screen where a user would normally log in with their banking credentials.

Test the redirect payment flow

  1. When you create a payment, in the provider_selection object set type to either preselected or user_selected.
  2. If you are using a preselected provider, supply the provider ID mock-payments-gb-redirect.
    If you are using a user_selected provider, filter the providers in the provider_selection object. To do this, leave provider_selection.filter.countries empty or fill it with the GB country code.
  3. Create an HPP URL and paste it into your browser.
  4. If this is a user_selected payment, a provider selection screen displays here. SelectMock UK Payments – Redirect Flow.
  5. Review the payment.
    The wording on this page ensures that the user gives explicit consent for TrueLayer to initiate the payment.
  6. Select whether to pay with desktop or mobile.
    This page varies based on the device you're using. Select the method that you want to test.
  7. Sign in to online banking.
    Enter one of the test usernames above: for example, test_executed.
  8. Select a bank account to pay from.
    Select any account. These are test accounts in the sandbox environment, so no money is moved.
    After this, you are redirected, like the user would be redirected back from their bank.

Test the embedded payment flow

  1. When you create a payment, in the provider_selection object set type to either preselected or user_selected.
  2. If you are using a preselected provider, supply the provider ID mock-payments-de-embedded.
    If you are using a user_selected provider, filter the providers in the provider_selection object. To do this, leave provider_selection.filter.countries empty or fill it with the DE country code.
  3. Create an HPP URL and paste it into your browser.
  4. If this is a user_selected payment, a country selection screen displays here. Select Germany.
  5. On the provider selection screen, select Mock European Payments – Embedded Flow.
    This is the sandbox provider with the ID mock-payments-de-embedded.
  6. Review the payment.
    This is the same wording that your user will see when they authorise a payment. It ensures that the user gives explicit consent for TrueLayer to initiate the payment.
  7. Enter the details requested by your bank.
    Use the username test_username, and password test_password. Enter a real IBAN (no money will actually move).
    Because you supplied a remitter IBAN earlier in the flow, you do not need to choose a sub-account at this stage.
  8. Select a Strong Customer Authentication (SCA) method.
    Use PhotoTAN or SMS.
  9. Enter the code returned by the SCA method.
    In this test, there is no real SCA method, so use test_executed, test_authorisation_failed, or test_execution_rejected.
    After this, you are redirected, like the user would be redirected back from their bank.

Test usernames

When you enter bank details in the sandbox authorisation page, you can enter different usernames to achieve different payment results.

ActionScenarioPayment status
Enter username test_executedThe payment is successfully sent to the bank and is executed.executed
Enter username test_authorisation_failedThe user fails to authorise the payment.failed
Failure reason: authorization_failed
Enter username test_execution_rejectedThe bank rejects the payment.failed
Failure reason: provider_rejected
Click cancel buttonThe user cancels the payment before authorising it.failed
Failure reason: canceled

If you input test_executed or test_execution_rejected, you will be able to use the Execution delay field. This enables you to test different time periods between authorising the payment and the bank executing it, from no delay to one day.

Using test_executed also enables the Settlement delay field. Test different time periods between authorisation and settlement, from no delay up to one day.

Sandbox providers

We offer mock providers for every country that supports the Payments API v3. Use these to test your integration regardless of whether you use our web UI, mobile app UI or a direct API integration.

Depending on the information you provide when you create the payment, you see different banks available within the HPP or SDKs as you test. For a direct integration, this changes the list of providers you receive when you perform the provider_selection action.

📘

The list below changes regularly when our level of support for regions changes, or we develop new payment flows. To find out whether we have or are developing a sandbox provider for a specific region, contact us.

The table below includes a list of all sandbox providers across geographies. Note that some providers include additional-input in their ID and display name. These providers enable you to test flows that require the user to input more information than just their bank credentials (for example, a branch name or IBAN).

Sandbox provider_idSandbox provider display_name
mock-payments-de-embeddedMock European Payments – Embedded Flow
mock-payments-de-redirectMock German Payments – Redirect Flow
mock-payments-de-redirect-additional-input-textMock German Payments – Redirect Flow with additional inputs
mock-payments-es-redirectMock Spain Payments – Redirect Flow
mock-payments-fi-redirectMock Finland Payments – Redirect Flow
mock-payments-fr-redirectMock France Payments – Redirect Flow
mock-payments-fr-redirect-additional-inputMock France Payments – Redirect Flow - Additional Input
mock-payments-gb-redirectMock UK Payments - Redirect Flow
mock-payments-ie-redirectMock Ireland Payments – Redirect Flow
mock-payments-it-redirectMock Italy Payments – Redirect Flow
mock-payments-lt-redirectMock Lithuania Payments – Redirect Flow
mock-payments-nl-redirectMock Netherlands Payments – Redirect Flow
mock-payments-no-redirectMock Norway Payments – Redirect Flow
mock-payments-pl-redirectMock Poland Payments – Redirect Flow
mock-payments-pt-redirectMock Portugal Payments – Redirect Flow

See our GitHub for libraries and SDKs to help you integrate the Payments API v3.

Test with our Insomnia collection

Our collections are sets of preconfigured requests that help you to test API requests as quickly as possible. For Payments, we use the Insomnia REST API client.

If you have Insomnia installed, download and install the TrueLayer collection.

Use the TrueLayer Insomnia plugin to sign your requests.