Reputation: 29
I'm implementing an Android app that uses a payment gateway which opens up in the browser. Once the payment completes the payment gateway should automatically redirect to the successful payment URL that I specified. However, currently, this redirect is not opening my Android App but instead redirecting in the browser.
So my question is, are there specific scenarios that result in Android using the App Link to open the app? Something like a property that needs to be set on the anchor tag or similar? From the documentation on App Links it seems like nothing special should be needed, as they state that the app becomes the default handler for that URL https://developer.android.com/training/app-links.
The payment gateway web page is provided by the payment provider, so I can't modify it. However, in an attempt to test opening the app using the App Link, I tried to make my own custom web page with buttons and anchor tags containing the App Link. But none of these launched the app either.
This is what my app's manifest entry looks like to configure the App Link
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="https"/>
<data android:scheme="http"/>
<data android:host="5d1a-196-251-220-14.ngrok-free.app"/>
</intent-filter>
I also have https://5d1a-196-251-220-14.ngrok-free.app/.well-known/assetlinks.json set up, and it appears to be verified as expected:
Running the following command also successfully opens the app at the expected path:
adb shell am start -W -a android.intent.action.VIEW -d "https://5d1a-196-251-220-14.ngrok-free.app/paymentSucceeded"
Any help would be greatly appreciated. As far as I can tell everything is in place to allow the app link to work correctly, so I'm wondering if I might be misunderstanding when App Links will actually open the app.
Upvotes: 0
Views: 833
Reputation: 26
Rather than redirecting the user to a browser, which could disrupt the flow, a better practice is to render the URL provided by the payment gateway in a web-view (in-app browser). This ensures the app regains control once the payment is completed.
Upvotes: 0
Reputation: 31
This has always been a little tricky and we have used https://www.branch.io/ in the past to do the deep linking. I am curious though why you are taking the focus away from your application and presenting a payment screen in the browser. If you are sending the payment information directly to your provider, you can embed this in your application and still stay out of higher PCI compliance. We integrate USIO’s Checkout platform (https://checkout.usiopay.com/2.0/documentation/) in our mobile app. They have a web UI, but it is also easy to do it directly in the app and keep the experience seamless.
Upvotes: 0