gpt4 book ai didi

ios - 如何使用braintree沙箱测试paypal支付

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:02:14 31 4
gpt4 key购买 nike

我在我的应用程序中使用 braintree 进行支付(信用卡和 Paypal)。我正在使用自定义用户界面。当点击通过 Paypal 按钮付款时,我使用以下代码。

    braintreeClient = BTAPIClient(authorization: tokenizationKey)!
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

// See BTPostalAddress.h for details

} else if error != nil {
// Handle error here...
} else {
// Buyer canceled payment approval
}
}

它打开此链接 https://checkout.paypal.com/one-touch-login-sandbox/index.html?action=setup_billing_agreement&ba_token=BA-HERMES-SANDBOX-TOKEN&cancel_url=com.pronto.btreeInteg.payments%3A%2F%2Fonetouch%2Fv1%2Fcancel&controller=client_api%2Fpaypal_hermes&experience_profile%5Baddress_override%5D=false&experience_profile%5Bno_shipping%5D=1&merchant_id=qkd2xjhc84nhd5b3&return_url=com.pronto.btreeInteg.payments%3A%2F%2Fonetouch%2Fv1%2Fsuccess&version=1 .它给了我虚拟随机数。我想通过登录查看我的 Paypal a/c。现在我正在使用 Braintree 沙箱 a/c。

最佳答案

全面披露:我在 Braintree 工作。

您所描述的是沙盒帐户的预期行为。查看Braintree docs :

PayPal transactions initiated with sandbox API keys cannot be used for full end-to-end testing. The goal of sandbox testing is to ensure your client and server side configurations are correct and that you are receiving appropriate responses for your requests. If you wish to do end-to-end testing, you will need to do that in your production account.

但是,如果您对使用沙盒帐户测试 PayPal 有更多疑问,请 contact Braintree support了解如何满足您的需求。

关于ios - 如何使用braintree沙箱测试paypal支付,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41261073/

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