adding multiple subscriptions 2

This commit is contained in:
rizwanisready
2024-04-07 17:07:32 +05:30
parent 437a915306
commit ae60a5df44

View File

@@ -427,18 +427,14 @@
<script>
console.log("Sanity check!");
var button = document.getElementById("submitBtn");
// Then, disable the button
// Get Stripe publishable key
fetch("https://goodtimes.betadelivery.com/subscriptions/stripe-subscription/")
.then((result) => { return result.json(); })
.then((data) => {
// Initialize Stripe.js
const stripe = Stripe(data.publicKey);
console.log("loaded stripe public key");
// new
// Event handler
// document.querySelector("#submitBtn").addEventListener("click", () => {
@@ -459,6 +455,8 @@
document.querySelectorAll(".subscribe-btn").forEach(button => {
button.addEventListener("click", () => {
const subscriptionId = button.getAttribute("data-subscription-id");
console.log("subscriptionId: ", subscriptionId);
button.disabled = true;
// Create checkout session for the selected subscription
fetch("https://goodtimes.betadelivery.com/subscriptions/create-checkout-session/", {