将 ClientToken 传递给 BTDropInController 后没有付款选项

No Payment Option After Passing ClientToken to BTDropInController

  1. 在 iOS.

  2. 中将 clientToken 传递给 BTDropInController 后,我没有得到任何付款选项
  3. 但是当我对 clientToken 进行硬编码并且 clientToken 来自您的 Hello-Client 示例 (https://developers.braintreepayments.com/start/hello-client/ios/v4) 时,DropIn 上有一种付款方式。

  4. 当使用 Postman 对从我们的服务器生成的 clientToken 进行硬编码时,它也不起作用。

  5. 当我使用 iOS 应用程序从我们的服务器生成一个 clientToken 时,尚未将其传递给 BTDropInController`,并将其分享给我的同事(Android 开发人员),他的 Android 应用显示了支付选项,即 PayPal。

一些代码:

    private func showBraintreeDropInWithToken(_ clientToken: String, subscription: Subscription) {
        let request = BTDropInRequest()
        let dropIn = BTDropInController(authorization: clientToken, request: request) { (controller, result, error) in
            if let error = error {
                self.showAlert("Payment gateway request failed. \(error.localizedDescription)", withCallBack: {
                    controller.dismiss()
                })
                return
            }

            if let result = result {
                if result.isCancelled {
                    controller.dismiss()
                    return
                }
                // Use the BTDropInResult properties to update your UI
                // result.paymentOptionType
                // result.paymentMethod
                // result.paymentIcon
                // result.paymentDescription
            }
        }

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

已解决!

https://github.com/braintree/braintree_ios/issues/393#issuecomment-371891330

只需安装 PayPal 依赖项即可,不要忘记 Url 方案的额外设置。