Initiating payments from a mobile web view

For banks who support it, 'app-to-app' is a smooth experience that whisks users straight from your mobile app to their bank's app. Here, they can authorise the payment, before being whisked right back to your app again.

However, if you plan to initiate the payment from a web view inside of your app, then there are some potential difficulties to watch out for. Unless configured correctly, you can find that users get redirected to their bank’s website to authorise the payment, instead of to their app.

The following tips will help you to get the app-to-app journey right:

  • Don't use an iframe, as most banks don't support these for security reasons.
  • On Android, it’s better not to override the web view client. If you do need to, then see this example of how to make that implementation work.
  • Provide an option for your user to exit the web view and return to your app, in case they experience any problems.
  • Open the direct bank link outside of the web view to make sure the device is able to open the banking app, where available.

We have some tools available to help you test that your app-to-app redirect is working correctly before you move to production. You can even try these tools before you start your integration with TrueLayer.

Test redirects from your app

Our Test Redirect page contains redirect links to a selection of banks. To test how your app handles app-to-app redirects, simply open this page inside your app, using the same web view technology that your payment screen will use. Tapping any of the links on this page should open the associated bank’s app on your phone, if you have it installed on your device.

If your app is configured correctly you will observe that the bank app is opened, instead of the bank’s web page. Note that on the bank app in this test there will not be a payment to authorise, and you may see an error message. Don't let that worry you, so long as the bank app has opened, then the test was successful and your app is correctly handling app-to-app redirects from your web view.

However, if only a web page is opened and not the bank app, then the app-to-app redirect is not working as intended. In this case, take note of the tips above, then if needed take a look at our web view example app.

Webview example app

This GitHub repository contains code for sample iOS and Android apps that are configured for app-to-app redirects to work correctly. You can build the apps and install them on your devices to ensure the redirects work smoothly, and reference the source code to see the correct implementation method.


Did this page help you?