#manusw20
1 messages · Page 1 of 1 (latest)
Yep, you can page through your full list. This doc shows how https://docs.stripe.com/api/pagination
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Most of our client libraries even have an automatic way to make all of the list calls for you https://docs.stripe.com/api/pagination/auto
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok, nice, also i can filter by customer country to get the subs
SubscriptionSearchParams is quite new?
because I do not have the class
Unfortunately we don't support filtering by country as far as I know. The search API is relatively new so you may need to update your client library to be able to use it
by currency yes
We don't have built in functionality for searching by country or currency, we only offer these fields https://docs.stripe.com/search#query-fields-for-subscriptions
So the two main options would be to list all subscriptions and check the country/currency yourself or you can set the country/currency as metadata and use our search API
ahh i can see it
ok
SubscriptionListParams params1 =
SubscriptionListParams.builder().build();
Iterable<Subscription> subscriptions = Subscription.list(params1).autoPagingIterable();
something like that?
but where i set the limit?
Within Subscription.list(params1)
That is still a normal list call, the autoPagingIterable basically just repeats that call but while changing up the pagination keys
yes , but i only get 1 page of ten
i need like 15 pages of 100
so i need params1("limit", 100); ?
and pages?
Correct
You don't specify pages, the auto paging iterable does that for you
It would technically work even if the limit is 1, but you would be making way more API requests
when i debug i can see only 1 page
and i have like 3k subs in the portal
so only 1 page of 100
Can you show me the exact code you are using here for this list request?
yes
SubscriptionListParams params1 =
SubscriptionListParams.builder().putExtraParam("limit",100).build();
try {
Iterable<Subscription> subscriptions = Subscription.list(params1).autoPagingIterable();
for ( Subscription subs : subscriptions){
System.out.println("SUBS : " + subs.getId());
}
} catch (StripeException e) {
e.printStackTrace();
}
That is surprising. Only 100 subscription IDs print from that?
If you let your code run all the way through does it only print out 100 ids?
Strange
I thought that what might be happening is that our auto paging iter makes 100 calls, waits for you to try to access the 101st subscription and then makes the next call
Apologies the server has been to busy for me to run this myself. Will be able to try in a minute
ok
Still trying to figure this out. I'm not even getting a full page back 🤷♂️
This same code for me works with other client libraries. Not sure what the difference is with Java
It turns out I was running in to test mode data retention. That exact same code is working for me now that I have more subscriptions than I get back in a full page
Can you send me your account ID? (acct_1234)
I can try to look further in to what may be happening on your account
Sorry, I accidentally closed this thread! Reopened.