I let Agent write up this post for me:
I’m trying to test my app with Stripe payments in production, but I’m getting the error:
“Stripe production connection not found” (and “Failed to initialize Stripe: Error: Stripe production connection not found”)
What I’ve done:
-
Installed the “Replit Integrated Payments” app in my Stripe Live mode account
-
Completed all Stripe KYB verification (no pending tasks in Account Status)
-
Created a new Live secret key and added it to deployment secrets
-
Enabled “Sync Stripe live account with sandbox” toggle in the Publish pane
-
Published multiple times
The error occurs when my code calls the Replit connector API at /api/v2/connection with environment=production. The connector returns no credentials for production, even though sandbox/development works fine - I’m able to sign up for a subscription on my Replit Dev + Stripe Sandbox environments.
Is there an additional step needed to authorize the Stripe connector for production? Or is there a known issue with the production connector setup?
Thanks
Stripe is a PIA to implement. I read recently that Replit says you don’t need to do webhooks. I hope I read that right. In any event, you need webhooks (at least I have them) and there are two secrets to implement plus your webhook one. Sorry I can’t be more specific. I wrangled through it. I would ask the AI replit agent, what are all the possible reasons Stripe is giving me this error (state the error) and see what it comes up with.
Agreed! But Replit marketing makes it seem like the Stripe integration is so seemless. 
Anyhow, I got it to work by having Aent bypass the Replit integration and just connect using my stored secrets and keys. A waste of time using the integration.
Replit’s Stripe integration works great for sandbox testing. It’s great for simulating products, perform test transactions etc. Think of it like a way to simulate your stripe payments integration using test data in your development environment and dev database.
In order to switch to a production stripe account, you need to do a few things that replit’s stripe integration doesn’t offer out of the box.
Here’s a few things I had to figure out to make my app work for production use and accept customer payments.
1. Use your production stripe keys (live) in development environment to create your products. Replit’s stripe integration adds a product-seed file which you need to run as a script to create your products in your live stripe account. You can only run this script in dev mode, so you’ll have to add your live stripe keys to dev app secrets to do this. By doing this, you won’t have to add the products manually one by one via your stripe dashboard. As soon as you products are live, you know that your live production keys work.
2. In order to perform the above task in dev environment, you’ll have to add logic so that your app prefers your live stripe keys and only fallback to replit’s stripe integration keys (sandbox) if the live keys are missing. By doing this you can add live stripe keys to your dev secrets and seed your products (just don’t run real transactions in dev environment). Remove the live keys when you’re done (it’ll fallback to your sandbox). Doing this solved the “missing production keys” for me once i published the app.
3. For dev mode, you’ll want to turn off stripe syncing on server start up which the Replit Stripe integration adds. This provides you the flexibility to add live stripe keys to dev environment to seed products without worrying about corrupting live stripe data. You only want to sync with strip on start ups for your production environment.
3. You’ll probably need to add webhooks. If your subscription system is similar to mine where you only want to credit users after the payment was successful, then you’ll need to use webhooks.
Hope this helps. I’ve been building using Replit for over a year and it’s gotten a lot easier to use since then.
3 Likes
Great. I never used the Replit integration either. Glad you got it working. /Jayne
Thanks for the breakdown of how you got it to work. My Stripe Sandbox integration works, so I ended up just testing in Sandbox and copying my products from Sandbox to Prod in the Stripe dashboard (I’ll have to remember to do that if/when I change product line up.
Yup, Agent set up webhooks for me by default and I confirmed that user subscriptions aren’t setup on my side until after its confirmed that a payment was successful.
1 Like
For the record, I decided to remove my Replit Stripe integration for dev and just go with a direct API integration so that my Dev and Prod environments are more consistent. Also wanted to make my app more platform neutral and not rely on any Replit components. The Stripe Agent help bot was useful to get this working. Agent also help me set up a bunch of Stripe checkout coupon codes in one shot.
I implemented stripe on my production site and you 100% do need webhooks, agent will guide you through it but you will need to do that on stripe side, its important to be hands on for this because it can cause problems if its not setup, I had my first one fire off 4 of the same transactions repeatedly because it did not get any error responses back from the server, this also lets you setup the more complex security functions that stripe offers with their api. I have to be able to do temporary holds, adjustments, and partial refunds for things as well as adjustments to the total after the initial hold. I would just do the direct api its not hard just get the keys from stripe, add them to your environment and have agent make a webhook point and add it to the stripe webhooks (just search it in your store settings) and copy that url, publish the site to your production url, then test. I wouldn’t try to shorcut the money part of these apps.
1 Like
Yup, my prod had always been integrated directly into Stripe because I couldn’t get the Stripe integration to work. I just decided to cut the cord and make my dev environment also a direct connection as you described. All webhooks are working as well, although I’ve not Implement endpoints for many of the Stripe webhook topics you mentioned. Just doing the basics to start.