stripity_stripe v2.7.0 Stripe.Customer View Source

Work with Stripe customer objects.

You can:

  • Create a customer
  • Retrieve a customer
  • Update a customer
  • Delete a customer

Stripe API reference: https://stripe.com/docs/api#customer

Link to this section Summary

Functions

Create a customer.

Delete a customer.

Deletes the discount on a customer

List all customers.

Retrieve a customer.

Update a customer.

Link to this section Types

Link to this type

t() View Source
t() :: %Stripe.Customer{
  account_balance: integer(),
  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(),
  object: String.t(),
  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()),
  tax_info: Stripe.Types.tax_info() | nil,
  tax_info_verification: Stripe.Types.tax_info_verification() | nil
}

Link to this section Functions

Link to this function

create(params, opts \\ []) View Source
create(params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:account_balance) => integer(),
         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(:shipping) => Stripe.Types.shipping(),
         optional(:source) => Stripe.id() | Stripe.Source.t(),
         optional(:tax_info) => Stripe.Types.tax_info()
       }
       | %{}

Create a customer.

Link to this function

delete(id, opts \\ []) View Source
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
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
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
retrieve(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Retrieve a customer.

Link to this function

update(id, params, opts \\ []) View Source
update(Stripe.id() | t(), params, Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}
when params:
       %{
         optional(:account_balance) => integer(),
         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(:shipping) => Stripe.Types.shipping(),
         optional(:source) => Stripe.Source.t(),
         optional(:tax_info) => Stripe.Types.tax_info()
       }
       | %{}

Update a customer.