【发布时间】:2017-08-30 06:42:05
【问题描述】:
我实现了结帐流程,但我遇到了错误
代码:
func startCheckout() {
// Example: Initialize BTAPIClient, if you haven't already
braintreeClient = BTAPIClient(authorization: clientToken)!
let payPalDriver = BTPayPalDriver(apiClient: braintreeClient)
payPalDriver.viewControllerPresentingDelegate = self
payPalDriver.appSwitchDelegate = self // Optional
// Specify the transaction amount here. "2.32" is used in this example.
let request = BTPayPalRequest(amount: "2.32")
request.currencyCode = "USD" // Optional; see BTPayPalRequest.h for more options
payPalDriver.requestOneTimePayment(request) { (tokenizedPayPalAccount, error) in
if let tokenizedPayPalAccount = tokenizedPayPalAccount {
print("Got a nonce: \(tokenizedPayPalAccount.nonce)")
// Access additional information
let email = tokenizedPayPalAccount.email
let firstName = tokenizedPayPalAccount.firstName
let lastName = tokenizedPayPalAccount.lastName
let phone = tokenizedPayPalAccount.phone
// See BTPostalAddress.h for details
let billingAddress = tokenizedPayPalAccount.billingAddress
let shippingAddress = tokenizedPayPalAccount.shippingAddress
} else if let error = error {
print("Error here")
// Handle error here...
} else {
print("Buyer cancelled the payment")
// Buyer canceled payment approval
}
}
}
我关注这个文档link
【问题讨论】:
-
您好,您成功集成PayPal了吗?我可以有 PayPal 登录屏幕,但登录后显示返回商家。这里有什么问题?它没有显示要支付的金额。请帮我处理流程。
标签: ios swift3 paypal-sandbox braintree braintree-sandbox