#PiffleAndWhimsy

1 messages · Page 1 of 1 (latest)

final echo
#

Hey. What's an 'order' in this context?

short galleon
#

Sorry, this would be a transaction which was put through Stripe. So a purchase from our website shop in this instance. I'm not sure whether that would be regarded as a paymentintent or a charge object or similar

final echo
#

Well there's no line items on a Payment Intent/Charge. Are you using Checkout?

#

Can you share the ID of the Payment Intent you're trying to lookup?

short galleon
#

Certainly. Yes, we are using Checkout. The id is pi_1HX7MaG3n1yBHxnRAtUXoESM

#

When I view that on the Stripe Dashboard I can see that there are two 'Items' on the Checkout Summary.

final echo
#

Great, yep. That's the only way to have line items with a one-time payment currently

#

So you have a ch_xxx ID?

#

Specifically ch_1HX7NbG3n1yBHxnRK2hTCm2S?

short galleon
#

Yes

final echo
#

And you want to retrieve that Checkout Session that includes the line items?

short galleon
#

Yes, that's right

final echo
#

You don't happen to have the pi_xxx do you? Will make it more straight forward for you

short galleon
#

pi_1HX7MaG3n1yBHxnRAtUXoESM

final echo
#

Are you using one of our client libs?

short galleon
#

I am building this in a PHP script

final echo
#

So you're using stripe-php?

short galleon
#

Ah ok, I think I understand. Thank you so much.

final echo
#

Sure

short galleon
#

Sorry, how to I 'expand' the line items field?

final echo
#

Can you share your code?

short galleon
#

I see, thank you. I'll just try that.

#

I seem to be having trouble working out how to pass this expand parameter

#

$checkout_session = $stripe->checkout->sessions->all(['limit' => 1, 'payment_intent' => $this_payment_intent]);

#

This is the request I have at the moment

final echo
#
$checkout_session = $stripe->checkout->sessions->all(['limit' => 1, 'payment_intent' => $this_payment_intent, 'expand' => 'line_items']);
short galleon
#

That's what I had tried but it results in a 500 Server Error

final echo
#

Can you share the req_xxx ID?

#

There'll be an actual error message thrown, guess you're not catching it

#

Might be data.line_items

short galleon
#

I'm sorry, I don't know where to find req_xxx

final echo
#

It'd be in the error message that you're not catching, hang on

short galleon
#

Ah ok

#

I've wrapped the request in a try-catch statement

#

and now I get Message: Invalid array as an output

final echo
#

Yeah expand expects an array. My bad

#

'expand' => ['data.line_items']

short galleon
#

Aha! Perfect, that's sorted that.

#

Ok I think that's got me back on track for now. Thank you so much for your patience.

final echo
#

Np!