For the complete documentation index, see llms.txt. This page is also available as Markdown.

Webview URL Scheme 重点事项

处理重定向

在使用 Webview 时,一些支付渠道可能会将用户重定向到他们的电子钱包应用程序。为了正确处理这些重定向,您需要在 Webview 中使用 WebViewClient.shouldOverrideUrlLoading 方法,并根据以下的 intent 进行处理:

  • 重定向处理:一些支付渠道使用自定义 URL Scheme(如 gojek://intent://)来调用电子钱包应用。如果 Webview 无法识别这些自定义 Scheme,将导致无法正确打开钱包应用。

代码示例

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (url != null && url.startsWith("gojek://")) {
        // 处理 Gojek 钱包重定向
        return true;
    }
    return false; // 默认行为:对于标准的 URL Scheme 继续加载
}

通过实现这个方法,您可以确保 Webview 能够正确处理来自支付渠道的重定向请求,避免因无法识别自定义 URL Scheme 而导致的错误。

intent渠道列表

地区
渠道
Override URL
仅支持外部浏览器

Brazil

PicPay

picpay://

Brazil

AmeDigital

amedigital://

Indonesia

GO-PAY

gojek://

Indonesia

Shopee Pay

shopeeid://

Indonesia

Dana

danaid:// & market://details?id=id.dana

Malaysia

GrabPay

grab://

Malaysia

Shopee Pay

shopeemy://

Malaysia

Maxis

sms:32083

Malaysia

-

-

U Mobile

Singapore

GrabPay

grab://

Philippines

GrabPay

grab://

Thailand

Shopee Pay

intent://

Taiwan

Line Pay

intent://

Myanmar

KBZPay

intent://

Vietnam

MoMo

momo://

All countries

-

-

Google Pay/Apple Pay

最后更新于

这有帮助吗?