gpt4 book ai didi

ios - Braintree DropIn + Apple Pay,不出现 Apple Pay 项目

转载 作者:行者123 更新时间:2023-12-01 16:22:26 28 4
gpt4 key购买 nike

我成功调用DropIn从 Braintree SDK 查看。 BTDropInRequest设置应该显示三个项目:

  • Paypal
  • 信用卡
  • 苹果支付

  • 但由于某种原因在 DropIn view 只渲染两个项目而不是三个:
  • Paypal
  • 信用卡

  • 我做错了什么?

    准备:
  • 所有证书均已创建并上传
  • 项目功能上启用了 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)
    }

    最佳答案

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

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

    另外,此时请注意

    If using a client token with a customer id, the Apple Pay card will not automatically be vaulted. You can use the payment method nonce to create a payment method on your server.

    关于ios - Braintree DropIn + Apple Pay,不出现 Apple Pay 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52741477/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com