diff --git a/ASAshop.html b/ASAshop.html
index d0a478b..59b63fd 100644
--- a/ASAshop.html
+++ b/ASAshop.html
@@ -477,7 +477,7 @@
if (u) document.getElementById('whoami').textContent =
`Signed in as ${u.global_name || u.username}`;
});
-
+
/* ===== Products (unique IDs) ===== */
const products = [
{ id: 'server1', name: 'Server Class 1', price: 25.00, category: 'servers', tag: 'Server monthly', img: 'img/PrivateServerCLASS01.png'},
@@ -665,7 +665,7 @@
});
/* ===== Checkout ===== */
- const API = "https://affiliated-lets-automatic-oak.trycloudflare.com";
+
async function checkout(cart) {
// 1) reserve
@@ -692,6 +692,17 @@
if (!j2.url) { alert(j2.error || 'create-checkout failed'); return; }
location.href = j2.url; // redirect to Stripe
}
+ document.getElementById('checkoutBtn').addEventListener('click', async () => {
+ const entries = Object.entries(state.cart || {});
+ if (!entries.length) return alert('Your cart is empty.');
+
+ const items = entries.map(([id, qty]) => {
+ const p = products.find(p => p.id === id);
+ return { id, name: p?.name || id, qty: Number(qty || 1), price: p?.price || 0 };
+ });
+
+ await checkout(items);
+ });
@@ -716,24 +727,30 @@
ctx.fillText(products.find(p => p.id === id)?.name || id, 12, cv.height - 12);
});
}
- // client.js (in your existing
-