【问题标题】:Braintree DropIn + Apple Pay, doesn't appears Apple Pay itemBraintree DropIn + Apple Pay,不出现 Apple Pay 项目
【发布时间】:2019-03-15 10:32:21
【问题描述】:

我成功地从 Braintree SDK 调用 DropIn 视图。 BTDropInRequest 设置应显示三个项目:

  1. 贝宝
  2. 信用卡
  3. 苹果支付

但由于某种原因,DropIn 视图只呈现了两个项目而不是三个:

  1. 贝宝
  2. 信用卡

我做错了什么?

准备工作:

  • 所有证书均已创建并上传
  • Apple Pay 已在项目功能上启用
  • 商户ID已添加
  • 我进行测试的设备支持 Apple Pay

这是请求的方法代码:

func showDropIn(clientTokenOrTokenizationKey: String) {

        BTUIKAppearance.darkTheme()
        let request = BTDropInRequest()    
        let canMakePayments = PKPaymentAuthorizationViewController.canMakePayments() && PKPaymentAuthorizationViewController.canMakePayments(usingNetworks: [.amex, .visa, .masterCard])
        request.applePayDisabled = !canMakePayments
        request.cardDisabled = false

        let dropIn = BTDropInController.init(authorization: clientTokenOrTokenizationKey, request: request) { (controller, result, error) in

            if (error != nil) {
                print("ERROR")
            } else if (result?.isCancelled == true) {
                print("CANCELLED")

            } else if let result = result{

                switch result.paymentOptionType {
                case .applePay ,.payPal,.masterCard,.discover,.visa:

                    if let paymentMethod = result.paymentMethod {

                        controller.dismiss(animated: true, completion: nil)
                    } else {

                        controller.dismiss(animated: true, completion: {

                            self.braintreeClient = BTAPIClient(authorization: clientTokenOrTokenizationKey)

                            let paymentRequest = self.paymentRequest()

                            if let vc = PKPaymentAuthorizationViewController(paymentRequest: paymentRequest)
                                as PKPaymentAuthorizationViewController?
                            {
                                vc.delegate = self
                                self.present(vc, animated: true, completion: nil)
                            } else {
                                print("Error: Payment request is invalid.")
                            }

                        })
                    }

                default:
                    print("error")
                    controller.dismiss(animated: true, completion: nil)
                }
            }
        }

        self.present(dropIn!, animated: true, completion: nil)
    }

【问题讨论】:

  • 我遇到了同样的问题。事实证明,我所在的国家/地区不支持 Apple Pay,尽管我使用的设备支持它。尝试在模拟器中运行相同的。解决了我的问题。
  • @bhakti123,几个小时前,我收到了来自 Braintree 支持的答复。虽然 Apple Pay 可能支持他们在我的乌克兰推出,但 Braintree 还没有。我还尝试在模拟器上使用午餐应用程序 - 结果相同,没有 Apple Pay 按钮。你在模拟器上的午饭前做了一些准备吗?
  • @RomanRomanenko 你找到解决方案了吗?
  • @balkaran singh,我所做的一切,我都做对了。我的本地测试服务器没有出现按钮。我在乌克兰进行了测试,客户在美国。当服务器端完成所有准备工作(他们将 Braintree 帐户注册为美国商家)并且我从服务器获取密钥时,Apple Pay 按钮终于出现了!

标签: ios swift applepay braintree-sandbox


【解决方案1】:

根据 Braintree 的文档,您应该完成 Apple Pay 集成,并且支持客户的设备和卡类型。

https://developers.braintreepayments.com/guides/drop-in/setup-and-integration/ios/v4#apple-pay

另外,请注意这一点

如果使用带有客户 ID 的客户令牌,Apple Pay 卡将 不会自动被拱起。您可以使用付款方式nonce 在您的服务器上创建付款方式。

【讨论】:

    猜你喜欢
    • 2015-09-19
    • 2018-09-30
    • 2022-08-13
    • 2019-05-08
    • 2018-10-23
    • 1970-01-01
    • 2020-12-11
    • 2020-10-07
    相关资源
    最近更新 更多