Пример #1
0
 public async Task<dynamic> GetPlans()
 {
     return await Task.Factory.StartNew(() =>
     {
         var forPlans = new StripePlanService(Cohort.Site.Stripe.SecretKey);
         var plans = forPlans.List();
         return new { Plans = plans };
     });
 }
        public ActionResult Index()
        {
            StripeConfiguration.SetApiKey("sk_test_JRb9hXgh80838IRQQTUHwJPP");

            var planService = new StripePlanService("sk_test_JRb9hXgh80838IRQQTUHwJPP");
            IEnumerable<StripePlan> plan = planService.List();

            foreach (StripePlan value in plan)
            {
                System.Diagnostics.Debug.Write(value.Name);
            }






            return View();
        }
Пример #3
0
        // GET api/plan
        public HttpResponseMessage Get()
        {
            try
            {
                var planService = new StripePlanService();
                IEnumerable<StripePlan> response = planService.List(50); // can optionally pass count (defaults to 10) and offset
                return Request.CreateResponse(HttpStatusCode.OK, response);
            }
            catch (StripeException ex)
            {
                emailHelper.SendStripeError(ex);
            }
            catch (Exception e)
            {
                emailHelper.SendErrorEmail(e);
            }
            return Request.CreateResponse(HttpStatusCode.BadRequest);

        }