gpt4 book ai didi

ios - 通过 Braintree PayPal 支付总是失败 iOS

转载 作者:搜寻专家 更新时间:2023-10-31 22:01:14 24 4
gpt4 key购买 nike

我已经在 Braintree iOS's GITHub. 上开了一张关于这个的票只是希望能尽快得到一些帮助。问题来了:

正如标题所说,我的付款(在 iOS 中)总是失败。显然,我同事的工作(Android)中的付款成功了。

我完全遵循了此处的示例代码和指南:https://developers.braintreepayments.com/guides/paypal/client-side/ios/v4

在 iOS 中,在所有过程(来 self 们服务器的客户端 token --> BT SDK --> PayPal 浏览器 --> 应用程序 --> 将随机数发送到我们的服务器)之后,我从我们的服务器得到的错误总是:

PayPal pending payments are not supported.

我的后端人员也不知道这背后的原因,他只显示并给了我这个日志:

{
"errors": {},
"params": {
"transaction": {
"type": "sale",
"amount": "1",
"merchantAccountId": "USD",
"paymentMethodNonce": "80823f63-5ea9-0b8b-67da-0710bd7d9ff1",
"orderId": "333",
"descriptor": {
"name": "company name*myurl.com"
},
"options": {
"submitForSettlement": "true",
"paypal": {
"customField": "custom",
"description": "description"
}
}
}
},
"message": "Unknown or expired payment_method_nonce.",
"creditCardVerification": null,
"transaction": null,
"subscription": null,
"merchantAccount": null,
"verification": null
}

下面是我在设置 SDK 时所做的:

private func processPayPalClientToken(_ clientToken: String) {
SVProgressHUD.show(withStatus: "Please wait...")

self.braintreeClient = BTAPIClient(authorization: clientToken)

let payPalDriver = BTPayPalDriver(apiClient: self.braintreeClient)
payPalDriver.viewControllerPresentingDelegate = self
payPalDriver.appSwitchDelegate = self

let request = BTPayPalRequest(amount: self.bookingViewModel.getTotalAmount())
payPalDriver.requestOneTimePayment(request) { (nonce, error) in
SVProgressHUD.dismiss(completion: {
if let error = error {
self.showAlert(title: "title...", message: "Error: \(error.localizedDescription).", okayButtonTitle: "OK") { _ in }
return
}

guard let nonce = nonce else { return }

self.processNonceToServer(nonce)
})

}
}

所以...知道这背后的原因是什么吗?谢谢!

编辑:我刚才找到的附加信息。 SFSafari 浏览器过早地 self 解散,这就是为什么我得到的随机数总是无效的。这是为什么?

最佳答案

完全披露:我在 Braintree 工作。如果您有任何其他问题,请随时联系 support .

根据您在问题中发布的付款方式随机数,我能够查看我们的服务器端日志以了解问题所在。

不泄露任何具体的API Credentials , 看起来好像服务器负责 generating a client token在您的设置中传递不同的沙箱 merchant ID而不是负责使用该付款方式随机数创建交易的服务器,这会导致错误。

您的服务器负责生成客户端 token ,其中包含客户端初始化客户端 SDK 所需的授权和配置详细信息。创建支付方式随机数时,它会绑定(bind)到客户端 token 授权中指定的商家 ID。 merchant ID passed during the Transaction Sale call or other API Calls必须与绑定(bind)到该特定支付方式随机数的商家 ID 相匹配,因此您需要在后端代码中修复此差异。

关于ios - 通过 Braintree PayPal 支付总是失败 iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50793996/

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