You moved off Lovable or Bolt (or just bought a real domain), repointed the Stripe webhook, and the first buyer pays fine, then lands on the old site, a dead preview URL, or a sign-in page that loops. The webhook endpoint isn't the only URL that remembers your old domain. Several more live in your code, in the Stripe Dashboard and in Supabase.
For the webhook endpoint itself (exact final URL, the right whsec_, resending missed events), use the webhook migration checklist. This page covers the rest.
Hosted Checkout sends the buyer wherever your server told it to when it created the session. success_url is "The URL to which Stripe should send customers when payment or setup is complete", and with cancel_url set, "customers will be directed to this URL if they decide to cancel payment and return to your website" (Stripe API: Create a Checkout Session). Nothing in Stripe updates these for you. AI builders often hard-code the preview URL or read it from an env var such as VITE_SITE_URL or NEXT_PUBLIC_SITE_URL that still holds the old value.
success_url isn't allowed there; you pass return_url instead. For embedded Checkout, with the default redirect_on_completion "The Session will always redirect to the return_url after successful confirmation" (source). Same fix: build it from the new domain.{CHECKOUT_SESSION_ID} in the success URL exactly as written. Stripe: "This is a literal string and you must add it exactly as you see it here" (Stripe docs: Customize redirect behavior).The success page is only a landing page. Access should still be granted by the webhook, because "customers aren’t guaranteed to visit that page" (source). If the old success page used to unlock the account, read success page unlocks without payment before you rebuild it.
// One place for the public URL. Set SITE_URL=https://www.newdomain.com on the new host (no trailing slash).
const SITE_URL = process.env.SITE_URL;
if (!SITE_URL) throw new Error("SITE_URL is not set"); // fail loudly instead of sending buyers to an old default
const session = await stripe.checkout.sessions.create({
mode: "payment",
line_items: [{ price: process.env.PRICE_ID, quantity: 1 }],
success_url: `${SITE_URL}/success?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${SITE_URL}/pricing`,
});
// Customer Portal: pass the return URL per session too.
const portal = await stripe.billingPortal.sessions.create({
customer: customerId,
return_url: `${SITE_URL}/account`,
});
Variable and route names are placeholders. In a Vite app only VITE_-prefixed variables reach the browser (Vite docs: Env variables); these Stripe calls belong on the server, which reads its own env.
If you sell through Payment Links, the after-payment redirect is stored on the link, not in your code. In the Dashboard you set it under After the payment when creating or editing a link, and you can "redirect your customers to your website instead of providing a confirmation page"; through the API it is after_completion with after_completion[redirect][url] (Stripe docs: After a payment link payment). Edit each live link, or update it with the API, where after_completion is the "Behavior after the purchase is complete" (Stripe API: Update a payment link). The buy.stripe.com link itself doesn't change, so buttons on the new site can keep it.
The portal's "return to site" link comes from one of two places. A portal session's return_url is "The default URL to redirect customers to when they click on the portal’s link to return to your website" (Stripe API: Create a portal session). If your code doesn't pass one, the configuration's default_return_url is used, and it "can be overridden when creating the session" (Stripe API: Create a portal configuration). Stripe's integration guide notes that return_url "is required if a default return URL isn’t set in the Dashboard configuration" (Stripe docs: Integrate the customer portal). Update both: the value in code and the default in the portal settings. Live mode and each sandbox keep separate portal configurations (source), so fix the live one.
If your page shows Stripe's payment form itself (Elements, or Checkout's embedded form), the new domain has to be registered. Stripe: "you must register every web domain that shows the payment method if your integration uses Elements or Checkout’s embeddable payment page", including subdomains such as www, and Apple Pay is listed as required (Stripe docs: Register domains for payment methods). If a domain is disabled, "the payment methods no longer appear" on that domain (source). Add the new domain on the Payment method domains page, and "register your domains in live mode before going live" (source).
This is where sign-in and email links break. Supabase: "The Site URL in URL Configuration defines the default redirect URL when no redirectTo is specified in the code", and "This setting is critical for email confirmations and password resets" (Supabase docs: Redirect URLs). If it still holds the old domain, confirmation and reset emails send people there.
redirectTo should match the Redirect URLs list configuration" (source). Supabase's troubleshooting note for redirects landing on the wrong site: "In order for the provided redirectTo option to work you must set the exact URL in the shown Redirect URL's setting" (Supabase troubleshooting: redirected to the wrong URL). The Auth server's own README describes redirect_to as defaulting to SITE_URL (Supabase Auth (GoTrue) README), so a new-domain URL missing from the list typically sends users to the old Site URL instead.{{ .SiteURL }} and you use redirectTo, Supabase says you may need {{ .RedirectTo }} instead (source).Be precise here, because two different URL fields are involved. For Google with Supabase Auth on the web, Supabase's setup says: under Authorized JavaScript origins "add your application's URL", and under Authorized redirect URIs "add your Supabase project's callback URL" (Supabase docs: Sign in with Google).
https://<project-ref>.supabase.co/auth/v1/callback), not your app's domain. If you kept the same Supabase project, moving the frontend doesn't change it.https://api.example.com/auth/v1/callback (Supabase docs: Custom domains).SITE_URL value on the server.success_url / cancel_url (or return_url for embedded) are built from SITE_URL.return_url, and the live portal configuration's default return URL is updated.www, if used) is on Payment method domains in live mode.We moved the app from OLD_DOMAIN to https://NEW_DOMAIN. 1) Find every hard-coded URL or env var that contains OLD_DOMAIN or a preview hostname and list them. 2) Create one server-side SITE_URL setting (no trailing slash) and fail with an error if it is missing. 3) Build Stripe Checkout success_url (keep {CHECKOUT_SESSION_ID} literally) and cancel_url from SITE_URL; for embedded Checkout, build return_url from it. 4) Build the Customer Portal return_url from SITE_URL. 5) Make Supabase auth calls (signInWithOAuth, signInWithOtp, resetPasswordForEmail) use redirectTo/emailRedirectTo built from SITE_URL. 6) Do not change the Stripe webhook handler logic; access is still granted only from verified webhook events. 7) Give me a list of the settings I must change by hand: Payment Link redirects, portal default return URL, payment method domains, Supabase Site URL and Redirect URLs, Google OAuth origins.
4242 4242 4242 4242, and check the address bar on the success page. Start another and click back to test the cancel URL.curl -i -X POST to the live webhook URL: 400 is right, a 3xx means it still redirects.Paste your webhook URL. WebhookProof sends 3 harmless test requests and tells you whether Stripe can reach it and whether it rejects unsigned events. If it finds a problem, the $9 fix pack gives you the exact copy-paste fix for your stack (refundable for 14 days).
Run the free checkCheckout sends the buyer to the success_url (or cancel_url) your server passed when it created the session. Stripe does not update it when you move, so change the hard-coded value or env var to the new domain. Sessions created before the change keep their old URLs until they expire.
On the payment link itself: in the Dashboard under After the payment, or through the API with after_completion and after_completion[redirect][url]. Edit each live link that redirects.
Pass return_url when you create each portal session, and update the default return URL in the portal configuration, which is used when a session does not set one.
The Site URL in Supabase Auth URL Configuration is the default redirect and is used for email confirmations and password resets. Set it to the new production URL and add the exact new callback URLs to the Redirect URLs list.
With Supabase Auth, the Google redirect URI is your Supabase project callback URL, not your app domain, so it stays the same if you keep the same project. Add the new domain to Authorized JavaScript origins. The callback only changes with a new Supabase project or a Supabase custom domain.
Stripe webhook not working? Check these 7 things in order · A customer paid but didn't get access. What went wrong? · No signatures found matching the expected signature for payload · Stripe webhook failing with a 307 or 308 redirect
Last reviewed 2026-11-15. WebhookProof is an independent tool, not affiliated with Stripe, Inc.. Quotes are from the linked documentation.