There's no direct call for this, but it's easy enough to accomplish.
The "List all customers" API call (StripeCustomerService
's List()
method in Stripe.Net) returns the full JSON object for each customer, including their subscription and plan information. You can easily iterate through that and build your list of subscriber counts.
Note that if you have a lot of users, you'll have to retrieve the customer list in chunks. The API call is capped at 100 records (with a default of 10) and accepts an offset. For easy traversal of the list, the count
property in Stripe's JSON response is the total number of customer records.
So for a basic outline, your strategy would be:
- Request 100 records via
List()
- Calculate the number of additional requests required
- Process the initial 100 records
- Request 100 records via
List()
, offset by 100 * iteration - Process the current 100 records
- Repeat 4 & 5 until records are exhausted