首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Braintree销售错误(PHP)

Braintree销售错误(PHP)
EN

Stack Overflow用户
提问于 2017-03-20 19:50:46
回答 1查看 610关注 0票数 0

我在尝试使用Braintree创建事务时遇到以下错误。在沙盒中,它工作得很好。我的服务器是一个带有负载均衡器的AWS Beanstalk设置,带有SSL (TLS 1.2)。

下面是来自error_log的错误:

代码语言:javascript
复制
[Mon Mar 20 11:32:31.816499 2017] [:error] [pid 11335] [client XX] PHP Fatal error:  Uncaught Braintree\\Exception\\Authorization in /var/app/current/scripts/lib/Braintree/Util.php:61\nStack trace:\n#0 /var/app/current/scripts/lib/Braintree/Http.php(47): Braintree\\Util::throwStatusCodeException(403)\n#1 /var/app/current/scripts/lib/Braintree/TransactionGateway.php(477): Braintree\\Http->post('/merchants/jtd9...', Array)\n#2 /var/app/current/scripts/lib/Braintree/TransactionGateway.php(49): Braintree\\TransactionGateway->_doCreate('/transactions', Array)\n#3 /var/app/current/scripts/lib/Braintree/TransactionGateway.php(289): Braintree\\TransactionGateway->create(Array)\n#4 /var/app/current/scripts/lib/Braintree/Transaction.php(502): Braintree\\TransactionGateway->sale(Array)\n#5 /var/app/current/ajax/add_points.php(23): Braintree\\Transaction::sale(Array)\n#6 {main}\n  thrown in /var/app/current/scripts/lib/Braintree/Util.php on line 61, referer: https://XX.com/dashboard

以下是实际的服务器端PHP代码:

代码语言:javascript
复制
require_once('../scripts/lib/Braintree.php');
Braintree_Configuration::environment('production');
Braintree_Configuration::merchantId('xx');
Braintree_Configuration::publicKey('xx');
Braintree_Configuration::privateKey('xx');
$pym = $_POST["payment_method_nonce"];
$points = 10*1.5;

        $result = Braintree_Transaction::sale([
            'amount' => $points,
            'currency' => 'EUR',
            'paymentMethodNonce' => $pym,
            'options' => [
                'submitForSettlement' => true
            ]
        ]);

上面代码的::sale部分就是上面的错误所在。在包含Braintree.php文件和所有配置选项之后,我尝试执行一个exit();,它按预期退出,因此错误肯定是由代码的::sale部分引起的。

在沙盒中一切工作正常,并且nonce似乎正确地生成了客户端,然后发送。

我甚至不确定从哪里开始调试。任何建议都会有帮助!

EN

回答 1

Stack Overflow用户

发布于 2017-03-26 21:04:01

原来我的客户申请被拒绝了。

这里的关键术语是authorization-它不同于authentication (它与密钥相关,这是正确的)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42902855

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档