SupercastPurchase
by ryanbrunner
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css">
<head>
<!-- This JS must be included on every page using Supercast embeds or JS.
It's recommended you include it within the HEAD element -->
<script src="https://supercast.tech/js/embed.js"></script>
</head>
<body>
<div class="container" style="margin-top: 20px;">
<!-- This can be any button or link, and you have full control over how
it's styled. Just make sure the data-action is maintained (or modify the
JS code to ensure your own button is targeted properly) -->
<button type="button" data-action="supercast-purchase" class="btn btn-primary">
Sign-up for Premium
</button>
</div>
</body>
JavaScript
const supercastButtons = document.querySelectorAll("[data-action='supercast-purchase']");
supercastButtons.forEach(button => {
button.addEventListener('click', e => {
e.preventDefault();
Supercast.startPurchase({ code: "2fa370f0-2670-4fe3-bc4c-27d8def3e600" });
})
});