IntegrationError from Stripe when using redirectToCheckout
See original GitHub issueversion: “3.0.0-beta.2”
What is the issue?
when I use redirectToCheckout
, it would throw this error
My Code
...
// use-shopping-cart hook
const {
totalPrice,
cartCount,
clearCart,
cartDetails,
redirectToCheckout,
addItem,
removeItem,
} = useShoppingCart();
// Detect if the cart is empty
useEffect(() => {
setCartEmpty(!cartCount);
}, [cartCount]);
const handleCheckout: React.FormEventHandler<HTMLFormElement> = async (event) => {
event.preventDefault();
setLoading(true);
const response = await fetchPostJSON('/api/checkout_sessions/cart', cartDetails);
if (response.statusCode === 500) {
console.error(response.message);
return;
}
console.log(response);
redirectToCheckout({ sessionId: response.id }); // <- this is the line that throws the error
};
...
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
stripe.redirectToCheckout: Invalid value for sessionId. You ...
Stripe has problem: Uncaught IntegrationError: stripe. ... I tried to define an json object and use session.id but still doesn't work.
Read more >Redirect to Checkout - Stripe JS Reference
Use stripe.redirectToCheckout to redirect your customers to Checkout, a Stripe-hosted page to securely collect payment information.
Read more >Checkout migration guide | Stripe Documentation
Learn how to migrate from the legacy version of Checkout to the current version.
Read more >Checkout prices migration guide | Stripe Documentation
Learn how to update your integration to use prices with Stripe Checkout. The Prices API adds new features and flexibility to how you...
Read more >stripe.confirmPayment - Stripe JS Reference
Use stripe.confirmPayment to confirm a PaymentIntent using data collected by the Payment Element. When called, stripe.confirmPayment will attempt to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh okay, my bad. If you could create a GitHub Release with a list of all the changes to the React API for the beta version it would help people checking out the beta version by letting them know what’s going on @dayhaysoos.
@dayhaysoos We should definitely add a warning when
stripe
is not of typestring
that tells them thatuse-shopping-cart
will takes the public API key itself and will do the loading of Stripe.