#pallsmenis_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1372927161605816432
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hey there, can you share the object path you're trying to access/expand?
invoice line item -> pricing: {
price_details: {
price: string | IStripePrice | null;
product: string | IStripeProduct | null;
},
type: string;
unit_amount_decimal: string;
};
im trying to get the product
invoice line item -> pricing > price_details > product
Can you share the request you're making to try to access this?
im fetching the invoice via stripe.invoices.retreive with these expand options:
[
'charge',
'payment_intent',
'payment_intent.payment_method',
'subscription',
'subscription.schedule',
'subscription.default_payment_method',
'discount',
'line_items.pricing.price_details.product',
'default_payment_method'
]
using the node JS stripe sdk btw
latest version, latest API version
in the Typescript type for invoince line item, the product and price in the price_details object are strings. This plus the fact that the API docs doesn't say these fields are expandable makes me think they are not in fact expandable
So i think the issue is that the product is too deep to expand, its beyond the depth limit of 4
(the expand would actually be line_items.data.pricing.price_details.product with the List data layer, but thats 5 levels)
So I don't think you can get all this in the same call, currently.
However, I think you can get all the product detail in a single extra call, not a call per line
https://docs.stripe.com/api/invoice-line-item/retrieve
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
If you use the API to list the invoices line items, there you could expand data.pricing.price_details.product and you should be able to get all the product objects for all the lines in one shot
okay good to know, is it common for the Typescript types to have a type of string only when its a field that could potentially be a Stripe.Product or other stripe entity
In the context of the invoice object, they can't be an object (due to expansion limits), so that may be deliberate
well im looking at the invoice line item object
Bu more broadly the types should reflect where it can be both
okay
If there's a type bug there, please file an issue on the github repo for the team to take a look
will do, thanks