Javascript Braintree Paypal在沙箱中工作,但不在生产环境中工作
我正在将Paypal/Braintree与PHP sdk一起使用,并设置Vault流来创建订阅。它在沙盒中运行良好,但现在在产品中我得到错误代码93108,消息:未知paymentMethodNonce 我的客户端代码是:Javascript Braintree Paypal在沙箱中工作,但不在生产环境中工作,javascript,php,paypal,braintree,Javascript,Php,Paypal,Braintree,我正在将Paypal/Braintree与PHP sdk一起使用,并设置Vault流来创建订阅。它在沙盒中运行良好,但现在在产品中我得到错误代码93108,消息:未知paymentMethodNonce 我的客户端代码是: braintree.setup(GFormVATVars.br_client_token, "paypal", { container: "paypal-container", singleUse: false,
braintree.setup(GFormVATVars.br_client_token, "paypal", {
container: "paypal-container",
singleUse: false,
onPaymentMethodReceived: function (obj) {
$(".gform_next_button").show();
$("span#br_pp_message").html('<img height="15" width="15" src="'+GFormVATVars.spinner_gif+'"/>');
$.post(GFormVATVars.ajaxurl,{action: 'process_br_pp_payment_token',token: obj.nonce,security: GFormVATVars.security},function(response) {
$("span#br_pp_message").html(response);
});
return;
}
});
$cargs = array(
'firstName' => $entry["6.3"],
'lastName' => $entry["6.6"],
'company' => $entry["18"],
'email' => $entry["7"]
$cargs['paymentMethodNonce'] = $_SESSION['wswp_payment_token'];
file_put_contents(dirname(__FILE__)."/logbeforectry.php",print_r($cargs,true));
try {
// Configure Braintree environment
Braintree_Configuration::environment( strtolower( $settings['environment'] ) );
Braintree_Configuration::merchantId( $settings['merchant-id']);
Braintree_Configuration::publicKey( $settings['public-key'] );
Braintree_Configuration::privateKey( $settings['private-key'] );
$cresult = Braintree_Customer::create($cargs);
file_put_contents(dirname(__FILE__)."/logcresult.php",print_r($cresult,true));
}
catch( Exception $e ) {
file_put_contents(dirname(__FILE__)."/catchcresult.php",print_r($e->getMessage(),true));
// Do nothing with exception object, just fallback to generic failure
}
它返回如上所述的错误响应。我已经检查过了,$cargs的参数都按应该的方式填充,包括在通过弹出窗口登录后,nonce具有payment\u method\u nonce的值。奇怪的是,如果你按下按钮并再次授权,它就会工作。请帮助我解决这个问题。为了解决这个问题,Braintree支持团队帮助诊断了这个问题,即正在生成的客户端令牌来自Braintree沙盒环境,然后在Braintree生产环境中使用 因此,据我所知(我不擅长paypal),如果您发送两次请求,它会起作用,那么您是否尝试将第一个请求和第二个请求保存在某个位置,然后看到不同之处?我已经减少了发送到Braintree_Customer::create的参数,以使paymentMethodNonce用于paypal支付,第一次失败,第二次成功。比较请求表明nonce两次都成功通过。您需要比较第一次和第二次发送到paypal的参数。。。我知道一定是一样的。。但我们应该这样做。。。因为如果相同的参数和相同的请求,它必须给出相同的结果。我是Braintree PayPal团队的开发者。为了澄清,您已经在logbeforectry中查看了每个请求的输出,并且每个请求都包含一个立即付款方法?如果是这种情况,并且您仍然无法通过第一个请求,我鼓励您联系我们的支持团队support@braintreepayments.com. 请随意链接这个问题并包括我的名字(Goggin),我们将查看一下我们这边的日志,以验证payment method nonce参数是否被发送。