Hello, I would like to integrate braintree-payments into my webshop. I need to integrate this code:
<head>
<meta charset=”utf-8″>
<script src=”https://js.braintreegateway.com/web/dropin/1.20.4/js/dropin.min.js”></script>
</head>
<body>
<button id=”submit-button”>Request payment method</button>
<script>
var button = document.querySelector(‘#submit-button’);
braintree.dropin.create({
authorization: ‘CLIENT_TOKEN_FROM_SERVER’,
container: ‘#dropin-container’
}, function (createErr, instance) {
button.addEventListener(‘click’, function () {
instance.requestPaymentMethod(function (err, payload) {
// Submit payload.nonce to your server
});
});
});
</script>
</body>
I guess I could do this with a head-element and a body-element, right?
And then I need to integrate this code into my template:
braintree.dropin.create({
authorization: CLIENT_TOKEN_FROM_SERVER,
container: ‘#dropin-container’
}, function (err, instance) {
/* … */
});
Do you have any idea where to put this code? Thanks Klaus