#yonatan_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/1227907960525557761
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
where can I find it?
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
req_YdzPRbu1xEW2Ul
taking a look
from what I see you're trying to only update one of the 2 subscription items
so basically you will end up with one monthly price and one yearly price on the same subscription which is not supported
oh got you, that makes sense, thanks!
sure
if you want to delete the other one you can use https://docs.stripe.com/billing/subscriptions/upgrade-downgrade#changing:~:text=Alternatively%2C you can delete the current subscription item and create a new subscription item with the updated price.
Thanks, can I pass multiple delete items to the update request?
yes it's per subscription item
so basically if you no longer need the second subscription item, you pass its ID and deleted: true
and this could be added to your existing code
where you update the first subscription item ID's price
just to make sure, I can do something like
items: [
{
id: oldItem1,
deleted: true,
},
{
id: oldItem2,
deleted: true,
},
{
price: newPriceId,
}
]
yes that also can be one way of doing it
you could also do
items: [
{
id: oldItem1,
price: newPriceId,
#if metered price add
#clear_usage: true,
},
{
id: oldItem2,
deleted: true,
},
]
how can I now if an item is a metered price?
found this item.plan.usage_type === 'metered'
do you update the usage records?
I want to check if a deleted item is metered, and if so add clear_usage: true
you can check https://docs.stripe.com/api/subscription_items/object#subscription_item_object-price-recurring-aggregate_usage if it's null then it's not metered
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
thanks
what does this mean?
plans is the predecessor of Prices
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
actually you can look at the price's usage_type https://docs.stripe.com/api/prices/object#price_object-recurring-usage_type
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.