#eoghan-checkout-lineitems

1 messages · Page 1 of 1 (latest)

grizzled gustBOT
tulip jacinth
#

eoghan-checkout-lineitems

#

The Checkout Session object has a line_items property that tells you what was sold in that specific Session. It's what we call includable so it's not returned/surfaced by default and you have to explicitly ask the API for it which is documented here: https://stripe.com/docs/expand#includable-properties

kind quartz
#

Is it possible to get that from a charge id?

tulip jacinth
kind quartz
#

all i want is the name of the thing(s) they ordered

tulip jacinth
#

sure, and that's what I explained

kind quartz
#

gotcha

#

thanks

tulip jacinth
#

Let me know if this doesn't make sense, I'm happy to explain further

kind quartz
#

For context, I'm trying to create a really simple list of "receipts" but I have subscriptions and one-time payments mixed together, some charges don't have a description (I don't know why) and some have associated payment intents which have usable descriptions, others have a invoice.subscription.plan.product where I can get the name.We have data going back 7 or 8 years using 3 different APIs so it's a bit of a mess.

tulip jacinth
#

Ah yeah if it's about historical data it's a lot harder. In that case, here's what I'd do. Look at the Charge and see if it has:
1/ invoice: 'in_123' set => if so, extract line items from the Invoice
2/ if not, check if it has payment_intent: 'pi_123' and then use the https://stripe.com/docs/api/checkout/sessions/list API to see if it's associated with a Checkout Session
3/ if not, then you can only rely on description (or maybe metadata if you added any details)

kind quartz
#

That's super helpful, thank you!!

#

I've also noticed that some charges are not coming back in the API results but are available in the Dashboard UI under Payments. All charges have the same email address and we're first looking up the customer by email in order to get the customer id and then getting the charges by customer. I verified that the charges belong to the customer id via the UI but unsure as to why they're not shown in the API results

tulip jacinth
#

I've also noticed that some charges are not coming back in the API results but are available in the Dashboard UI under Payments
I don't know what that could mean sorry. If you can provide detailed information: what you see, where, exact UI/URL you're on and the exact Charge id though I can look

kind quartz
#

ch_3MWH1sE3c9sWyeru0GROnDgv

tulip jacinth
kind quartz
#

I only have test key access set up locally at the moment, waiting on the live key to test

tulip jacinth
kind quartz
#

Agree. Most likely a bad report from customer support on our side. Grr. Sorry my bad.

tulip jacinth
#

all good 🙂