App-to-app redirects for Android

Test app redirects in your Android payments integration with the TrueLayer mock bank app.

When you integrate a payment solution for customers on an Android device, you can use our mock bank app to test your integration in the sandbox environment. We recommend you thoroughly test your app in the sandbox environment before you go live.

The mock bank app imitates the payment flow a user would experience on mobile if the chosen bank supports app-to-app redirects. This means that you can test the user flow from your app, to a bank app to approve the payment, and back to your app.

📘

You can also use the TrueLayer Test Redirect page in a webview in your sandbox Android app.

The Test Redirect page enables you to test whether the redirect from your app to the following bank apps works: Barclays, Lloyds, Monzo, Crédit Mutuel, ABN Amro and AIB.

However, you cannot test the return redirect with the Test Redirect page, so we recommend you also use the mock bank app for testing.

The mock bank app supports all of the Payments API v3 sandbox providers you can use to test redirect authentication flows. This means that once you select the provider in your app, you are redirected to the authorisation flow for the appropriate sandbox provider in the mock bank app.

How the app-to-app flow works

Once you've installed the mock bank on your Android test device, it interacts with your app like any other banking app. On your Android test device, the flow of a test payment with the mock bank app is:

  1. You create a payment in your payment app or website.
  2. You select the a redirect sandbox provider for the payment.
  3. You are redirected to the mock bank app for authorisation, where you execute or reject your test payment.
  4. Click the link on the payment result screen to be redirected back to your payment app or website.

Install the mock bank app for Android

The mock bank app is not available from any app stores. You can download the APK file for the mock bank app from our GitHub page.

Once you've downloaded the latest version of the APK, you can open it on your Android test device. The exact method for installing APKs which aren't on an app store vary based on your exact device and OS.

You may need to enable certain permissions to install the APK. You are often prompted to enable these permissions when you attempt to open the APK file.

Test with the mock bank app

Testing your payment flow with the mock bank app requires minimal integration. The main prerequisite is that you have the mock bank app installed on your test device.

To test your payments integration with the mock bank app:

  1. Create a payment in your app or website.
    You can use the HPP, EPP, SDKs, or direct API integration for payment authorisation.
  2. As part of the payment, provide a sandbox provider_id for the redirect flow to test.
    • If you use the user_selected provider selection method, you can choose one of the redirect mock providers from the list that displays.
    • If you use the preselected provider selection method, you need provide a provider_id for the redirect mock provider at payment creation.
  3. Because you selected a sandbox provider_id, your app redirects you to the mock bank app. Here you can execute or reject your payment.
    A payment results screen displays.
  4. Click the link (this is your return URI) on the payment result screen to be redirected to your app.
    If your integration is configured correctly, you are redirected to your app.

If your integration isn't set up correctly, or the APK isn't installed on your device correctly, your app redirects you to the mock bank website instead of the mock bank app in step 2.