【问题标题】:How to test paypal payment using braintree sandbox如何使用 Braintree 沙箱测试贝宝支付
【发布时间】:2017-05-06 18:38:00
【问题描述】:

我在我的应用程序中使用 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。

【问题讨论】:

    标签: ios paypal braintree braintree-sandbox


    【解决方案1】:

    全面披露:我在 Braintree 工作。

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

    使用沙盒 API 密钥发起的 PayPal 交易不能用于完整的端到端测试。沙盒测试的目标是确保您的客户端和服务器端配置正确,并确保您收到适当的请求响应。如果您希望进行端到端测试,则需要在您的生产帐户中进行。

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

    【讨论】:

      猜你喜欢
      • 2013-09-15
      • 1970-01-01
      • 2012-06-24
      • 2016-09-23
      • 2017-09-10
      • 1970-01-01
      • 2017-08-23
      • 2017-09-25
      • 2017-12-09
      相关资源
      最近更新 更多