#itsqwerty
1 messages ยท Page 1 of 1 (latest)
Have you tried Retrive Plan API? https://stripe.com/docs/api/plans/retrieve Btw Plan is an legacy API and you shouldn't use it nowsaday
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
so I just directly be using the priceId or what is the alternaative?
Price API is a complete replacement for Plan API. Any reason you are uing Plan API?
Okie then here is how to list all Price with a Product Id: https://stripe.com/docs/api/prices/list#list_prices-product
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
is there any benefit to aving 1 product and multiple differnt prices under it (like monthly, yearly) then just creating 2 differnt products for each plan (one yearly and one monthly)
It's totally up to you to organize your product data
ie. you can have one Tshirt product, and multiple prices for different color vairants
but there is no benfit to doing it? lets I had 3 subscriptions to offer. and each one of them an monthly or a yearly plan. Is there benefit I will receive from making 1 product for each plan and giving them 2 differnt prices because otherwise I assume it will just be better if i store the productid seperatly and and 6 differnt products instead of prices so I do not need to make addational requests to stripe to grab the priceIds based on the product?
It's only about how to represent your Product data. Up to you if you want separated Product for each Price. Not sure why you need to send the request to grab to Price Id from the Product tho
maybe im being a bit dumb with this but I was going to store what users receive per month based on the product they are subscribed to
and I was going to have a plans table
that stores the productId and then when the FE sends hey I want this product and i want it to be yearly
I thought I would need to grab the productId from the db, make a request to stripe to get the yearly priceId so I can create a subscription for ithat
on the plan I was also going to have the planName, so the FE would pass something like
{ plan: 'ELITE', isAnnual: true }
along with the customers email, etc, etc
qq how about just storing stripePriceId on the Plan table instead?
so something like priceIds: [{type: 'yearly', id: '123',}, { type: 'monthly', id: '456'}]
Sorry if I misunderstood but why a hash? PriceId should be a string in the form or price_xxx.
Hey, taking over here. Let me know if there's any follow-up Qs I can answer!
maybe I misunderstood but each product has 2 priceIds and I need to know which one is the yearly one and which one is the monthly one so the hash stores the type: yearly/monthly and then the priceId from stripe as id
๐
You can derive that from the Price object itself, using the recurring hash: https://stripe.com/docs/api/prices/object#price_object-recurring-interval
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
yeah but that will just require an addtional api request everytime thats why I asked the original questions, would it just be better having 6 differnt products (2 for each plan (yearly and monthly) instead of 3 that contain two prices