#eoghan-checkout-lineitems
1 messages · Page 1 of 1 (latest)
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
Is it possible to get that from a charge id?
No. But really you should never look at the Charge for this. Read https://stripe.com/docs/payments/checkout/fulfill-orders instead
all i want is the name of the thing(s) they ordered
sure, and that's what I explained
Let me know if this doesn't make sense, I'm happy to explain further
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.
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)
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
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
ch_3MWH1sE3c9sWyeru0GROnDgv
what happens when you call https://stripe.com/docs/api/charges/retrieve and pass that Charge id?
I only have test key access set up locally at the moment, waiting on the live key to test
gotcha. I'm fairly certain the Charge is in the API and would be in https://stripe.com/docs/api/charges/list too so I don't really get what you're saying about the API not returning it
Agree. Most likely a bad report from customer support on our side. Grr. Sorry my bad.
all good 🙂