#sam - redirect
1 messages ยท Page 1 of 1 (latest)
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?
Hello
here "id": "pi_3KwS75SHiZZTdaXJ1klrBFr4",
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
So before that you're going through checkout successfully, then the redirect is after checkout?
yes
ok thanks, looking
This payment example you shared doesn't appear to be related to any checkout session. Can you double check what your code is doing?
You've just created this directly with the API here: https://dashboard.stripe.com/test/logs/req_CpRZSs2SKjW5Dl
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
I don't see any recent requests to create checkout sessions in your logs, so you code may not be using that endpoint like you expect:
https://dashboard.stripe.com/test/logs/
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
@potent sandal are you still around?
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
Hi ๐
Hello
there was a silly mistake. Actually in my checkout endpoint, I forgot to change the return_url from localhost
const {error} = await stripe.confirmPayment({
//Elements instance that was used to create the Payment Element
elements,
confirmParams: {
return_url: 'https://mysterious-basin-14247.herokuapp.com/success/' + '<%= postId %>',
},
});
now I updated it and it works
Thanks for the support
Beautiful! I'm happy it was resolved
Have a great day!