Home > Software design >  how to set redirect link for when user updates subscription stripe
how to set redirect link for when user updates subscription stripe

Time:12-16

So i have the stripe subscription portal enabled on my node.js app. It is working fine, but when someone updated there plan, it says it's completed, but it doesn't redirect BACK to my app unless i hit the back button. I was wondering if when they hit confirm changes, then instead of redirceting back to the portal page, go to my app instead. here's the code i have.

    app.get('/create-customer-portal-session', authCheck, async (req, res) => {
    const session = await stripe.billingPortal.sessions.create({
      customer: req.session.customerid,
      return_url: 'http://localhost:3000/account',
    });
  
    res.redirect(session.url);
  });

haven't found anything online about this, so not sure if it is doable, but just wondering! Thanks

CodePudding user response:

The user can click the Back button or the portal link (i.e., the return_url value) to go back to your app. There is no way for Stripe portal page to automatically redirect to your page upon payment confirmation.

  • Related