Open augustoccesar opened 1 year ago
hey @augustoccesar ! I just tried the same call and it seems to work fine as long as your Price has currency_options
set. Below is a simple example that you can reproduce as I use the default API key we show in our docs:
$ curl https://api.stripe.com/v1/prices/price_1NBJVh2eZvKYlo2C7xrErwwV?expand[]=currency_options -u sk_test_4eC39HqLyjWDarjtT1zdp7dc:
{
"id": "price_1NBJVh2eZvKYlo2C7xrErwwV",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1684941716,
"currency": "gbp",
"currency_options": {
"cad": {
"custom_unit_amount": null,
"tax_behavior": "unspecified",
"unit_amount": 1234,
"unit_amount_decimal": "1234"
},
"eur": {
"custom_unit_amount": null,
"tax_behavior": "unspecified",
"unit_amount": 1234,
"unit_amount_decimal": "1234"
},
"gbp": {
"custom_unit_amount": null,
"tax_behavior": "unspecified",
"unit_amount": 9900,
"unit_amount_decimal": "9900"
},
"usd": {
"custom_unit_amount": null,
"tax_behavior": "unspecified",
"unit_amount": 1234,
"unit_amount_decimal": "1234"
}
},
"custom_unit_amount": null,
"livemode": false,
"lookup_key": null,
"metadata": {},
"nickname": null,
"product": "prod_NxDx5FOQXTrO6c",
"recurring": {
"aggregate_usage": null,
"interval": "year",
"interval_count": 1,
"trial_period_days": null,
"usage_type": "licensed"
},
"tax_behavior": "unspecified",
"tiers_mode": null,
"transform_quantity": null,
"type": "recurring",
"unit_amount": 9900,
"unit_amount_decimal": "9900"
}
You can see that currency_options
is returned as expected right there with the right information for each optional currencies I've set.
Would you be able to confirm you see the same?
@remi-stripe Oh, I'm sorry I wasn't clearer, I mean using the stripe-mock server.
So I mean going to http://localhost:12111/v1/prices
Ah gotcha, I see what I missed. stripe-mock is here to mock our API roughly and return valid looking objects. Unfortunately, it isn't able to simulate everything our API does and so it's not aware of what currency_options
represents and how to handle it when it's asked. Returning an currency_options: null
makes sense overall when there's no such option on the Price which is what the fixture is about. You're going to hit similar issues with other includable properties in other parts of the API so I think in cases like this you'll want to add your own fixture locally instead.
I'll tag this as future
though to track it as a potential improvement.
I see! That makes sense. Good to keep in mind! Thanks for the response.
It seems that it is not possible to access the Price
currency_options
. Both of the following return an emptycurrency_options
map:GET /v1/prices/price_1234?expand[]=currency_options
POST /v1/prices?expand[]=currency_options
Withx-www-form-urlencoded
body: