Issue moving from test to live mode w/Stripe

I was hoping someone could help.

im switching my stripe from test mode to live mode.

My platform runs on vercel and supabase

I’ve moved all the products on stripe into live

I’ve updated vercel env variables to replace the test keys for live keys for all 3 of the required keys:

STRIPE_WEBHOOK_SECRET
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
STRIPE_SECRET_KEY

I’ve updated the stripe_price_id column in the membership_tiers table of the database to include the new live price ids of the products in stripe as the price ids change from test to live.

When i went to test a live subscription payment, I’m getting the following messages in the browser:

Failed to update membership tier: No such price: ‘price_ID’; a similar object exists in live mode, but a test mode key was used to make this request… Please try again.

I cleared cache and got this message:

Failed to update membership tier: stripe.redirectToCheckout: the provided sessionId is for a live mode Checkout Session, whereas Stripe.js was initialized with a test mode publishable key… Please try again

What could be causing this?

I 100% have the live keys in vercel as env entries - and I’ve tried a few redeploys.

Any support would be greatly appreciated.

Hey @montgomeryjon-gmailc. I have a few ideas. Please let me know if any of these work for you.

It could be a hard coded value somewhere in the code. If that was the cause, you would need to check all of the places where your project uses Stripe and make sure the appropriate env var is used instead.

It could be that an environment variable isn’t available in the deployment’s environment. To fix it, make sure the env vars are enabled for the environment your branch is deployed to (e.g. preview, production, or both) and redeploy.

It could be a caused by the way your project was deployed. If you use the CLI to deploy, try running vercel pull --environment=production before deploying to make sure you have the latest variables for a production build (or use preview if that’s the relevant environment).

1 Like

I went out for a drive and came back to it working so looks like the new env vars just needed some time to settle.

Amy, thanks for your response though - significantly appreciated.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.