#phonicuk - product info

1 messages ยท Page 1 of 1 (latest)

echo olive
#

What do the line items look like when you look them up?

#

Can you paste a sample here?

mild harbor
#

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

echo olive
mild harbor
#

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

echo olive
#

Of course, always happy to help

mild harbor
#

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

toxic elk
#

@mild harbor your thread is still over here

mild harbor
#

aah

toxic elk
#

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

mild harbor
#

Ah okay, so that's the "Money changed hands" ID as it were?

toxic elk
#

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

mild harbor
#

How do I link the Checkout completion to the associated charge?

#

or vice-versa

toxic elk
#

You'd need to get the full checkout session object and expand the payment_intent property. It would go Session -> Payment Intent -> Charge

mild harbor
#

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

toxic elk
#

Yup, you can go 4 layers down on expansion in one request

mild harbor
#

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

toxic elk
#

You can chain them except where there's a list option (I think)

mild harbor
#

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

toxic elk
mild harbor
#

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

toxic elk
#

FUN, I've only dabbled a little in C#

mild harbor
#

lol aye in C# it's all upper camel case rather than underscores

toxic elk
#

Well that's where the code snippets are hopefully helpful (since they provide C# examples in the .NET section)

mild harbor
#

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