#ali-raza_code
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1319247878887051316
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Do I need to update the price or create new price when from front-end Community creator updates the price?
Also, what happens in this case.
- One product created on stripe has 20 subscriptions.
- Community creator updates the price from 10$/month to 15$/month.
- Now, the old users and new users. What will be the price for them? 10$/month or 15$/month?
You set the default price at the Product level: https://docs.stripe.com/api/products/update#update_product-default_price
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Moot point as you can't update the unit amount on existing Price objects, you'd need to create a new Price object with the new amount and migrate the subscriptions to it
Note that you can not change a price’s amount in the API. Instead, we recommend creating a new price for the new amount, switch to the new price’s ID, then update the old price to be inactive.
https://docs.stripe.com/products-prices/manage-prices#edit-price
Oh.
So I have to update the product as well.
And what about this?
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
Community creator updates the price from 10$/month to 15$/month.
For that you need to create a new Price and update the Subscription Item. So all units in the Subscription will be on $15 Price
Which subscription needs to be updated?
all members subscription?
or the specific product subscription?
all members subscription?
or the specific product subscription?
Could you please clarify what this means in Stripe API terms?
Basically.
There is a community. This has a price which members pay to subscribe to the community
community creator
community members
Each member is a Stripe Customer? And each of them have their own Subscription object?
And what is "all members subscription"?
community is a product that is created on stripe and each community member then subscribes to that product Created on Stripe
I am not sure I understand. Is this the answer to my last question?
Okay, we clarified this:
Each member is a Stripe Customer? And each of them have their own Subscription object?
Is there any other Subscriptions?
It is very simple.
Let me explain again:
-
Platform name is Amigo
-
Each member registering to amigo is registered to stripe - Customer ID is attached with each
Amigouser -
Single user can create or join multiple communities.
-
When a user creates a community. I create a product on stripe for that community to which all
To be joined users aka memberswill subscribe. -
After product creation, I will get the product id from stripe which will be attached to the community.
-
Now, the member will join the community by subscribing to the product.
I just want to stress that normally Subscriptions are created using the Price ID, not the Product ID. Product ID just holds metadata like image, name, description. But the pricing is set by the Price object and you use that when creating Subscriptions.
Now, if you want your members to pay a new amount per month for a given community, you need to create a new Price for this Product, and update each member's Subscription with the new Price. You can then archive the old Price.
Yes, this is what I was asking.
I was curious if I update the price for the product would it directly effect the subscribed users or I have to manually update all subscriptions.
So, according to you I have to update all on-going Members subscriptions.
after creating new price for a product
update the price for the product
Product can have multiple prices, and the default one is just a Dashboard feature. You always have to specify the Price explicitly via API so which Price is the default is irrelevant.
Yes
Don't you think this is a bit complex. As I have to run a query, fetch all active users for that product, and then update the price for them
What would be a better way, without risking changing the amount for a large number of customers by accident?
Well, it is an automated job via code.
If I run a query with wrong data it will produce the same error.
Nevermind, thanks for the help @tacit lark 🙂
Happy to help.
One last question. If I create a new price, should I delete/archieve old price?
For the sake of keeping things tidy, you can, if you're not planning to use it again.
Ok, thanks.
await stripe.products.update(productId, {
default_price: monthlyPriceId?.id || null,
metadata: {
updated_at: new Date().toISOString(),
oldPrice: `The old price was ${community.monthly_subscription_price} and ${community.yearly_subscription_price}`,
oldPriceMonthlyId: community.stripe_monthly_price_id ?? null,
oldPriceYearlyId: community.stripe_yearly_price_id ?? null,
},
});
I don't find any key to update a price and make it archieve
can you tell me the key?
active: false will do the archieve part?
Yeah, right, that's the property