real middleman: BTCPay payment gate + webhook + Printful adapter + checkout redirect

This commit is contained in:
drjones
2026-08-26 16:52:04 -07:00
parent f2482c72fb
commit 3037f3c996
11 changed files with 242 additions and 10 deletions

View File

@@ -80,12 +80,17 @@ export default function Checkout() {
setPlacing(true);
setError(null);
try {
const created = await api.post<Order>('/orders', {
const created = await api.post<any>('/orders', {
customer_email: email,
items: lines.map((l) => ({ product_id: l.product.id, qty: l.qty })),
});
clear();
setOrder(created);
// redirect straight to the BTCPay payment page so the customer actually pays
if (created?.checkout_url) {
window.location.href = created.checkout_url;
return;
}
setOrder(created.order);
} catch (err) {
setError(err instanceof Error ? err.message : 'Failed to place order');
} finally {