#sam - redirect

1 messages ยท Page 1 of 1 (latest)

prisma linden
#

Hello! Just starting a thread for you -- I'll review and respond as soon as I can ๐Ÿ™‚

#

Hey there can you share an example payment intent ID?

#

Is this on a public page I can see?

potent sandal
#

Hello

potent sandal
#

payment is getting successfully done

#

but after I pay, it redirects to my localhost

#

even tho I have set my success url to my domain

#

`app.post("/create-checkout-session", async (req, res) => {
// const YOUR_DOMAIN = "https://" + req.host;
var postId = req.body.postId;
const session = await stripe.checkout.sessions.create({
line_items: [
{
// Provide the exact Price ID (for example, pr_1234) of the product you want to sell
price: "price_1KYPnaSHiZZTdaXJzhhz1nDs",
quantity: 1,
},
],
mode: "payment",
success_url: "https://mysterious-basin-14247.herokuapp.com/success/" + postId,
cancel_url: "https://mysterious-basin-14247.herokuapp.com/declined",
});

res.redirect(303, session.url);
});
`

#

it's getting redirected to "localhost:3552/success/ "+ postId

prisma linden
#

So before that you're going through checkout successfully, then the redirect is after checkout?

potent sandal
#

yes

prisma linden
#

ok thanks, looking

prisma linden
prisma linden
#

@potent sandal are you still around?

potent sandal
#

Yeah

#

Looking into it

#

I took a break in between

prisma linden
#

Ok cool - take your time! When ready, please double check your code and once you've confirmed what is happening hare a new example and my teammate @fervent charm can help you take a look

fervent charm
#

Hi ๐Ÿ‘‹

potent sandal
#

Hello

#

there was a silly mistake. Actually in my checkout endpoint, I forgot to change the return_url from localhost

#

now I updated it and it works

#

Thanks for the support

fervent charm
#

Beautiful! I'm happy it was resolved

potent sandal
#

Have a great day!