#brahn-subscriptions-list
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
- brahn-subscription-pausecollection, 3 days ago, 12 messages
Hello can you send the text of the Stripe call that you are making and tell me what specifically is returning as null?
Hello, yes
StripeConfiguration.ApiKey = ApiKey;
var service = new CustomerService();
var optionsFirst = new CustomerListOptions
{
Limit = 100
};
List<Customer> customers = [];
string customersJson = string.Empty;
if (System.IO.File.Exists("customers.txt"))
{
customersJson = System.IO.File.ReadAllText("customers.txt");
}
if (!string.IsNullOrWhiteSpace(customersJson))
{
customers = JsonSerializer.Deserialize<List<Customer>>(customersJson);
}
else
{
List<Customer> foundCustomers = [.. service.List(optionsFirst)];
customers.AddRange(foundCustomers);
while (foundCustomers.Count != 0)
{
var options = new CustomerListOptions
{
Limit = 100,
StartingAfter = customers.Last().Id
};
foundCustomers = [.. service.List(options)];
customers.AddRange(foundCustomers);
Console.WriteLine($"Found {customers.Count} customers.");
}
customers = customers.Distinct().ToList();
System.IO.File.WriteAllText("customers.txt", JsonSerializer.Serialize(customers));
}
And what is null?
The customers are returning their values, but all subscriptions within the customers are null
Which they aren't
Subscriptions don't exist on the Customer object, you would actually need to make a subscriptions list call for each customer https://stripe.com/docs/api/subscriptions/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Or you could just list subscriptions without a customer filter and then iterate through the subscriptions to see which subscription is assosciated with what customer