我正在使用braintree paypal 结帐付款,付款工作正常,但无法得到响应,这是我的代码
<script type="text/javascript">
var form = document.querySelector('#payment-form');
var client_token = "<?php echo \Braintree\ClientToken::generate(); ?>";
braintree.dropin.create({
authorization: client_token,
selector: '#bt-dropin',
paypal: {
flow: 'vault',
onSuccess: function (nonce, email) {
alert('sdsdsd123');
console.log(JSON.stringify(nonce));
},
},
}, function (createErr, instance) {
if (createErr) {
console.log('Error', createErr);
return;
}
form.addEventListener('submit', function (event) {
event.preventDefault();
instance.requestPaymentMethod(function (err, payload) {
if (err) {
console.log('Error', err);
return;
} else {
console.log("Payment confirmation");
console.log(payload);
}
// Add the nonce to the form and submit
document.querySelector('#nonce').value = payload.nonce;
form.submit();
});
});
},
);
var checkout = new Demo({
formID: 'payment-form'
});
但无法在 onsuccess 函数中得到响应,谁能告诉我如何得到这个成功响应,