Add comprehensive logging to debug checkout issues
Added console.log statements to track: - Client: API response status, data, and errors - Server: Stripe configuration check, rate limiting, order creation, Stripe session creation This will help identify exactly where the checkout flow is failing. Check browser console for client-side errors and server logs for API errors. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
c9f5626984
commit
3d48e4d545
@@ -123,12 +123,15 @@ export default function CheckoutPageClient({ isLoggedIn, customer }: CheckoutPag
|
||||
body: JSON.stringify({ items, customerId: customer.id }),
|
||||
});
|
||||
const data = await res.json();
|
||||
console.log('Checkout response:', { status: res.status, ok: res.ok, data });
|
||||
if (!res.ok || !data.url) {
|
||||
throw new Error(data.error ?? 'Something went wrong starting checkout.');
|
||||
}
|
||||
window.location.href = data.url;
|
||||
} catch (err) {
|
||||
setCheckoutError(err instanceof Error ? err.message : 'Something went wrong.');
|
||||
const errorMsg = err instanceof Error ? err.message : 'Something went wrong.';
|
||||
console.error('Checkout error:', errorMsg);
|
||||
setCheckoutError(errorMsg);
|
||||
setCheckingOut(false);
|
||||
}
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user