From 3599ae3cad30bd5c7e73ef3910d7689d33cae68b Mon Sep 17 00:00:00 2001 From: Omar Najjar Date: Fri, 28 Nov 2025 19:41:37 +1100 Subject: [PATCH] Update index.html --- index.html | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index 9579c0e..d17ef64 100644 --- a/index.html +++ b/index.html @@ -170,29 +170,25 @@ }; }); - // Pay Button - document.getElementById('pay').onclick = () => { - const amount = parseInt(amountInput.value.replace(/,/g,'')) || 0; - const email = document.getElementById('email').value.trim(); + // Pay Button using fixed payment links (change to price ids later) +document.getElementById('pay').onclick = () => { + const amount = parseInt(amountInput.value.replace(/,/g,'')) || 0; + const email = document.getElementById('email').value.trim(); - if (amount < 5) return alert('Minimum $5'); - if (!email.includes('@')) return alert('Valid email required'); + if (amount < 5) return alert('Minimum $5'); + if (!email.includes('@')) return alert('Valid email required'); - // Replace with your actual Stripe Price IDs - const priceId = paymentType === 'recurring' - ? 'test_3cI7sK5eF8lheXn76DdIA02' - : 'test_dRm9AS4aB7hd7uV76DdIA01'; + let url = paymentType === 'recurring' + ? 'https://buy.stripe.com/test_3cI7sK5eF8lheXn76DdIA02' + : 'https://buy.stripe.com/test_dRm9AS4aB7hd7uV76DdIA01'; - const stripe = Stripe('pk_test_51QSvuKCGfDSespsyzgT6rB4ad6x18k5dGO4pi98TEXzXboL8uBi7gUdrfRNUqnbPBGLIsGzhnrIDPA5plQMTbW8J00i2BQj4Sl'); + url += `?prefilled_email=${encodeURIComponent(email)}`; + if (paymentType !== 'recurring') { + url += `&amount=${amount * 100}`; + } - stripe.redirectToCheckout({ - lineItems: [{ price: priceId, quantity: 1 }], - mode: paymentType === 'recurring' ? 'subscription' : 'payment', - successUrl: window.location.origin + '/success.html', - cancelUrl: window.location.origin, - customerEmail: email, - }); - }; + window.location.href = url; +}; // Chart let chart = null;