#farazpatankar
1 messages · Page 1 of 1 (latest)
There isn't unfortunately. You would want to write a filter logic on all results I am afraid
I see.
For context, we want to be fetching all open invoices tied to a product. Let's assume we have 5k+. This means, I'd have to call list with limit: 100 and paginate over them until I get all of them and then filter with custom logic?
Yeah, you can use auto pagination too. Also when looping for result you would want to only pick if the product id = your desired id
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Nice, auto-pagination seems really cool. So I can basically auto-paginate over all open invoices and dump the ones I want into an array and then operate over said array.
Yep
Cool, do you think it makes sense to use this flow long term? I was wondering if it's better to run this as a one-off script and for the future, tag the invoices with their product ID in the metadata and then use the Search invoices flow instead?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Search Invoice also doesn't support Product Id: https://stripe.com/docs/search#query-fields-for-invoices
So it's technically the same, and yes I think it makes sense
Yeah, I know. What I meant was I could add metadata when we created the invoice. For example: metadata: { productId: "ABC123" } and then search by the metadata field?
Yeah that works but it relies on you set the metadata correctly