예제 #1
0
        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);
        }
예제 #2
0
        // 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);
        }