diff --git a/ASAshop.html b/ASAshop.html
index c60fa95..5065b45 100644
--- a/ASAshop.html
+++ b/ASAshop.html
@@ -689,20 +689,22 @@
const j1 = await r1.json();
if (!j1.ok) { alert(j1.error || 'reserve failed'); return; }
+ // 2) create checkout
// 2) create checkout
const r2 = await fetch(`${API}/api/create-checkout`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
resKey: j1.resKey,
- items: [],
+ items: cart, // ← send your cart, not []
success_url: location.origin + location.pathname + '?ok=1',
cancel_url: location.origin + location.pathname + '?cancel=1'
})
});
const j2 = await r2.json();
- if (!j2.url) { alert(j2.error || 'create-checkout failed'); return; }
- location.href = j2.url; // redirect to Stripe
+ if (!r2.ok || !j2.url) { alert(j2.error || 'create-checkout failed'); return; }
+ location.href = j2.url;
+
}
document.getElementById('checkoutBtn').addEventListener('click', async () => {
const entries = Object.entries(state.cart || {});