Braintree ios + java 事务 API 返回 403

标签 braintree

刚刚开始这个项目。客户端应用程序是 Braintree 演示应用程序。我将其修改为指向在本地主机上运行的服务器

这就是我正在做的事情。

  1. ios 应用向服务器发出请求以获取 token

  2. 服务器使用下面的方法从 Braintree 获取 token 并发回服务器

    BraintreeGateway 网关 = new BraintreeGateway( 环境.SANDBOX, 商户账户ID, “…………”, “…………” ); 字符串 token = gateway.clientToken().generate();//Braintree 确实返回了一个 token

  3. ios 演示应用程序使用嵌入式 View 创建随机数

  4. ios 演示应用将随机数发送到服务器

    //nonce 发送到服务器 71a89c9d-6ca7-4804-a895-b0e7564425c6

  5. 服务器使用以下代码调用 Braintree API

        TransactionRequest request = new TransactionRequest()
        .amount(new BigDecimal(19.0f))
        .merchantAccountId(merchantAccountId)
        .paymentMethodNonce(nonce)
        .options()
            .submitForSettlement(true)
            .done()
        .channel("MyShoppingCartProvider");
        Result<Transaction> result = gateway.transaction().sale(request);
        return result;
    

最后一步从 Braintree 获得 403 com.braintreegateway.exceptions.AuthorizationException 异常。错误流中的 xml 未经授权。来自 Braintree 的输入流显示“服务器返回 HTTP 响应代码:403,URL:https://api.sandbox.braintreegateway.com:443/merchants/vb38crtnzn77b9ys/transactions

感谢您的帮助

最佳答案

原来有两个ID。一个是merchantId,另一个是merchantAccountId。服务器将商户 ID 发送回客户端。稍后进行收费时,请使用merchantAccountId。

关于Braintree ios + java 事务 API 返回 403,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27436958/

相关文章:

ios - 如何从 Braintree iOs SDK 获取随机数

ruby - Braintree - 即使欺诈返回 "Decline",交易还是成功的

javascript - Brain DropIn UI 显示错误 "Cannot read property "渲染“未定义”

Paypal 与布伦特里说 "Merchant account not found"

java - Braintree 创建 submerchant 不成功,但结果对象中没有错误

flutter - 用于 Flutter 中 PayPal 支付的 Braintree 集成

javascript - 无法使用客户 ID 创建 Braintree 客户端 token

Braintree 客户端 token 到期

node.js - Braintree customer.find() 无法使用 Nodejs

当前应用程序 Activity 中的 Android Braintree SDK 集成