Private
Public Access
1
0

better error handling

This commit is contained in:
Sander Roosendaal
2018-12-20 21:29:13 +01:00
parent ab9579a048
commit 98900059f8
6 changed files with 48 additions and 77 deletions

View File

@@ -83,31 +83,7 @@
</li>
</ul>
<script src="https://js.braintreegateway.com/web/dropin/1.14.1/js/dropin.min.js"></script>
<script>
var form = document.querySelector('#payment-form');
var client_token = '{{ client_token }}';
braintree.dropin.create({
authorization: client_token,
container: '#bt-dropin',
paypal: {
flow: 'checkout'
}
}, function (createErr, instance) {
form.addEventListener('submit', function (event) {
event.preventDefault();
instance.requestPaymentMethod(function (err, payload) {
if (err) {
console.log('Error', err);
return;
}
// Add the nonce to the form and submit
document.querySelector('#nonce').value = payload.nonce;
form.submit();
});
});
});
</script>
{% include 'braintreedropin.html' %}
{% endblock %}