#Cédric Morelle

1 messages · Page 1 of 1 (latest)

swift karmaBOT
pastel vapor
#

Good question, checking in to this and will get back to you.

robust nexus
#

according to doc it should not retrieve a specific currency unless you specify it ?

pastel vapor
#

Yeah it does sound like that. To be clear are you getting no prices when you make that request without a currency?

robust nexus
#

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

pastel vapor
#

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

robust nexus
#

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 > ```
swift karmaBOT
robust nexus
#

so I can't retrieve at all a list of price with specific currency

#
 => "8.3.0" ```
#

any help ?

pastel vapor
#

Can you send the full response that you get when you make that call?

#

Unsure of what this may be, still looking

robust nexus
#

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 > ```
lime radish
#

👋 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

robust nexus
#

gbp it has to be low case according to your doc

lime radish
#

Right but what is unexpected about the above list?

#

There is a GBP Price and you are listing by gbp

robust nexus
lime radish
#

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)

#

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

robust nexus
#

sorry I don't get it. How should I list al GPB price ?

#
        currency: "gbp",
        limit: 100,
      })```

what's wrong with this syntax ?
lime radish
#

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

swift karmaBOT
robust nexus
#

So how should i bring back prices set with various currency ?

lime radish
#

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

robust nexus
#
        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 ?

lime radish
#

Sorry server is busy and I'm helping multiple folks at once.

#

What version of the Python SDK are you using?

robust nexus
#

it's Rails

#

Ruby

#

not Python

lime radish
#

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']})```
robust nexus
#
        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.)```
lime radish
#

Ugh yeah this is a List request

#

data.currency_options

robust nexus
#

seems we have got a winner here

#

not easy to deal with, and let me tell you, totally undocumented, but it will do the job !