#dbugger_price-currency
1 messages ยท Page 1 of 1 (latest)
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.
- dbugger_product-lookupkey, 23 minutes ago, 17 messages
๐ 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.
@copper robin do you have a bit more context? Like why do you expect other currencies? Do you have multiple Prices, one per currency, or are you using multi-currency Prices as documented in https://docs.stripe.com/payments/checkout/adaptive-pricing?platform=multi-currency-prices
dbugger_price-currency
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
Okay so you do use multi-currency Prices? In that case it's expected behaviour. You need to use our Expand feature to retrieve the extra currencies.
Pause for a bit, read carefully https://stripe.com/docs/expand and then watch https://www.youtube.com/watch?v=m8Vj_CEWyQc to understand the feature.
Then you will be able to call the List Prices API https://docs.stripe.com/api/prices/list and expand the other currencies in currency_options
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?
I think it includes the USD Prices in currency_options too but it still renders the default currency you picked.
It is weird, because even though expand: ["data.currency_options"], works, when I execute .list without it, there is no currency_options attribute
currency_options is not returned unless you expand it
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?
Hello! I'm taking over and catching up...
Hi!
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.
What do you mean with top-level currency? You mean the first, of the list?
Prices have a top-level currency property: https://docs.stripe.com/api/prices/object#price_object-currency
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
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?
Sure
Note that, while this is a public server, Product and Price IDs are safe to share here.
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
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?
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 ๐
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.
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 ๐ )
Happy to help! Will flag a feature request internally about the wonkiness here.