Use the HPP in a mobile web view
Test and enable an app-to-app payment experience.
For the banks that support it, app-to-app is a simple payments experience. It takes users straight from your mobile app to their bank's app. There, they can authorise the payment, before being taken directly back to your app.
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 it's configured correctly, you may find that users get redirected to their bank’s website to authorise the payment, instead of to their app.
Best practices for the app-to-app journey:
- Don't use an iframe, as most banks don't support these for security reasons.
- Don't override the web view client on Android unless you absolutely need to. If you do need to, 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 can open the banking app, where available.
Use our tools to help you test that your app-to-app redirect is working correctly before you move to production. You can 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, open the Test Redirect page page inside your app, using the same web view technology that your payment screen will use. When you tap a link on this page, it opens the associated bank app on your phone if you have it installed on your device.
If your app is configured correctly, the bank's app opens, instead of the bank’s web page. In this test, when the bank app opens, there's no payment to authorise and you may see an error message.
However, if the bank app opens, the test was successful and your app correctly handles app-to-app redirects from your web view. If only a web page opens, not the bank app, the app-to-app redirect is not working as intended. Check the list of best practices 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 correctly. You can then reference the source code to see the correct implementation method.
Updated about 1 year ago