Ejemplo n.º 1
0
        public StripeObject CreateCustomer(string email, string firstName, string lastName)
        {
            string description = firstName + " " + lastName + " (" + email + ")";
            try
            {
                var customerOptions = new StripeCustomerCreateOptions();
                customerOptions.Email = email;
                customerOptions.Description = description;

                StripeCustomer customer = cusService.Create(customerOptions);
                return customer;
            }
            catch (Exception ex)
            {
                if (ex is StripeException)
                {
                    StripeException exception = (StripeException) ex;
                    StripeError err = exception.StripeError;
                    StripeAccessError error = new CreateCustomerError();
                    error.Error_Type = err.ErrorType;
                    return error;
                }
                return null;
            }
        }
Ejemplo n.º 2
0
 public StripeObject GetCustomer(string customerId)
 {
     try
     {
         StripeCustomer customer = cusService.Get(customerId);
         return customer;
     }
     catch (Exception ex)
     {
         if (ex is StripeException)
         {
             StripeException exception = (StripeException)ex;
             StripeError err = exception.StripeError;
             StripeAccessError error = new CreateCustomerError();
             error.Error_Type = err.ErrorType;
             return error;
         }
         return null;
     }
 }