#pallsmenis_api

1 messages ¡ Page 1 of 1 (latest)

spare tuskBOT
#

👋 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.

uncut thistle
#

Hey there, can you share the object path you're trying to access/expand?

timber kestrel
#

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

uncut thistle
#

Can you share the request you're making to try to access this?

timber kestrel
#

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

uncut thistle
#

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.

timber kestrel
#

okay, thats what I figured

#

bummer

#

thank you

uncut thistle
#

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

timber kestrel
#

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

uncut thistle
#

In the context of the invoice object, they can't be an object (due to expansion limits), so that may be deliberate

timber kestrel
#

well im looking at the invoice line item object

uncut thistle
#

Bu more broadly the types should reflect where it can be both

timber kestrel
#

okay

uncut thistle
#

If there's a type bug there, please file an issue on the github repo for the team to take a look

timber kestrel
#

will do, thanks