Guides · Free check · $9 fix pack

Guides

Buyers pay, then land on your old domain: every URL to change after a migration

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.

1. Checkout success_url and cancel_url (set in your code)

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.

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.

2. Payment Link redirects (set in the Dashboard)

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.

3. Customer Portal return URL

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.

4. Payment method domains (Apple Pay, Google Pay, Link)

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).

5. Supabase Auth: Site URL and Redirect URLs

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.

6. Google sign-in (and other OAuth providers)

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).

Cutover checklist

  1. Search the codebase and every env var for the old domain and old preview hostnames. Replace them with one SITE_URL value on the server.
  2. Checkout success_url / cancel_url (or return_url for embedded) are built from SITE_URL.
  3. Every live Payment Link with a redirect points at the new domain.
  4. Portal sessions pass a new-domain return_url, and the live portal configuration's default return URL is updated.
  5. If you use Elements or embedded Checkout: the new domain (and www, if used) is on Payment method domains in live mode.
  6. Supabase Site URL is the new production URL; Redirect URLs list the exact new callback paths; old entries removed.
  7. Google (and other providers) have the new JavaScript origin; callback URLs updated only if the Supabase project or custom domain changed.
  8. The webhook endpoint is the exact final URL with no redirect (migration checklist, 307/308 guide).

Prompt for your AI builder

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.

Re-test

  1. In a sandbox, start Checkout from the new site, pay with 4242 4242 4242 4242, and check the address bar on the success page. Start another and click back to test the cancel URL.
  2. Open the Customer Portal from the account page and click the return link.
  3. Sign up with a fresh email and request a password reset: both email links should open the new domain. Sign in with Google from the new domain.
  4. Confirm the paid user was unlocked by the webhook (Event deliveries shows 2xx), and send an unsigned curl -i -X POST to the live webhook URL: 400 is right, a 3xx means it still redirects.
Check yours in 10 seconds (free).

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 check

FAQ

Why does Stripe Checkout redirect to my old domain after I changed domains?

Checkout 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.

Where is the redirect for a Stripe Payment Link set?

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.

How do I change the Stripe Customer Portal return URL?

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.

Why do Supabase confirmation and password reset emails still link to my old domain?

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.

Do I need to change the Google OAuth redirect URI when my app moves to a new domain?

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.

Sources

More guides

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.