#luizcarlosfx-checkout-product
1 messages ยท Page 1 of 1 (latest)
yeah, I was just waiting for the thread lmao
Stripe.Checkout.SessionService service = new Stripe.Checkout.SessionService();
var lineOptions = new SessionListLineItemsOptions();
lineOptions.AddExpand("data.product");
StripeList<LineItem> lineItems = await service.ListLineItemsAsync(session.Id, lineOptions);
Console.WriteLine(lineItems.Data[0].Product.Name);
this is my code, I want to get the lineItems product name
but I'm getting an error saying that I can't expand data.product
btw I forgot to add the expand in this code snippet
I basically want to be able to know witch product the user just purchased
This property cannot be expanded (data.product).
I can get the product id from the pricing though, but I'd have to make another request to get the product name
Apologies for the delay, can you share the ID of a request where you received that message? It'll help me see exactly what you're doing.
the session id?
cs_test_b1qvdqyfS7Wj7LVEp2fu9TGMUR9FRrWXRt3kILgWggWsTidVzzqUyOMYzMl
this is the session id
I'm not sure if that's what you need
No, that won't be too helpful here. Are you retrieving a single Checkout Session, or listing multiple?
I'm listening to the events
then when I get the checkout complete event I try to list the line items for that specific checkout
Directly from the event?
I can successfully list the line items, but I can't get the product expanded
yeah
I get the session Id and make a new request to list the line items
StripeList<LineItem> lineItems = await service.ListLineItemsAsync(session.Id, lineOptions);
Oohh, okay, that was the piece that hadn't clicked for me (you're making a request to retrieve the line items for a session).
list the items with this api
exactly
The Product information is contained inside of the price hash in those results, so you'll want to expand data.price.product
let me try that
๐