#itsqwerty
1 messages · Page 1 of 1 (latest)
Can you clarify the ask? Not sure I understand in the context of your previous thread
oops! I meant to link to this one; https://discord.com/channels/841573134531821608/1141265201178611723
So for subscriptions, if it is reccomedned to create 1 product and give it multiple differnt prices for e.g
I have 3 plans (Starter, Advance, Elite)
and each plan has 2 pricing options (monthly & yearly). If I am storing a product in my database with what is included in each plan so the BE can deliver those services depending on the plan the customer has. and the front end wants to request an Elite plan that is yearly, I need to fetch the yearly priceId from stripe npm in order to create the susbcription?
Yes, you need to provide the price_xxx when creating the Subscription. Whether you retrieve that fro our API, or persist that in state or a database is an implementation detail
If you're storing product data in your database, then maybe there's a field that maps to the corresponding price_xxx IDs in Stripe
sorry didnt understand this bit
You just said:
If I am storing a product in my database with what is included in each plan so the BE can deliver those services depending on the plan the customer has
So maybe in your database you also store the related Stripeprice_xxxIDs that belong to that product and then you can retrieve them from your DB when you create the Subscription
It's an implementation detail. The API requires the price_xxx ID so you need to retrieve it from somewhere
so would you reccomend something like this?
stripeProductId: '',
stripePriceIds: [{ type: 'YEARLY', id: 123 }, { type: 'MONTHLY', id: 456'}]```
Seems reasonable yep
Sweet, thank you. Is priceId something I can pass to the FE freely, or is it recommend the FE passes something like { plan: 'ELITE', isAnnual: true}
Yep, you can use price_xxx IDs on the front-end
Alternatively you could you a lookup_key, but then there's more overhead
sweet thank you, legend