external script embed with callbacks
Unanswered
Black carpenter ant posted this in #help-forum
Black carpenter antOP
what is best method to include a external url based script in react?
which also implements callbacks
example like
which also implements callbacks
example like
<script src="https://gateway.card.com/static/checkout/checkout.min.js" data-error="errorCallback" data-cancel="cancelCallback"></script>
<script type="text/javascript">
function errorCallback(error) {
console.log(JSON.stringify(error));
}
function cancelCallback() {
console.log('Payment cancelled');
}
Checkout.configure({
session: {
id: '<your_initiate_checkout_session_ID>'
}
});
</script>
1 Reply
Ocicat
have you tried using the Script component?
https://nextjs.org/docs/pages/building-your-application/optimizing/scripts
In your case you will need two
https://nextjs.org/docs/pages/building-your-application/optimizing/scripts
In your case you will need two
Script
components in your case