#dogge_pau
1 messages · Page 1 of 1 (latest)
Hi. Let me help you with this.
This is deprecated. Please use the generated Checkout URL to redirect the customer yourself, e.g. via the backend or with window.location = checkoutUrl on the frontend.
how can i get checkout url?
How are you getting creating a Checkout Session?
const stripePromise = Stripe.loadStripe(process.env.REACT_APP_STRIPE_PUBLISHABLE_KEY)
const handlePayment = async()=>{
try
{
const stripe = stripePromise;
const res = await makePaymentRequest.post("/api/orders",
{
products: cartItems,
})
await stripe.redirectToCheckout(
{
sessionId: res.data.stripeSession.id,
})
}catch(error)
{
console.log(error)
}
can you tell what i need to change in this code
Are you following any Stripe guide?
no i was follwoing through a tutorial as i m beginner
i tried to check up Stripe guide but i couldn't understand much
What tutorial?
Basically, Orders/Cart API is legacy, I recommend you to start with this tutorial: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=checkout