#Cédric Morelle
1 messages · Page 1 of 1 (latest)
Good question, checking in to this and will get back to you.
according to doc it should not retrieve a specific currency unless you specify it ?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yeah it does sound like that. To be clear are you getting no prices when you make that request without a currency?
I'm getting prices, but for the first currency being used (EUR in my case)
I guess right behavior should be to return ALL prices whatever currency are unless you request a specific currency
Gotcha, thanks for the clarification. I am still bouncing between a couple other threads so I will ask my colleagues on this and get back to you
Hello, what version of the stripe-php library are you using? We haven't been able to recreate this behavior on our side. The API is returning all of the prices when we test
So I have a issue a real bug
currency: "GBP",
limit: 100,
}).pluck(:currency)```
returns
currency: "gbp",
limit: 100,
}).pluck(:currency)
INFO Request to Stripe API method=get num_retries=0 path=/v1/prices
INFO Response from Stripe API api_version=2022-11-15 elapsed=0.3853209998924285 method=get path=/v1/prices request_id=req_6e0chRtCgQ3vhS status=200
=> ["eur", "eur", "eur"]
2.6.6 :469 > ```
so I can't retrieve at all a list of price with specific currency
=> "8.3.0" ```
any help ?
Can you send the full response that you get when you make that call?
Unsure of what this may be, still looking
what do you mean full response ?
currency: "gbp",
limit: 100,
})
INFO Request to Stripe API method=get num_retries=0 path=/v1/prices
INFO Response from Stripe API api_version=2022-11-15 elapsed=0.2638250000309199 method=get path=/v1/prices request_id=req_9zFxGWEk4kiVTS status=200
=> #<Stripe::ListObject:0x3fe6e78076dc> JSON: {
"object": "list",
"data": [
{"id":"price_1NBIP5AslfugMFd9uRrJkSIJ","object":"price","active":true,"billing_scheme":"per_unit","created":1684937463,"currency":"eur","custom_unit_amount":null,"livemode":false,"lookup_key":null,"metadata":{},"nickname":null,"product":"prod_NvLpDxrRkAclwI","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":1899,"unit_amount_decimal":"1899"},
{"id":"price_1N9XKwAslfugMFd99XJjVxvr","object":"price","active":true,"billing_scheme":"per_unit","created":1684518210,"currency":"eur","custom_unit_amount":null,"livemode":false,"lookup_key":null,"metadata":{},"nickname":null,"product":"prod_NvO7ffiH9BxKgj","recurring":null,"tax_behavior":"unspecified","tiers_mode":null,"transform_quantity":null,"type":"one_time","unit_amount":2999,"unit_amount_decimal":"2999"},
{"id":"price_1N9V7nAslfugMFd9MoaJdpvg","object":"price","active":false,"billing_scheme":"per_unit","created":1684509707,"currency":"eur","custom_unit_amount":null,"livemode":false,"lookup_key":null,"metadata":{},"nickname":null,"product":"prod_NvLpDxrRkAclwI","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":1899,"unit_amount_decimal":"1899"}
],
"has_more": false,
"url": "/v1/prices"
}
2.6.6 :488 > ```
👋 stepping in
Give me a moment to catch up
Okay so to clarify, the above request is listing by GBP currency
Each of those Prices does have a GBP currency set as a currency_option
gbp it has to be low case according to your doc
yes
https://dashboard.stripe.com/test/prices/price_1NBIP5AslfugMFd9uRrJkSIJ if you want to control
Right but what is unexpected about the above list?
There is a GBP Price and you are listing by gbp
It doesn't return any price in the awaited currency. I request for gpb it return eur
When you list Prices it is going to return all Prices that involve that currency as its default currency (what is set at the top level for currency: https://stripe.com/docs/api/prices/object#price_object-currency) and any currencies set for currency_options (https://stripe.com/docs/api/prices/object#price_object-currency_options)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If you want to see currency_options in the response, you have to expand it
Otherwise it won't be returned
So all of those Prices do involve a GBP Price as well, you just aren't seeing them in your list response because you aren't expanding currency_options
sorry I don't get it. How should I list al GPB price ?
currency: "gbp",
limit: 100,
})```
what's wrong with this syntax ?
Nothing is wrong per say. It sounds like you just don't care about your multi-currency Prices that have GBP set as a currency_option
So how should i bring back prices set with various currency ?
If you instead do Stripe::Price.list({ currency: "gbp", limit: 100, }, { expand: ['currency_options']})
Then you would see that each of those Prices does have a GBP Price involved as well
So if you don't care about that, then you need to filter those out
currency: "gbp",
limit: 100,
}, {
expand: ['currency_options']})
INFO Request to Stripe API method=get num_retries=0 path=/v1/prices
ERRO Request error elapsed=0.7429610001854599 error_message="undefined method `strip' for [\"currency_options\"]:Array" method=get path=/v1/prices
Traceback (most recent call last):
2: from (irb):504
1: from (irb):504:in `rescue in irb_binding'
NoMethodError (undefined method `strip' for ["currency_options"]:Array)```
this option currency_options does not exists for listing all prices
So ?
Sorry server is busy and I'm helping multiple folks at once.
What version of the Python SDK are you using?
Yeah sorry mistyped
Ah you provided above, sorry.
Let me see when we added to Ruby SDK
Ah I think I just had bad syntax
currency: "gbp",
limit: 100,
expand: ['currency_options']})```
currency: "gbp",
limit: 100,
expand: ['currency_options']})
INFO Request to Stripe API method=get num_retries=0 path=/v1/prices
ERRO Stripe API error status=400 error_message="This property cannot be expanded (currency_options). You may want to try expanding 'data.currency_options' instead." error_type=invalid_request_error request_id=req_EDCZxsz8sFngmF
INFO Response from Stripe API api_version=2022-11-15 elapsed=0.4124690000899136 method=get path=/v1/prices request_id=req_EDCZxsz8sFngmF status=400
Traceback (most recent call last):
2: from (irb):533
1: from (irb):533:in `rescue in irb_binding'
Stripe::InvalidRequestError ((Status 400) (Request req_EDCZxsz8sFngmF) This property cannot be expanded (currency_options). You may want to try expanding 'data.currency_options' instead.)```