I have a next.js site deployed through Vercel, mainly using the https://vercel.com/templates/next.js/subscription-starter template as a starting point for the Stripe integration functionality.
Everything works fine, including handling sign-ups and receiving payment, but when a user manages their account then clicks "Return to [site]" the url redirects to the Vercel deployment URL instead of the custom site URL it should be redirecting to (and where the user is coming from).
In my Stripe webhook I can clearly see the incorrect return_url: "return_url": "https://site-name-deployment-number-firstname-lastname-projects.vercel.app/account",
Does anyone know what parameter I need to update to make this redirect to my custom URL site? I've tried updating every platform parameter I can find, including:
Stripe: Billing settings Customer Portal, where you can see at the botom the redirect link is to my custom site /account.
Vercel: The only param I see that might be related is within Settings -> Domains, which contains my custom domain and the non-deployment version Vercel URL (e.g. APP-NAME.vercel.app).
Supabase (in case it's some sort of auth thing): Within Auth -> URL Configuration only my custom site is in the Site URL, I deleted the Vercel deployment wildcard URLs from the Redirect URLs list.
Assuming the Customer Portal is the page you're referring to here in which you click "Return to [site]" and are redirected to the wrong page, then most likely the code that is creating the Customer Portal session is passing this incorrect return_url. I'm not familiar with this Vercel template at all, but if you have access to the code, then you need to modify this return url.