#yonatan_code

1 messages ยท Page 1 of 1 (latest)

kindred ventureBOT
#

๐Ÿ‘‹ 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.

placid ibexBOT
flint flower
#

๐Ÿ‘‹ happy to help

#

would you mind sharing the request ID?

tawny lion
#

where can I find it?

flint flower
tawny lion
#

req_YdzPRbu1xEW2Ul

flint flower
#

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

tawny lion
#

oh got you, that makes sense, thanks!

flint flower
#

sure

tawny lion
#

Thanks, can I pass multiple delete items to the update request?

flint flower
#

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

tawny lion
#

just to make sure, I can do something like

 items: [
      {
        id: oldItem1,
        deleted: true,
      },
      {
        id: oldItem2,
        deleted: true,
      },
      {
        price: newPriceId,
      }
]
flint flower
#

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,
      },
]
tawny lion
#

how can I now if an item is a metered price?

#

found this item.plan.usage_type === 'metered'

flint flower
#

do you update the usage records?

tawny lion
#

I want to check if a deleted item is metered, and if so add clear_usage: true

flint flower
tawny lion
#

thanks

tawny lion
flint flower
#

plans is the predecessor of Prices

tawny lion
#

got you, thanks

#

all works ๐Ÿ™‚