Possible to get count of only active (rather than active + deleted) customers/subscriptions/charges?

691 views
Skip to first unread message

David C

unread,
Jun 11, 2014, 1:05:22 PM6/11/14
to api-d...@lists.stripe.com
Hello,

I'm working on a Stripe Connect application that as a first step will import a user's customers, subscriptions, and charges from Stripe.  We'd like to show progress bars as we go.

However, as far as I can tell, the count attribute Stripe returns (e.g., with the /customers endpoint) includes the number of active and inactive objects, whereas the actual data Stripe returns only includes objects whose status is "active".  As a result we can't really show our progress--the denominator we get from the count attribute is often significantly higher than the number of objects we can actually import.

I know in the past the Stripe team has mentioned that including deleted/inactive data isn't in the cards (at least for now), but is there any way to get a count of active customers/subscriptions/charges so that the count reported aligns with the data Stripe provides?

Thanks!

David

Jim Danz

unread,
Jun 12, 2014, 1:42:23 AM6/12/14
to api-d...@lists.stripe.com
Hey David,

Hmmm, any distinction between the count of objects returned, and the
total number of objects that you can receive, would indicate a bug on
our end. In particular, those things are generally set up so that
they are ideally using the exact same query to power the counts as
they are to power the responses themselves. Also, charges cannot be
deleted, so there's no notion of an inactive or deleted charge
(charges can, of course, be refunded).

Would you mind perhaps sharing a bit more about the particular
requests that you are making? If we do have a bug on our side, that's
definitely something that we'd want to hunt up and fix.

Thanks!
Jim
> --
> You received this message because you are subscribed to the Google Groups
> "Stripe API Discussion" group.
> To post to this group, send email to api-d...@lists.stripe.com.
> Visit this group at
> http://groups.google.com/a/lists.stripe.com/group/api-discuss/.
>
> To unsubscribe from this group and stop receiving emails from it, send an
> email to api-discuss...@lists.stripe.com.

David C

unread,
Jun 13, 2014, 1:03:05 AM6/13/14
to api-d...@lists.stripe.com
Hey Jim,

I"ll double-check tomorrow that there's not a bug in our code (i.e. that we're not somehow getting inactive customers from Stripe and discarding them silently without counting them toward our imports), but just in looking at the code I don't see a place that could be happening.

We're using the Stripe Ruby gem and just calling Stripe::Customer.all with no additional parameters.  I was confused for a while about why the count attribute Stripe provides is different from the number of customer objects we're processing, but I realized that when I export customers as CSV from Stripe, the total number of rows returned is equal to the count attribute, and the number of customers with status == "active" in the CSV export is the same as the number of objects we're actually receiving.

I'll look tomorrow at the raw response we're getting from Stripe to make sure we're not throwing away the inactive objects, but we don't even check for that so I don't think it's likely.  I'm happy to take this off the mailing list if I can help with debugging or it would useful to look at our individual account.

If it helps, we're making our API calls via our Connect app with the 2014-03-13 version of the API, and the account we're connected with (whose data we're actually getting) is on the 2011-11-17 API.

Thanks for your help!

David
Reply all
Reply to author
Forward
0 new messages