コード例 #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 };
     });
 }
コード例 #2
0
        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);

        }