#lliu_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1332039890279465171
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- lliu_unexpected, 22 hours ago, 18 messages
Hello! You can list Subscriptions by Customer: https://docs.stripe.com/api/subscriptions/list#list_subscriptions-customer
And you can specify which status you want as well: https://docs.stripe.com/api/subscriptions/list#list_subscriptions-status
I have read both docs. But i do not seem to be able to get a list of "cencelled" subscription for a customer by using the following pattern (Python for example)
customer = client.customers.retrieve(cid, CustomerService.RetrieveParams(
expand=["subscriptions"]
))
I want to be able to
- retrieve a customer by id
- expand all subs (regardless of statud) of the given customer
without doing another "list subscription" by status
You're using the wrong approach. The code you shared is retreiving a Customer and attempting to expand the subscriptions property. That won't work. You need to switch to the Subscriptions list API I linked to.
Another alternative would be to use the Subscriptions search API to search for Subscriptions belonging to a customer with multiple statuses: https://docs.stripe.com/api/subscriptions/search
https://docs.stripe.com/api/subscriptions/search does not mention how to search subscriptions for a customer ...
it has the example of search subscriptions by "status" and "metadata"
can you show me a serach query that can be used to search for a list of subscriptions given a customer id?
Oh, my fault, I thought you could search Subscriptions by Customer, but looks like you can't. Sorry about that. You'll need to use the list API I linked to originally.
Yep, see my message above.
by listing ... you meant "search" ? https://docs.stripe.com/api/subscriptions/search
No, I mean list. I linked to the list API originally here in my first reply to your question: #1332039890279465171 message
This is the link to the Subscriptions list API itself: https://docs.stripe.com/api/subscriptions/list