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); }
// GET: Users/Card public string Card() { var userId = Int32.Parse(HttpContext.Session.GetString("UserID")); var user = _context.Users.Find(userId); var customerId = user.CustomerId; StripeLib stripeLib = new StripeLib(); Stripe.StripeList <Stripe.Card> cards = stripeLib.GetCards(customerId); if (cards.Count() == 0) { return(null); } return(cards.First().Id); }