I am using Stripe Checkout on my website and I use several buttons to open the checkout popup. I am now basically using the exact same code twice besides changing the id. Is there a way to combine this into one function?
document.getElementById('buyCourseButton').addEventListener('click', function(e) {
// Open Checkout with further options:
handler.open({
name: 'Company name', // TODO
description: 'Product description', // TODO
currency: 'eur',
amount: '{{ course_price }}'
});
e.preventDefault();
});
document.getElementById('buyCourseButton2').addEventListener('click', function(e) {
// Open Checkout with further options:
handler.open({
name: 'Company name', // TODO
description: 'Product description', // TODO
currency: 'eur',
amount: '{{ course_price }}'
});
e.preventDefault();
});
('click', yourFunction)Invalid source object: must be a dictionary or a non-empty string.