real middleman: BTCPay payment gate + webhook + Printful adapter + checkout redirect
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user