如何使用Braintree沙盒测试PayPal付款

3

我在我的应用中使用Braintree进行付款(信用卡和Paypal)。我正在使用自定义UI。当点击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账户进行验证。目前我正在使用Braintree沙盒账户。
1个回答

2

完整披露:我在 Braintree 工作。

你所描述的是沙盒账户的预期行为。请参考 Braintree 文档

使用沙盒 API 密钥启动的 PayPal 交易无法用于全面的端到端测试。沙盒测试的目标是确保你的客户端和服务器端配置正确,并且你正在接收请求的适当响应。如果你想进行端到端测试,你需要在生产账户中进行。

但是,如果你对使用沙盒账户测试 PayPal 有进一步的问题,请联系 Braintree 支持团队以了解如何满足你的需求。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接