Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Managing STRIPE_PRICE_IDs for all subscription tiers for dev and prod" #5

Open
laduke opened this issue Jan 12, 2025 · 5 comments
Open

Comments

@laduke
Copy link

laduke commented Jan 12, 2025

Thanks for making this doc. It makes me feel a little better about my own agonies.

The STRIPE_PRICE_ID env var thing has been a pain. I recently put some metadata on the products (or was it prices? probably both). { sync_this_product: 1 }or { product_type: basic|premium } or something. Then sync products/prices from stripe to db on boot or something and as needed. And load the prices into the app from there instead of by the ID env var.
Then the app doesn't have any PRICE_ID type env vars. You sync with a prod token, you get prod prices. With dev token get dev prices. hth

@laduke laduke changed the title Managing STRIPE_PRICE_IDs for all subscription tiers for dev and prod "Managing STRIPE_PRICE_IDs for all subscription tiers for dev and prod" Jan 12, 2025
@t3dotgg
Copy link
Owner

t3dotgg commented Jan 16, 2025

I have to keep thinking about this. I think you're onto something here

@liaddrori1
Copy link

liaddrori1 commented Jan 19, 2025

Why not using lookup keys on the price?
You can even set up the same lookup key in test and prod so you only need to manage it once.
if you update the price, you keep the same price lookup key

Am I missing something?

@alessandrojcm
Copy link

Why not using lookup keys on the price? You can even set up the same lookup key in test and prod so you only need to manage it once. if you update the price, you keep the same price lookup key

Am I missing something?

Yes, this is what I am doing, better than having to take note of the price ID imo.

@neeeeecka
Copy link

neeeeecka commented Jan 30, 2025

I am not managing PRICE_IDs at all. I am syncing products(plans in my case) to stripe on boot + every 15 minutes.
Price IDs are created during plan creation sync, when plans are created. Stripe product IDs match my plan IDs, I retrieve PRICE_IDs from the products during checkout by looking up prices[0] of the given product from stripe prices.list api.

When plans are updated(For example, Price is updated in CMS), I'm creating a new price in stripe for that particular product. If a plan is deleted(from CMS), stripe product is just deactivated. That works for me, so far at least.

@andyzeli
Copy link

managing price Ids as env variable obviously isn't a thing in marketplaces where users create/list their prices. has to be dynamic look up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants