You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

iOS端Stripe webview 3D Secure验证完成后无法自动关闭问题

iOS 14 Stripe 3D Secure校验后Webview无法自动关闭解决方案

你可以按以下步骤排查修复:

  • 补全iOS端Deep Link回调处理逻辑
    你当前使用的iOS 14系统需要在SceneDelegate.swift中添加openURL回调处理,收到kavall://stripe-redirect跳转时主动调用Stripe SDK的回调方法通知校验完成,SDK会自动关闭弹出的Safari webview:
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
    guard let url = URLContexts.first?.url else { return }
    let stripeHandled = StripePayment.handleURLCallback(with: url)
    if !stripeHandled {
        // 处理其他业务的deep link
    }
}

如果你的应用兼容iOS13以下系统,还需要在AppDelegate.swift中添加对应处理:

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    let stripeHandled = StripePayment.handleURLCallback(with: url)
    if stripeHandled {
        return true
    }
    // 处理其他业务的deep link
    return false
}
  • 确认URL Scheme配置正确
    检查Xcode中项目Info配置下的URL Types,确认已经添加了Scheme为kavall的配置,和你传入的returnURL前缀一致,保证Stripe SDK能识别到对应的回调请求。
  • 替换为官方维护的Stripe SDK
    你当前使用的stripe_payment第三方库已停止维护,存在较多高版本系统和新Stripe API适配问题。可替换为Stripe官方维护的flutter_stripe库,库内已内置3D Secure完成后自动关闭webview的逻辑,仅需按文档配置好URL Scheme即可使用,无需手动处理关闭逻辑。

内容的提问来源于stack exchange,提问作者Leo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.06 09:09:04