#manusw20

1 messages · Page 1 of 1 (latest)

midnight carbonBOT
ruby dew
crisp coral
#

ok, nice, also i can filter by customer country to get the subs

#

SubscriptionSearchParams is quite new?

#

because I do not have the class

ruby dew
#

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

crisp coral
#

by currency yes

ruby dew
#

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

crisp coral
#

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?

ruby dew
#

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

crisp coral
#

yes , but i only get 1 page of ten

#

i need like 15 pages of 100

#

so i need params1("limit", 100); ?

#

and pages?

ruby dew
#

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

crisp coral
#

when i debug i can see only 1 page

#

and i have like 3k subs in the portal

#

so only 1 page of 100

ruby dew
#

Can you show me the exact code you are using here for this list request?

crisp coral
#

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();
    }
ruby dew
#

That is surprising. Only 100 subscription IDs print from that?

crisp coral
#

yes

#

only one page

ruby dew
#

If you let your code run all the way through does it only print out 100 ids?

crisp coral
#

yes

#

only 100

ruby dew
#

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

crisp coral
#

ok

midnight carbonBOT
ruby dew
#

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

opal mirage
#

Sorry, I accidentally closed this thread! Reopened.