2

我在我的应用程序中使用 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%1 2Fv1% 2 它给了我虚拟的随机数。我想通过登录与我的 Paypal a/c 核对。现在我正在使用 Braintree 沙箱 a/c。

4

1 回答 1

1

全面披露:我在布伦特里工作。

您所描述的是沙盒帐户的预期行为。请参阅Braintree 文档

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

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

于 2016-12-28T23:20:26.503 回答