#Lenin
1 messages · Page 1 of 1 (latest)
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
What stripe-php version are you using?
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
Could you please share the Request ID req_xxx? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Can you try expanding line_items instead?
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']]
); ```
I see the version is 10.10.0, could you please try updating to 10.15.0
Your syntax is legacy so slightly wrong. This should work:
\Stripe\Checkout\Session::retrieve([
'id' => 'cs_xxx',
'expand' => ['...']
])
Describe the bug it seems expand is not working as mentionned in https://stripe.com/docs/expand The same result is retrieved with or whithout using it (Or I totally misunderstood what it is doing :...
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.
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
yes for sure, I will use the new syntax.