Stripe.StripeCustomerService.Create C# (CSharp) Method

Create() public method

public Create ( StripeCustomerCreateOptions createOptions, Stripe.StripeRequestOptions requestOptions = null ) : Stripe.StripeCustomer
createOptions StripeCustomerCreateOptions
requestOptions Stripe.StripeRequestOptions
return Stripe.StripeCustomer
        public virtual StripeCustomer Create(StripeCustomerCreateOptions createOptions, StripeRequestOptions requestOptions = null)
        {
            return Mapper<StripeCustomer>.MapFromJson(
                Requestor.PostString(this.ApplyAllParameters(createOptions, Urls.Customers, false),
                SetupRequestOptions(requestOptions))
            );
        }

Usage Example

Esempio n. 1
0
        public bool SaveCustomerByToken(string email, string stripeToken)
        {
            try
            {
                var customer = new StripeCustomerCreateOptions();
                customer.Email = email;
                //customer.Description = "Johnny Tenderloin ([email protected])";
                customer.TokenId = stripeToken;
                //customer.PlanId = *planId*;                          // only if you have a plan
                //customer.Coupon = *couponId*;                        // only if you have a coupon
                //customer.TrialEnd = DateTime.UtcNow.AddMonths(1);    // when the customers trial ends (overrides the plan if applicable)
                //customer.Quantity = 1;                               // optional, defaults to 1
                var customerService = new StripeCustomerService(Cohort.Site.Stripe.SecretKey);
                var stripeCustomer = customerService.Create(customer);
                // Create linkage between signup and customer for later charging

                return true;
            }
            catch (Exception)
            {
                // log 

                return false;
            }
        }
All Usage Examples Of Stripe.StripeCustomerService::Create