#phonicuk - product info
1 messages ยท Page 1 of 1 (latest)
What do the line items look like when you look them up?
Can you paste a sample here?
sure, one moment while I run through it
Ah wait it's buried in the 'price' object to get the product ID - The C# API makes it hard to see - I can get the product ID there. But I feel like I'm missing something because I'm having to make a lot of API calls just to figure out what exactly was purchased and get the metadata
that's my bad though - sorry I'm very new to stripe and still getting my hands around everything is organised. The C# API has a lot of things that look like they should be populated like the line items or the product but they're all 'null' and you have to look them up separately
No worries at all. Are you using expansion at the moment? You may be able to consolodate a couple of these calls by getting them all when you request the Session or its line items 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.
yeah I just saw that, so I can include "price.product" in my call to SessionService.ListLineItems
ah there we go - yes so expansions are the way to go and get everything in a single call
Thanks for your time xD
Of course, always happy to help
ah wait here it is
so aye, would the payment intent ID be the thing most analogous to a transaction ID? Assuming that I only bother to record it when it's completed
trying to migrate over a system that was originally designed to speak paypal, still getting used to just how much information Stripe actually exposes in comparison
@mild harbor your thread is still over here
aah
So with regard to PI ID, there will also be a charge ID as a PI generates a charge when it is successful in capturing payment
Ah okay, so that's the "Money changed hands" ID as it were?
Yeah it's the "we got money from this customer" ID
However, a Charge can still fail so it could correspond to "we got money" or "we failed to get money"
But the outcome is pretty binary like that. Payment Intents are designed to capture the whole lifecycle of attempting payment (updating payment methods, requiring authentication, etc.) so they have more in-between states
You'd need to get the full checkout session object and expand the payment_intent property. It would go Session -> Payment Intent -> Charge
aaah got it ๐ so I would start with just my session ID, throw away most of the stuff in the actual webhook and from there re-request the exact same session but I can expand the intent and charge and the line items all at once
Yup, you can go 4 layers down on expansion in one request
gotcha
Do i have to request each shallower expansion separately?
it's telling me I can't expand lineitem(s) on a session
I'm trying to expand so I can get the Session -> LineItems -> Price -> Product
You can chain them except where there's a list option (I think)
okay, so if what I want is the lineitems -> data -> price -> product and the paymentintent -> charges I'll need to make separate requests - one for just the line items and expand that
I'd double check here: https://stripe.com/docs/expand
I think there are easier ways that are not popping into my head right away
yeah I'm reading that, it's a little tricky
I can't expand a paymentintent on a session apparently :\
ah the object names don't match in the C# API v.s. the actual API so you have to reference them each time
FUN, I've only dabbled a little in C#
lol aye in C# it's all upper camel case rather than underscores
Well that's where the code snippets are hopefully helpful (since they provide C# examples in the .NET section)
okay so I can deep-expand lists!
Expand = new List<string> { "payment_intent", "line_items.data.price.product" },
that works
so I can indeed get all the transaction line items, with all the product information, and get the payment intent charges
perfect - finally getting the hang of this - thanks kindly