示例#1
0
        public IEnumerable <Stripe.Plan> GetPlans()
        {
            var planService = new Stripe.PlanService(PrivateKey);
            IEnumerable <Stripe.Plan> response = planService.List();

            return(response);
        }
示例#2
0
        public Stripe.Plan[] GetPlans()
        {
            var service = new Stripe.PlanService();
            var options = new Stripe.PlanListOptions {
            };

            return(service.List(options).ToArray <Stripe.Plan>());
        }
示例#3
0
 public PlanService(
     StripePlanService planService,
     ILogger <PlanService> logger,
     IServiceProvider serviceProvider) : base(serviceProvider)
 {
     _planService = planService;
     _logger      = logger;
 }
示例#4
0
        public async Task <IEnumerable <Plan> > GetAvailablePlans(bool basic = true)
        {
            var planService = new PlanService();

            var plans = await planService.ListAsync(new PlanListOptions()
            {
                Active = true,
            });

            // only get those specified in products.json
            if (basic && plans.Any())
            {
                var productNames = StripeConfiguration.GetProducts().Products.First().Plans.Select(x => x.Name); // only one product.. 3 subscriptions

                plans.Data = plans.Data.Where(x => productNames.Contains(x.Nickname)).ToList();
            }

            return(plans);
        }