#Doooing - expand
1 messages ยท Page 1 of 1 (latest)
Hello there,
The maximum list size of expanded items is 10, and you can't do pagination on expand.
You should use price search API for that:
https://stripe.com/docs/api/prices/search#search_prices-query
and you filter on product
https://stripe.com/docs/search#query-fields-for-prices:~:text=token-,product,-product%3A"prod_123"
Yeah, as you can't paginate on expanded items
how about, not expanding, then pagination, and retrieving the 3 single products separately?
wouldnt that be easier / more performant?
or how many objects can I retrieve un-expanded?
maybe not even pagination needed?
tried. Remove the expand. Still only 10 :(.
so whats easier and or more performant -pagination or that search query thing?
I think I found it:
limit optional, default is 10
A limit on the number of objects to be returned, between 1 and 100.
Funny that, at least the Java api uses a LONG on the limit, that is 100 max. 100 will fit in a long like 1 billion times or so ๐
Further update:
Expanding worked with the 19 prices / 3 products we have actually!
I still thinking - that means 3 products retrieved for 19 prices.. that is a certain overhead.
Maybe I should instead retrieve the products separately?
Is there a way to retrieve the TOTAL count of prices, so that I do not use pagination, but throw an exception of there are more then 100 prices so pagination must be added in such rare case?
Maybe I should instead retrieve the products separately?
it depends on your use case, I recommend you to do some test
so whats easier and or more performant -pagination or that search query thing?
you'll need pagination with search, because you'll get only 10 items per result
No there is not as far as I know, you should use pagination better than retrieving 100 items at once for performance
well there are just 19.
You should design a system that can handle this case and more if that something could happen
well, I am trying to. that's why, I need to know the maximum amount of list entries
how would you handle pagination otherwise? Paginate until an exception occurs or null is returned???
You Take a look at how pagination works: https://stripe.com/docs/api/pagination
You can use this params starting_after until you get an empty list
Or you can use auto pagination https://stripe.com/docs/api/pagination/auto