Exemplo n.º 1
0
 public virtual async Task <StripeCoupon> CreateAsync(StripeCouponCreateOptions createOptions, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripeCoupon> .MapFromJson(
                await Requestor.PostStringAsync(this.ApplyAllParameters(createOptions, Urls.Coupons, false),
                                                SetupRequestOptions(requestOptions))
                ));
 }
Exemplo n.º 2
0
 public virtual StripeCoupon Create(StripeCouponCreateOptions createOptions, StripeRequestOptions requestOptions = null)
 {
     return(Mapper <StripeCoupon> .MapFromJson(
                Requestor.PostString(
                    this.ApplyAllParameters(createOptions, Urls.Coupons, false),
                    this.SetupRequestOptions(requestOptions))));
 }
        private void CreateCoupon()
        {
            var myHolidayCoupon = new StripeCouponCreateOptions();
            myHolidayCoupon.Id = "HOLIDAY10OFF";
            myHolidayCoupon.PercentOff = 10;
            myHolidayCoupon.Duration = "repeating"; // "forever", "once", or "repeating"
            myHolidayCoupon.DurationInMonths = 3; // valid when "repeating" only
            // set these if you want to
            myHolidayCoupon.MaxRedemptions = 100;
            myHolidayCoupon.RedeemBy = new DateTime(2015, 12, 10);
            var couponService = new StripeCouponService();
            StripeCoupon response5 = couponService.Create(myHolidayCoupon);

            var my25DollarCoupon = new StripeCouponCreateOptions();
            my25DollarCoupon.Id = "25DollarsOFF";
            my25DollarCoupon.AmountOff = 2500;
            my25DollarCoupon.Currency = "usd";
            my25DollarCoupon.Duration = "repeating"; // "forever", "once", or "repeating"
            my25DollarCoupon.DurationInMonths = 3; // valid when "repeating" only
            // set these if you want to
            my25DollarCoupon.MaxRedemptions = 100;
            my25DollarCoupon.RedeemBy = new DateTime(2015, 12, 10);
            var couponService2 = new StripeCouponService();
            StripeCoupon response6 = couponService.Create(my25DollarCoupon);
        }
Exemplo n.º 4
0
 public virtual StripeCoupon Create(StripeCouponCreateOptions createOptions, StripeRequestOptions requestOptions = null)
 {
     return Mapper<StripeCoupon>.MapFromJson(
         Requestor.PostString(this.ApplyAllParameters(createOptions, Urls.Coupons, false),
         SetupRequestOptions(requestOptions))
     );
 }
		public virtual StripeCoupon Create(StripeCouponCreateOptions createOptions)
		{
			var url = ParameterBuilder.ApplyAllParameters(createOptions, Urls.Coupons);

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

			return Mapper<StripeCoupon>.MapFromJson(response);
		}
Exemplo n.º 6
0
        public virtual StripeCoupon Create(StripeCouponCreateOptions createOptions)
        {
            var url = ParameterBuilder.ApplyAllParameters(createOptions, Urls.Coupons);

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

            return(Mapper <StripeCoupon> .MapFromJson(response));
        }
Exemplo n.º 7
0
 public virtual async Task <StripeCoupon> CreateAsync(StripeCouponCreateOptions createOptions, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(Mapper <StripeCoupon> .MapFromJson(
                await Requestor.PostStringAsync(
                    this.ApplyAllParameters(createOptions, Urls.Coupons, false),
                    this.SetupRequestOptions(requestOptions),
                    cancellationToken).ConfigureAwait(false)));
 }
Exemplo n.º 8
0
        public StripeCoupon Create(StripeCouponCreateOptions createOptions)
        {
            var url = ParameterBuilder.ApplyAllParameters(createOptions, Urls.Coupons);

            var response = Requestor.PostString(url);

            return(PopulateStripeCoupon(response));
        }
Exemplo n.º 9
0
 //Async
 public virtual async Task<StripeCoupon> CreateAsync(StripeCouponCreateOptions createOptions, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
 {
     return Mapper<StripeCoupon>.MapFromJson(
         await Requestor.PostStringAsync(this.ApplyAllParameters(createOptions, Urls.Coupons, false),
         SetupRequestOptions(requestOptions),
         cancellationToken)
     );
 }
Exemplo n.º 10
0
        public StripeCoupon Create(StripeCouponCreateOptions createOptions)
        {
            var url = ParameterBuilder.ApplyAllParameters(createOptions, Urls.Coupons);
            
            var response = Requestor.PostString(url);

            return PopulateStripeCoupon(response);
        }
Exemplo n.º 11
0
        public virtual StripeCoupon Create(StripeCouponCreateOptions createOptions, StripeRequestOptions requestOptions = null)
        {
            requestOptions = SetupRequestOptions(requestOptions);

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

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

            return Mapper<StripeCoupon>.MapFromJson(response);
        }
Exemplo n.º 12
0
        public virtual StripeCoupon Create(StripeCouponCreateOptions createOptions, StripeRequestOptions requestOptions = null)
        {
            requestOptions = SetupRequestOptions(requestOptions);

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

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

            return(Mapper <StripeCoupon> .MapFromJson(response));
        }