Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
4 contributors

Users who have contributed to this file

@jamesallsup @howdu @danielkerr @JesseOC
51 lines (51 sloc) 1.48 KB
{% if payment_pp_express_incontext_disable != 1 %}
<div class="d-inline-block pt-2 pd-2 w-100">
<div class="float-right pp-checkout-button-container">
<div id="pp-checkout-button"/>
</div>
</div>
<script>
(function() {
paypal.Button.render({
env: '{{ paypal_environment }}',
payment: function(data, actions) {
return paypal.request.get("{{ continue }}", {
headers: {
'Accept': 'application/paypal-json-token',
}
})
.then(function(response) {
if (!response || !response.token) {
throw new Error('There was an error fetching the PayPal token');
}
return response.token;
})
.catch(function(err) {
throw err;
});
},
onAuthorize: function(data, actions) {
return actions.redirect();
},
onCancel: function(data, actions) {
return actions.redirect();
},
onError: function(error) {
$('.pp-checkout-button-container').empty().html('<div class="alert alert-danger">' + error + '</div>');
return;
}
}, '#pp-checkout-button');
})();
</script>
{% else %}
<div class="d-inline-block pt-2 pd-2 w-100">
<div class="float-right">
<a href="{{ continue }}" class="btn btn-primary" id="button-confirm" data-loading-text="{{ text_loading }}">{{ button_continue }}</a>
</div>
</div>
<script type="text/javascript"><!--
$('#button-confirm').on('click', function() {
$('#button-confirm').button('loading');
});
//--></script>
{% endif %}
You can’t perform that action at this time.