#Dara - Checkout Error Testing
1 messages · Page 1 of 1 (latest)
Hello! We do not recommend using client-only Checkout at this point. That said, if you do need to use client-only Checkout, can you provide more details? Are you asking how to make the stripe.redirectToCheckout Promise resolve with an error?
oh what is that you dont recommend client only checkout?
yes i want to return the promised resolve with an error.
No wonder the documentation changed recently and it does not present the client only option anymore.
I want to add to the error state and alert the user.
With the server option, it is easy. Just throw new Error() lol
I think you would need to use your browser dev tools to prevent network communication with Stripe to produce the error in the Promise.
But yeah, creating Checkout Sessions server-side and sending people to the url on them is our recommended approach: https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-url
But client only does that also. Is it more secure with server side that you recommend it?
I am only creating a short tutorial.
For my real apps, i am using server side. Don't worry! 🙂
But client only does that also.
Does what also?
does redirect to cancel and success url also
Yeah, but that has nothing to do with what you're asking about, right?
You want to get stripe.redirectToCheckout to produce a Promise with an error, correct?
The only reason it will do that is if it can't redirect to Checkout in the first place, so the only way to make that happen is to prevent it from contacting Stripe.
ok sounds good
Now, is there a particular reason Stripe recommends server side only now?