#mmunir-cors

1 messages · Page 1 of 1 (latest)

grave cradle
#

@heady vortex hard to say without more details unfortunately. How did you integrate, what API request are you making, what part of the code fails, etc.

heady vortex
grave cradle
#

doesn't look like a Stripe error right now, looks like a bug in your own code. When I press donate, something seems to do a redirect inside a fetch which can't work

heady vortex
#

Same code works well in local host sever quite strange

grave cradle
#

Your server likely enforces CORS policy differently fetch('/checkout_sessions', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ cause: cause.value, currency: currency.value, amount: parseInt(amount.value * 100, 10), }), }) .then((response) => response.json()) .then((session) => { stripe.redirectToCheckout({ sessionId: session.id }); }) .catch((error) => { console.error('Error:', error); });
seems like you do a fetch here and I assume server-side you redirect for some reason instead of returning the session id? Change this to be a real form submit instead and redirect server-side

heady vortex
#

Any example in document on stripe available?