#PiffleAndWhimsy
1 messages · Page 1 of 1 (latest)
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
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?
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.
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?
Yes
And you want to retrieve that Checkout Session that includes the line items?
Yes, that's right
You don't happen to have the pi_xxx do you? Will make it more straight forward for you
pi_1HX7MaG3n1yBHxnRAtUXoESM
Are you using one of our client libs?
I am building this in a PHP script
So you're using stripe-php?
anyway, you can 'list' all Checkout Sessions and pass the payment_intent parameter: https://stripe.com/docs/api/checkout/sessions/list
Will return the unique Checkout Session associated to that Payment Intent. In that same call, you'll need to 'expand' the line_items field
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ah ok, I think I understand. Thank you so much.
Sure
Sorry, how to I 'expand' the line items field?
Can you share your code?
It's just an additional parameter: https://stripe.com/docs/api/expanding_objects
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
$checkout_session = $stripe->checkout->sessions->all(['limit' => 1, 'payment_intent' => $this_payment_intent, 'expand' => 'line_items']);
That's what I had tried but it results in a 500 Server Error
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
I'm sorry, I don't know where to find req_xxx
It'd be in the error message that you're not catching, hang on
Ah ok
I've wrapped the request in a try-catch statement
and now I get Message: Invalid array as an output
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.
Np!