public bool HasSubscription(string customerId) { var subscriptionService = new Stripe.SubscriptionService(); Stripe.StripeList <Stripe.Subscription> response = subscriptionService.List(new Stripe.SubscriptionListOptions { CustomerId = customerId }); return(response.Count() >= 1); }
public void DeleteSubscriptions(string customerId) { var subscriptionService = new Stripe.SubscriptionService(); Stripe.StripeList <Stripe.Subscription> subscriptions = subscriptionService.List(new Stripe.SubscriptionListOptions { CustomerId = customerId }); foreach (Stripe.Subscription subscription in subscriptions) { subscriptionService.Cancel(subscription.Id, null); } }
public string GetSubscription(string customerId) { var subscriptionService = new Stripe.SubscriptionService(); Stripe.StripeList <Stripe.Subscription> subscriptions = subscriptionService.List(new Stripe.SubscriptionListOptions { CustomerId = customerId }); if (subscriptions.Count() == 0) { return("N/A"); } return(subscriptions.First().Plan.Nickname); }
public async Task <int> ImportSubscriptions(int limit) { _logger.LogInformation(GetLogMessage("Limit: {limit}"), limit); var svc = new StripeSubscriptionService(); var subscriptions = svc.List(new SubscriptionListOptions() { Limit = limit }); var totals = 0; foreach (var customer in subscriptions) { var returnValue = await PullSubscription(customer); totals += returnValue; } return(totals); }