예제 #1
0
 public virtual StripePlan Create(StripePlanCreateOptions createOptions, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripePlan>.MapFromJson(
         Requestor.PostString(this.ApplyAllParameters(createOptions, Urls.Plans, false),
         SetupRequestOptions(requestOptions))
     );
 }
예제 #2
0
 public virtual async Task <StripePlan> CreateAsync(StripePlanCreateOptions createOptions, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripePlan> .MapFromJson(
                await Requestor.PostStringAsync(this.ApplyAllParameters(createOptions, Urls.Plans, false),
                                                SetupRequestOptions(requestOptions))
                ));
 }
예제 #3
0
 public virtual StripePlan Create(StripePlanCreateOptions createOptions, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripePlan> .MapFromJson(
                Requestor.PostString(
                    this.ApplyAllParameters(createOptions, Urls.Plans, false),
                    this.SetupRequestOptions(requestOptions))));
 }
예제 #4
0
		public virtual StripePlan Create(StripePlanCreateOptions createOptions)
		{
			var url = ParameterBuilder.ApplyAllParameters(createOptions, Urls.Plans);

			var response = Requestor.PostString(url);

			return Mapper<StripePlan>.MapFromJson(response);
		}
예제 #5
0
        public virtual StripePlan Create(StripePlanCreateOptions createOptions)
        {
            var url = ParameterBuilder.ApplyAllParameters(createOptions, Urls.Plans);

            var response = Requestor.PostString(url, ApiKey);

            return(Mapper <StripePlan> .MapFromJson(response));
        }
예제 #6
0
        public StripePlan Create(StripePlanCreateOptions createOptions)
        {
            var url = ParameterBuilder.ApplyAllParameters(createOptions, Urls.Plans);

            var response = Requestor.PostString(url);

            return(PopulateStripePlan(response));
        }
예제 #7
0
 //Async
 public virtual async Task <StripePlan> CreateAsync(StripePlanCreateOptions createOptions, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(Mapper <StripePlan> .MapFromJson(
                await Requestor.PostStringAsync(this.ApplyAllParameters(createOptions, Urls.Plans, false),
                                                SetupRequestOptions(requestOptions),
                                                cancellationToken).ConfigureAwait(false)
                ));
 }
예제 #8
0
        public StripePlan Create(StripePlanCreateOptions createOptions)
        {
            var url = ParameterBuilder.ApplyAllParameters(createOptions, Urls.Plans);
            
            var response = Requestor.PostString(url);

            return PopulateStripePlan(response);
        }
예제 #9
0
        public virtual StripePlan Create(StripePlanCreateOptions createOptions, StripeRequestOptions requestOptions = null)
        {
            requestOptions = SetupRequestOptions(requestOptions);

            var url = this.ApplyAllParameters(createOptions, Urls.Plans, false);

            var response = Requestor.PostString(url, requestOptions);

            return Mapper<StripePlan>.MapFromJson(response);
        }
예제 #10
0
        public virtual StripePlan Create(StripePlanCreateOptions createOptions, StripeRequestOptions requestOptions = null)
        {
            requestOptions = SetupRequestOptions(requestOptions);

            var url = this.ApplyAllParameters(createOptions, Urls.Plans, false);

            var response = Requestor.PostString(url, requestOptions);

            return(Mapper <StripePlan> .MapFromJson(response));
        }
        // GET: InitPlans
        public ActionResult Index()
        {
            var myFreePlan = new StripePlanCreateOptions();
            myFreePlan.Id = "free_plan";
            myFreePlan.Amount = 0;           // all amounts on Stripe are in cents, pence, etc
            myFreePlan.Currency = "usd";        // "usd" only supported right now
            myFreePlan.Interval = "month";      // "month" or "year"
            myFreePlan.IntervalCount = 1;       // optional
            myFreePlan.Name = "Basic Plan";
            myFreePlan.TrialPeriodDays = 1;    // amount of time that will lapse before the customer is billed

            var myBasicPlan = new StripePlanCreateOptions();
            myBasicPlan.Id = "basic_plan";
            myBasicPlan.Amount = 0;           // all amounts on Stripe are in cents, pence, etc
            myBasicPlan.Currency = "usd";        // "usd" only supported right now
            myBasicPlan.Interval = "month";      // "month" or "year"
            myBasicPlan.IntervalCount = 1;       // optional
            myBasicPlan.Name = "Basic Plan";
            myBasicPlan.TrialPeriodDays = 1;    // amount of time that will lapse before the customer is billed

            var myProfessionalPlan = new StripePlanCreateOptions();
            myProfessionalPlan.Id = "pro_plan";
            myProfessionalPlan.Amount = 999;           // all amounts on Stripe are in cents, pence, etc
            myProfessionalPlan.Currency = "usd";        // "usd" only supported right now
            myProfessionalPlan.Interval = "month";      // "month" or "year"
            myProfessionalPlan.IntervalCount = 1;       // optional
            myProfessionalPlan.Name = "Professional Plan";
            myProfessionalPlan.TrialPeriodDays = 1;    // amount of time that will lapse before the customer is billed

            var myBuinessPlan = new StripePlanCreateOptions();
            myBuinessPlan.Id = "business_plan";
            myBuinessPlan.Amount = 1999;           // all amounts on Stripe are in cents, pence, etc
            myBuinessPlan.Currency = "usd";        // "usd" only supported right now
            myBuinessPlan.Interval = "month";      // "month" or "year"
            myBuinessPlan.IntervalCount = 1;       // optional
            myBuinessPlan.Name = "Business Plan";
            myBuinessPlan.TrialPeriodDays = 1;    // amount of time that will lapse before the customer is billed

            var planService = new StripePlanService();
            StripePlan response = planService.Create(myFreePlan);
            StripePlan response2 = planService.Create(myBasicPlan);
            StripePlan response3 = planService.Create(myProfessionalPlan);
            StripePlan response4 = planService.Create(myBuinessPlan);

            CreateCoupon();

            return View();
        }
예제 #12
0
        /// <summary>
        /// Creates a new plan inside of Stripe, using the given subscription plan's information
        /// </summary>
        /// <param name="plan"></param>
        public static void CreatePlan(IStripeSubscriptionPlan plan)
        {
            // Save it to Stripe
            StripePlanCreateOptions newStripePlanOptions = new StripePlanCreateOptions();
            newStripePlanOptions.Amount = Convert.ToInt32(plan.Price * 100.0); // all amounts on Stripe are in cents, pence, etc
            newStripePlanOptions.Currency = string.IsNullOrEmpty(plan.Currency) ?  "usd" : plan.Currency;                                 // "usd" only supported right now
            newStripePlanOptions.Interval = "month";                               // "month" or "year"
            newStripePlanOptions.IntervalCount = 1;                                // optional
            newStripePlanOptions.Name = plan.Title;
            newStripePlanOptions.TrialPeriodDays = plan.TrialDays;     // amount of time that will lapse before the customer is billed
            newStripePlanOptions.Id = plan.PaymentSystemId;

            StripePlanService planService = new StripePlanService();
            StripePlan newPlan = planService.Create(newStripePlanOptions);
            plan.PaymentSystemId = newPlan.Id;

            System.Diagnostics.Trace.TraceInformation("Created new plan in stripe: '{0}' with id {1}", plan.Title, plan.PaymentSystemId);
        }
예제 #13
0
        private StripePlan CreatePlan(NewDonationModel model)
        {
            var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
            var currentUser = manager.FindById(User.Identity.GetUserId());


            var myPlan = new StripePlanCreateOptions();
            myPlan.Amount = (int)(model.Amount*100);
            myPlan.Currency = "usd";
            myPlan.Interval = "month";
            myPlan.Name = currentUser.FirstName + "-" + currentUser.LastName + "-" + model.Amount + "-" + model.Category;
            myPlan.Id = currentUser.FirstName + "-" + currentUser.LastName + "-" + model.Amount + "-" + model.Category;

            var planService = new StripePlanService("sk_test_yPi2XADkAP3wiS1i6tkjErxZ");
            return planService.Create(myPlan);
        }