如何解决Braintree无缘无故使我的Paypal订阅失败-PHP Braintree
在您阅读本文之前,我需要让您知道任何想法都是有帮助的,我只是不知道该怎么做。
我在Paypal业务上注册,并将其连接到我的Braintree帐户(均为沙盒)。如果您认为可能的话,将Flow设置为Vault。
当我尝试使用信用卡付款时,它可以很好地工作(我猜一切都设置得很好,只要可以使用),但是在贝宝转账时总是会失败->错误是转账被处理器阻止(处理器2046年拒绝:TRANSACTION_REFUSED)
这是服务器代码:
//this works ok,the client is created in Valut
$result = $gateway->customer()->create([
'email' => $emejl,'paymentMethodNonce' => $nonceFromTheClient
]);
if ($result->success) {
$customerID = $result->customer->id;
$customerToken = $result->customer->paymentMethods[0]->token;
//THIS GETS REJECTED,I GET ERROR WHEN I ECHO $RESULT IF I USED PAYPAL,CARD WORKS
$result = $gateway->subscription()->create([
'paymentMethodToken' => $customerToken,'planId' => 'premiumPlanID',]);
}
这是javascript-无需查看此imo,这就是他们所说的我应该做到的
braintree.dropin.create({
authorization: '$clientToken',container: '#dropin-container',paypal: {
/* THIS IS WHAT ENABLES PAYPAL WITH BRAINTREE*/
flow: 'vault'
}
},function (createErr,instance) {
button.addEventListener('click',function () {
instance.requestPaymentMethod(function (err,payload) {
isplata = payload.nonce;
//posting to php code
var xhr = new XMLHttpRequest();
xhr.open('POST','./aincl/placanje.php',true);
xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xhr.onload = function() {
odgovor = this.responseText;
if (odgovor == '') {
location.href = './gotologin.php';
} else {
alert('You messed something!');
console.log(odgovor);
}
};
//all these variables are declared,no empty/null ones
xhr.send('nonc='+isplata+'&korisnik=$korisnik&key=$key');
});
});
});
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。