【发布时间】:2018-11-20 11:36:27
【问题描述】:
我已经在Braintree iOS's GITHub. 上开了一张关于这个的票,只是希望能快速得到一些帮助。问题来了:
正如标题所说,我的付款(在 iOS 中)总是失败。虽然显然,我同事的工作(Android)中的付款成功。
我从这里彻底遵循了示例代码和指南:https://developers.braintreepayments.com/guides/paypal/client-side/ios/v4
在 iOS 中,经过所有过程(来自我们服务器的客户端令牌 --> BT SDK --> PayPal 浏览器 --> 应用程序 --> 将 nonce 发送到我们的服务器),我从我们的服务器得到的错误总是:
不支持 PayPal 待付款。
我的后端人也不知道这背后的原因,他只显示并给了我这个日志:
{
"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 浏览器过早关闭,这就是为什么我得到的 nonce 总是无效的。这是为什么呢?
【问题讨论】:
标签: ios swift paypal braintree