Stripe.Customer (stripity_stripe v2.17.2) View Source

Work with Stripe customer objects.

You can:

  • Create a customer
  • Retrieve a customer
  • Update a customer
  • Delete a customer
  • Search customers

Stripe API reference: https://stripe.com/docs/api/customers

Link to this section Summary

Functions

Create a customer.

Delete a customer.

Deletes the discount on a customer

List all customers.

Retrieve a customer.

Search customers

Update a customer.

Link to this section Types

Specs

t() :: %Stripe.Customer{
  address: Stripe.Types.address() | nil,
  balance: integer(),
  created: Stripe.timestamp(),
  currency: String.t() | nil,
  default_source: Stripe.id() | Stripe.Source.t() | nil,
  deleted: boolean() | nil,
  delinquent: boolean() | nil,
  description: String.t() | nil,
  discount: Stripe.Discount.t() | nil,
  email: String.t() | nil,
  id: Stripe.id(),
  invoice_prefix: String.t() | nil,
  invoice_settings: Stripe.Invoice.invoice_settings() | nil,
  livemode: boolean(),
  metadata: Stripe.Types.metadata(),
  name: String.t(),
  next_invoice_sequence: integer(),
  object: String.t(),
  payment_method: String.t() | nil,
  phone: String.t(),
  preferred_locales: [String.t()],
  shipping: Stripe.Types.shipping() | nil,
  sources: Stripe.List.t(Stripe.Source.t()),
  subscriptions: Stripe.List.t(Stripe.Subscription.t()),
  tax_exempt: String.t() | nil,
  tax_ids: Stripe.List.t(Stripe.TaxID.t()),
  test_clock: Stripe.id()
}

Link to this section Functions

Link to this function

create(params, opts \\ [])

View Source

Specs

create(params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:address) => Stripe.Types.address(),
         optional(:balance) => integer(),
         optional(:coupon) => Stripe.id() | Stripe.Coupon.t(),
         optional(:description) => String.t(),
         optional(:email) => String.t(),
         optional(:invoice_prefix) => String.t(),
         optional(:invoice_settings) => Stripe.Invoice.invoice_settings(),
         optional(:metadata) => Stripe.Types.metadata(),
         optional(:name) => String.t(),
         optional(:payment_method) => String.t(),
         optional(:phone) => String.t(),
         optional(:preferred_locales) => [String.t()],
         optional(:shipping) => Stripe.Types.shipping(),
         optional(:source) => Stripe.id() | Stripe.Source.t(),
         optional(:tax_excempt) => String.t(),
         optional(:tax_id_data) => Stripe.TaxID.tax_id_data(),
         optional(:test_clock) => Stripe.id()
       }
       | %{}

Create a customer.

Specs

delete(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Delete a customer.

Link to this function

delete_discount(id, opts \\ [])

View Source

Specs

delete_discount(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Deletes the discount on a customer

Link to this function

list(params \\ %{}, opts \\ [])

View Source

Specs

list(params, Stripe.options()) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:created) => String.t() | Stripe.date_query(),
         optional(:email) => String.t(),
         optional(:ending_before) => t() | Stripe.id(),
         optional(:limit) => 1..100,
         optional(:starting_after) => t() | Stripe.id()
       }
       | %{}

List all customers.

Link to this function

retrieve(id, opts \\ [])

View Source

Specs

retrieve(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Retrieve a customer.

Link to this function

search(params, opts \\ [])

View Source

Specs

search(params, Stripe.options()) ::
  {:ok, Stripe.SearchResult.t(t())} | {:error, Stripe.Error.t()}
when params: %{
       :query => Stripe.search_query(),
       optional(:limit) => 1..100,
       optional(:page) => String.t()
     }

Search customers

Link to this function

update(id, params, opts \\ [])

View Source

Specs

update(Stripe.id() | t(), params, Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:address) => Stripe.Types.address(),
         optional(:balance) => integer(),
         optional(:coupon) => Stripe.id() | Stripe.Coupon.t(),
         optional(:default_source) => Stripe.id() | Stripe.Source.t(),
         optional(:description) => String.t(),
         optional(:email) => String.t(),
         optional(:invoice_prefix) => String.t(),
         optional(:invoice_settings) => Stripe.Invoice.invoice_settings(),
         optional(:metadata) => Stripe.Types.metadata(),
         optional(:name) => String.t(),
         optional(:phone) => String.t(),
         optional(:preferred_locales) => [String.t()],
         optional(:shipping) => Stripe.Types.shipping(),
         optional(:source) => Stripe.Source.t(),
         optional(:tax_excempt) => String.t()
       }
       | %{}

Update a customer.