#_obo_
1 messages · Page 1 of 1 (latest)
I do have example users if it helps
You just want to get all the Subscriptions that have been cancelled? Do you want to do that as a batch request to the API? Or would listening to customer.subscription.deleted suffice?
as an example: https://dashboard.stripe.com/customers/cus_LnPfHxkMoqswZd
You can see the user basically had a failed payment and stripe stops retrying (which prevents our churnbuster integration from taking action since this was historical)
So the user is "technically" still subscribed, but stripe stopped trying to charge them awhile ago
another example:
https://dashboard.stripe.com/customers/cus_Lbm8EkX8lc4WfE
OKay, so I have no context on what churnbuster is, so can you elaborate on what you want to happen? Preferably a step-by-step explanation of the preferred workflow
sorry, churnbuster basically just gets webhooks from stripe and then cancels the customer in 30 days if they don't pay
I mainly provided reference there to state, this isn't a problem moving forward, we just need to locate these historical orphaned customers
Okay, so you want a list of Customer objects who have had their Subscriptions canceled by Churnbuster?
what I'm looking for is a way I can query your API to get users who are in a state like the example users I provided. To be more specific:
- they had a payment fail in the past
- stripe recognized that failure and instead of trying to charge them each month, stripe just makes a draft invoice and never attempts to charge it
- that user is still subscribed even though they haven't paid in months
if you scroll down to the invoices section on each user you'll see it's just draft invoices for multiple months
Got it. So it's worth mentioning the Customer object has no state on Subscription statuses. So you'll probably want to do something like make a List All Invoices API call to get all the invoices that are in a draft state. You can do that by filtering on status: https://stripe.com/docs/api/invoices/list
Once you have that, you'll want to compare each Invoice's created date against the current date: https://stripe.com/docs/api/invoices/object#invoice_object-created, then cache the ones that were created >30 days ago (or whatever numebr of days is important to you).
Once you've done that it might be worth checking if each Invoice's Customer has other active Subscriptions that are in a good state (see status of the Subscription here: https://stripe.com/docs/api/subscriptions/object#subscription_object-status) to make sure that you don't remove access to active subscriptions
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
That's just one way of many to accomplish this. Another way would be to look at the list of Subscriptions on the Customer object and then check the status of each Subscription in the list, then cache those Customers and do further analysis to determine if they have orphaned subscriptions.
is there a specific status that is unique to subscriptions in this state?
"unpaid" seems to be a good candidate?
I think past_due would probably be better in this case
Since you want Subscriptions that had a Invoice payment attempt that failed and that failure persisted beyond the due date
as an example on this customer: https://dashboard.stripe.com/customers/cus_LnPfHxkMoqswZd I'm seeing unpaid here in the GUI, are you saying I query somewhere else?
You'd get that from the Subscription's status: https://stripe.com/docs/api/subscriptions/object#subscription_object-status
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
got it, thanks for the help
Sure thing!