#Lenin

1 messages · Page 1 of 1 (latest)

thorny lagoonBOT
slender whale
#

Hi! Let me help you with this.

#

Could you please summarise the issue?

chilly shoal
#

On trying to do get session with some expanded parameters, I am not getting the expanded response. I am getting just the original response.

function get_stripe_checkout_session($stripe_checkout_session_id){
\Stripe\Stripe::setApiKey('sk_test_123');
return \Stripe\Checkout\Session::retrieve(
'cs_test_b1wGlNXhYAc4UzLxZQa0dsQNVR2tPa3vYkSNZYoRHFFB9m0A7DHJb613Vu',//dummy hardcoding to test
['expand' => ['shipping_options.shipping_rate']]
);
}

#

When I tried to do the same via curl, it worked

slender whale
#

What stripe-php version are you using?

chilly shoal
#

I checked my sstripe's logs. For the request with curl, the query parameters for expanding are getting logged. For request with php sdk, the query parameters are coming as empty.
So my guess is something is wrong with the php sdk

#

i took the pull yesterday from github

slender whale
chilly shoal
#

req_GXASlH3oLBnTDT

#

And this is the same requsest but with curl: req_KwVOLBSLN33BSf

slender whale
chilly shoal
#

I have tried with that also

#

it does not work

#

req_LD39jkDkhtK1z5 - This is the reqeust i tried just now

#

with latest php client

#
  return \Stripe\Checkout\Session::retrieve(
    // $stripe_checkout_session_id, //uncomment to process real evemnts
    'cs_test_b1wGlNXhYAc4UzLxZQa0dsQNVR2tPa3vYkSNZYoRHFFB9m0A7DHJb613Vu',//dummy hardcoding to test
    ['expand' => ['line_items','shipping_options.shipping_rate']]
  ); ```
slender whale
#

I see the version is 10.10.0, could you please try updating to 10.15.0

chilly shoal
#

THe latest one i posted is with 10.15.0

#

this one - req_LD39jkDkhtK1z5

lilac cairn
#

Your syntax is legacy so slightly wrong. This should work:

\Stripe\Checkout\Session::retrieve([
  'id' => 'cs_xxx',
  'expand' => ['...']
])
chilly shoal
#

I see, give me a few min pls to try this and get back

#

Yep it's working!! Thank you. I probably saw this approach on some old blog, and given it works for create checkout session correctly, I assumed it would work for get checkout also.

#

I believe if the Stripe SDK logs some warning message if this legacy approach is used, it would be quite useful for devlopers.

lilac cairn
#

To be clear, the 'legacy' syntax is still fine (and works). It's just not referenced in our public documentation so the subtle details (like this) often trip people up

#

I'd recommend refactoring your integration to use the new syntax, if you can

chilly shoal
#

yes for sure, I will use the new syntax.