#dbugger_price-currency

1 messages ยท Page 1 of 1 (latest)

jovial moatBOT
green spadeBOT
#

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

jovial moatBOT
#

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

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

fluid rampart
#

dbugger_price-currency

copper robin
#

I have a product "Premium account" with 2 prices. One is monthly, and one is yearly. Each price is set up in both EUR and USD

#

I do not have a different Price object for different currencies

fluid rampart
copper robin
#

reading

#

Indeed, that worked. But does this mean that if I use

stripe.prices.list({ product: "...", currency: "usd" })

It will only return to me the prices that have only USD, and none of the multicurrency price?

fluid rampart
#

I think it includes the USD Prices in currency_options too but it still renders the default currency you picked.

jovial moatBOT
copper robin
#

It is weird, because even though expand: ["data.currency_options"], works, when I execute .list without it, there is no currency_options attribute

fluid rampart
#

currency_options is not returned unless you expand it

copper robin
#

So, if I understand correctly, this,,,

stripe.prices.list({product, currency: "usd" });

...will return me all the prices that have a USD configuration, but the object itself might not display that USD configuration, unless it is expanded.

Did I understand correctly?

buoyant adder
#

Hello! I'm taking over and catching up...

copper robin
#

Hi!

buoyant adder
#

That will list all Prices which have the top-level currency property set to usd. If you want to see currency_options in the results you do need to expand it, yes.

copper robin
#

What do you mean with top-level currency? You mean the first, of the list?

buoyant adder
copper robin
#

But then, that is not what is happening to me.

You say that this...

stripe.prices.list({product, currency: "usd" });

will return me all the prices that have a top-level currency property set up as usd. But this is the return object. It's top-level currency is set up as eur

buoyant adder
#

Going back to your original question, can you give me the IDs of the Prices you expected to see in the results of the request you mentioned?

copper robin
#

Sure

buoyant adder
#

Note that, while this is a public server, Product and Price IDs are safe to share here.

copper robin
#

It's test data, so it doesnt matter

price_1PLT6MJkBBvB6zNBHSAxSLzb
price_1PLT76JkBBvB6zNBQj9wKeKz

#

Those 2 prices are set in USD and EUR

#

So when I query the list, they appear. But the top-level currency property is still "eur", which is weird.

#

It is as if it is showing me just the first one of the list, not caring if it is the currency that was used to filter them

buoyant adder
#

Oh, I understand the confusion. You're looking at only the top-level currency property, but for multi-currency Prices like these you need to look at currency_options to see all the detail. If you expand data.currency_options do you see the information you expect?

copper robin
#

Yeah, yeah, I understand that expanding currency_options gives me the data I need.

But I was asking because, if someone is not expanding, and filtering by currency, the assumption (I think) anyone would make is that the currency property will be the same that was used to filter.

#

Using the first one of the list seems quite random

#

As you can understand, if I filter by "usd" without expanding, and the top-level currency is "eur", that is quite a bizarre reply.

#

I thought it was a bug, but I guess it is by design... even though it feels weird af ๐Ÿ˜›

buoyant adder
#

Yeah, it's not intuitive for sure.

#

It's because the Prices API was originally designed with a 1:1 relationship between Prices and currencies, and multi-currency support was added later, resulting in the current state of things.

copper robin
#

ahhh, I see. Legacy issues.

#

As a fellow developer, I feel you

#

๐Ÿ˜„

#

Well, in any case, that explains it. Thanks a lot for the help

#

(and pitch in the idea if a v2 of the API gets planned ๐Ÿ˜‰ )

buoyant adder
#

Happy to help! Will flag a feature request internally about the wonkiness here.

copper robin
#

๐Ÿ‘

#

Thanks!