Redirecting to the standalone browser
Implementation
Getting the user back your app
Our Android SDK ensures the best user experience and support coverage. If you are unable to integrate our SDK, use one of the following fallback methods.
You can redirect to the Trustly URL in the device’s default browser. Redirecting to the default browser will ensure the best compatibility besides the SDK and proper handling of multi-factor authentication, app-to-app redirection, error handling etc.
With this option the attribute ReturnToAppURL
should NOT be a part of the order initiation call since the transaction will be done outside of your application.
After order has been initiated towards Trustly API the returned url is opened in the users stand alone browser. This means that the user will be redirected out from your app to the device's default browser and ensure to provide a stable checkout session and a good user experience.
{
...
"params": {
...
"Data": {
...
"Attributes": {
...
"ReturnToAppURL": null,
"SuccessURL": "<URL-SCHEME> or <UNIVERSAL-APP-LINK>",
"FailURL": "<URL-SCHEME> or <UNIVERSAL-APP-LINK>"
...
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("<TRUSTLY-URL>"));
startActivity(intent);
Since this integration option results in the user being redirected out from your application, it's a good practice to also get the user back once the session reaches an end state (success or aborted).
To be able to redirect the user back to your app once the order reaches an end state, it's possible to initiate an order by inserting your custom URL scheme, or universal link/app link as values within the SuccessURL
and FailURL
attributes.
By doing this you ensure that the user will automatically be redirected back to where they started the Trustly order which will give a seamless user experience.