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 endpoint | Live endpoint |
---|---|
https://api.truelayer-sandbox.com/v3/payments | https://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 (egGB
,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
over5000000
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
- When you create a payment, in the
provider_selection
object settype
to eitherpreselected
oruser_selected
. - If you are using a
preselected
provider, supply the provider IDmock-payments-gb-redirect
.
If you are using auser_selected
provider, filter the providers in theprovider_selection
object. To do this, leaveprovider_selection.filter.countries
empty or fill it with theGB
country code. - Create an HPP URL and paste it into your browser.
- If this is a
user_selected
payment, a provider selection screen displays here. SelectMock UK Payments – Redirect Flow
. - Review the payment.
The wording on this page ensures that the user gives explicit consent for TrueLayer to initiate the payment. - 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. - Sign in to online banking.
Enter one of the test usernames above: for example,test_executed
. - 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
- When you create a payment, in the
provider_selection
object settype
to eitherpreselected
oruser_selected
. - If you are using a
preselected
provider, supply the provider IDmock-payments-de-embedded
.
If you are using auser_selected
provider, filter the providers in theprovider_selection
object. To do this, leaveprovider_selection.filter.countries
empty or fill it with theDE
country code. - Create an HPP URL and paste it into your browser.
- If this is a
user_selected
payment, a country selection screen displays here. Select Germany. - On the provider selection screen, select
Mock European Payments – Embedded Flow
.
This is the sandbox provider with the IDmock-payments-de-embedded
. - 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. - Enter the details requested by your bank.
Use the usernametest_username
, and passwordtest_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. - Select a Strong Customer Authentication (SCA) method.
UsePhotoTAN
orSMS
. - Enter the code returned by the SCA method.
In this test, there is no real SCA method, so usetest_executed
,test_authorisation_failed
, ortest_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.
Action | Scenario | Payment status |
---|---|---|
Enter username test_executed | The payment is successfully sent to the bank and is executed. | executed |
Enter username test_authorisation_failed | The user fails to authorise the payment. | failed Failure reason: authorization_failed |
Enter username test_execution_rejected | The bank rejects the payment. | failed Failure reason: provider_rejected |
Click cancel button | The 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_id | Sandbox provider display_name |
---|---|
mock-payments-de-embedded | Mock European Payments – Embedded Flow |
mock-payments-de-redirect | Mock German Payments – Redirect Flow |
mock-payments-de-redirect-additional-input-text | Mock German Payments – Redirect Flow with additional inputs |
mock-payments-es-redirect | Mock Spain Payments – Redirect Flow |
mock-payments-fi-redirect | Mock Finland Payments – Redirect Flow |
mock-payments-fr-redirect | Mock France Payments – Redirect Flow |
mock-payments-fr-redirect-additional-input | Mock France Payments – Redirect Flow - Additional Input |
mock-payments-gb-redirect | Mock UK Payments - Redirect Flow |
mock-payments-ie-redirect | Mock Ireland Payments – Redirect Flow |
mock-payments-it-redirect | Mock Italy Payments – Redirect Flow |
mock-payments-lt-redirect | Mock Lithuania Payments – Redirect Flow |
mock-payments-nl-redirect | Mock Netherlands Payments – Redirect Flow |
mock-payments-no-redirect | Mock Norway Payments – Redirect Flow |
mock-payments-pl-redirect | Mock Poland Payments – Redirect Flow |
mock-payments-pt-redirect | Mock 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.
Updated 2 months ago