#liodegar-subscription
1 messages · Page 1 of 1 (latest)
SubscriptionCollection collection = Subscription.list(EMPTY_MAP, requestOptions).autoPagingIterable();
Is this Java code? Also can you share your account ID (acct_xxx)? It's at the top of this page: https://dashboard.stripe.com/settings/account
Does the subscription you’ve selected actually exist? Error says there’s no subscription
The subscription in the error message you shared does exist (sub_1KxEcRDhO9T7S5mHmbwOmpXh), however it doesn't belon to the account you just shared.
We have two accounts, please can you check this: acct_1HvgXhDhO9T7S5mH
Yes, that's the correct account. So you are using the API keys of acct_1HvgXhDhO9T7S5mH to list all subscriptions, and you get the error you share above?
I am iterating and then cancelling the subscription inside the loop
oh so that's probably the issue! when using auto-pagination, we use the starting_after parameter: https://stripe.com/docs/api/subscriptions/list#list_subscriptions-starting_after
But if that subscription is canceled then it won't work.
so, how can I cancel the retrieved subscriptions?
While you list the subscriptions, add the ID of the subscriptions you want to delete to an array. Then when you finished listing all subscription, then cancel all the subscription you need.
Listing and deleting at the same time doesn't work. But you can do that sequencially: list everything, then delete.