#Zesh - expansion

1 messages ยท Page 1 of 1 (latest)

karmic cobalt
#

Hello

#

Looking now

#

Gotcha. Can you send me the request ID for where you're seeing this?

hard bay
#

req_dHIGEqichYnS9u

karmic cobalt
#

It shows you aren't expanding anything for that request ID. Can you add some print statements to verify the piece of code that's retrieving the invoice is the one above?

#

Also what version of the php library are you using?

hard bay
#

This is the output of my tinker session, and the stripe-php version is 7.112.0

#

Let me know when you've seen/have the text file so I can remove

karmic cobalt
#

None of that is sensitive data so you should be good

#

I'm not familiar with Tinker

#

What is that

hard bay
#

Allows for execution of PHP code for testing purposes in a CLI

#

Similar to pry or irb

karmic cobalt
#

Got it

#

Hm ok. Can you try upgrading to the 7.116.0 version of the library and try?

#

Also what version of PHP are you using?

hard bay
#

PHP version is 7.4.x

#

As for the stripe-php version, that may be possible

#

We have other packages that depend on the version we're using, but may still be in range

karmic cobalt
#

I see

#

Let me know if it works

#

If not, I will escalate this/ask around internally as this doesn't look normal

#

That Tinker session was one you just now tried, correct?

hard bay
#

Uh, about 25 minutes ago yes.

karmic cobalt
#

And just echo the object

hard bay
#

Same result after updating the stripe-php version for request req_1paVjdqH3S4Jn7

cerulean plume
#

๐Ÿ‘‹ I can help

#

you're using the legacy PHP way

#
// Note the first parameter is now an array with id as a key to pass the resource id which was hard to figure out
$checkoutSession = \Stripe\Checkout\Session::retrieve([
  'id' => 'cs_test_123',
  'expand' => ['line_items'],
]);```
#

see how you pass the id as a parameter inside the first array, that's how it used to work

#

So you want $invoice = Invoice::retrieve([ 'id' => 'in_1KXAcgBWZi55jr0HBDS8wdHm', 'expand' => ['charge', 'customer'], ]);

hard bay
#

So, Invoice@retrieve signature has changed to Invoice::retrieve(array $opts)?

#

I'm using Invoice::retrieve($id, $opts)

cerulean plume
#

no it hasn't

#

opts is separate from parameters

#

it's where you pass an API key or idempotency key

hard bay
#

Ah...

cerulean plume
#

it's confusing

#

that's why when we built the new way with client/service we clearly made it $stripe->invoices->retrieve($id, $params, $opts);

hard bay
#

Thank you so much ๐Ÿ˜„

#

I can confirm this works

cerulean plume
#

yay!

#

and sorry it's so confusing, it's an obscure edge-case, it's rare to expand on retrieve but over time we added more "includable" things and if you use the old way it's a bit hard to discover

#

try moving to the client/service infra, it's way easier/cleaner ๐Ÿ™‚

hard bay
#

I'm trying to avoid doubling the number of API calls I wanted to make, so was important to me that this worked

#

Ya, we're stuck in the way we use it at the moment because of deps/reasons, it's our goal to move to latest libraries, just not quite there yet. Thanks so much! Hope ya'll have a great weekend ๐Ÿ™‚