private async Task <Customer> getOrCreateCustomer(string email)
        {
            var service     = new Stripe.CustomerService();
            var listOptions = new Stripe.CustomerListOptions
            {
                Limit = 1
            };

            listOptions.AddExtraParam("email", email);
            var customer = (await service.ListAsync(listOptions)).Data.FirstOrDefault();

            if (customer != null)
            {
                return(customer);
            }

            var customerCreateOptions = new Stripe.CustomerCreateOptions
            {
                Email = email
            };

            return(await service.CreateAsync(customerCreateOptions));
        }
示例#2
0
 public virtual IAsyncEnumerable <Customer> ListAutoPagingAsync(CustomerListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
 {
     return(this.ListEntitiesAutoPagingAsync(options, requestOptions, cancellationToken));
 }
示例#3
0
 public virtual IEnumerable <Customer> ListAutoPaging(CustomerListOptions options = null, RequestOptions requestOptions = null)
 {
     return(this.ListEntitiesAutoPaging(options, requestOptions));
 }
示例#4
0
 public virtual Task <StripeList <Customer> > ListAsync(CustomerListOptions options = null, RequestOptions requestOptions = null, CancellationToken cancellationToken = default)
 {
     return(this.ListEntitiesAsync(options, requestOptions, cancellationToken));
 }
示例#5
0
 public virtual StripeList <Customer> List(CustomerListOptions options = null, RequestOptions requestOptions = null)
 {
     return(this.ListEntities(options, requestOptions));
 }