#dogge_pau

1 messages · Page 1 of 1 (latest)

severe urchinBOT
unkempt arrow
#

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.

radiant hearth
#

how can i get checkout url?

unkempt arrow
#

How are you getting creating a Checkout Session?

radiant hearth
#

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

unkempt arrow
#

Are you following any Stripe guide?

radiant hearth
#

no i was follwoing through a tutorial as i m beginner

#

i tried to check up Stripe guide but i couldn't understand much

unkempt arrow
#

What tutorial?