Wrapping a shopping mall's web screens in an app and showing them through a WebView is common. But it often stalls at checkout. A payment that worked fine in the phone's browser fails inside the app: the card company's app won't open, or the payment finishes but the screen gets stuck somewhere odd.
SOL LABS AI has built in-app payments that open a PG payment window inside an app WebView, as well as PG payments for online stores. We've grouped the places that actually took time into three.
1. The card or easy-pay app won't open
When the user picks a payment method, the PG payment window calls a card company app or an easy-pay app. The URL it passes isn't https; it starts with intent:// or a scheme specific to each app. The WebView tries to open these like a web page and shows an error screen.
Android's official docs say that to handle link navigation yourself, you create a WebViewClient and override shouldOverrideUrlLoading. For URLs the WebView should keep opening, return false; for URLs another app should open, hand them off as an Intent and return true.
override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean {
val url = request.url.toString()
if (url.startsWith("http://") || url.startsWith("https://")) return false
return try {
val intent = if (url.startsWith("intent:"))
Intent.parseUri(url, Intent.URI_INTENT_SCHEME)
else Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
true
} catch (e: ActivityNotFoundException) {
// If the app isn't installed, send the user to the store using the intent's package name
true
}
}
The Toss Payments developer blog describes the same flow: convert intent URLs with Intent.parseUri and launch them, and if the app isn't installed, open the Play Store using the package name in the intent.
One more thing to check is the <queries> declaration in AndroidManifest.xml. If you don't list the card and payment app packages you call, the app may judge them as not installed even when they are, and send the user to the store. iOS can't use intent URLs, so you open app schemes separately in WKWebView's navigation handling and register the schemes under LSApplicationQueriesSchemes in Info.plist.
2. Payment went through, but it doesn't return to the app
Once the user finishes authentication in the card app, you need to send them back to your app. Without that path, they stay in the payment app, or they return to a pre-payment screen and tap pay a second time.
- Decide a return scheme unique to your app, and check in your PG's docs where that value goes
- Confirm the payment result by querying your server again, not by the "complete" shown on screen
- Decide in advance where the back button goes on the payment screen
The back button causes problems more often than you'd think. Android's docs explain using canGoBack to check for history and goBack to navigate. During payment, that history includes PG pages, so it's safer to have a separate rule that sends users to the order screen or cart during checkout.
3. It worked in test, but not in production
PGs usually give you separate settings for testing and for real payments. The trouble is on the app side. Values baked into the app sometimes can only change after another store review. So we separated them from the start, like this:
| What to separate | Test build | Production build |
|---|---|---|
| Payment keys · merchant settings | Test | Live payments |
| URL the WebView opens | Test server | Production server |
| Return scheme | Test app only | Production app only |
| Devices to check | Emulator + real device | Real device with card apps installed |
External app launches are only accurate when checked on a phone that actually has the card apps installed. The Toss Payments blog also recommends testing repeatedly on real devices. The list of card and easy-pay apps changes over time, so even after launch, periodically match your <queries> declaration against the latest list in your PG's docs.
On payment screens, stability comes before AI
We propose AI features alongside every project, but screens where money changes hands are the exception. It's safer to get the payment flow running reliably first, and then add AI features such as order-history summaries or a support chatbot to screens outside checkout.
References
- Android Developers, Build web apps in WebView (checked 2026-11-09): https://developer.android.com/guide/webapps/webview
- Toss Payments blog, Opening deep links in Android and iOS WebViews (2023-03-27): https://www.tosspayments.com/blog/articles/dev-4
- Toss Payments blog, How to use deep links well in practice (2023-10-25): https://www.tosspayments.com/blog/articles/dev-10
We review your current system and data, then outline the migration order and scope.