# `Stripe.Customer`
[🔗](https://github.com/code-corps/stripity_stripe/blob/v3.3.3/lib/generated/customer.ex#L1)

This object represents a customer of your business. Use it to [create recurring charges](https://stripe.com/docs/invoicing/customer), [save payment](https://stripe.com/docs/payments/save-during-payment) and contact information,
and track payments that belong to the same customer.

# `address`

```elixir
@type address() :: %{
  optional(:city) =&gt; binary(),
  optional(:country) =&gt; binary(),
  optional(:line1) =&gt; binary(),
  optional(:line2) =&gt; binary(),
  optional(:postal_code) =&gt; binary(),
  optional(:state) =&gt; binary()
}
```

# `bank_transfer`

```elixir
@type bank_transfer() :: %{
  optional(:eu_bank_transfer) =&gt; eu_bank_transfer(),
  optional(:requested_address_types) =&gt; [:iban | :sort_code | :spei | :zengin],
  optional(:type) =&gt;
    :eu_bank_transfer
    | :gb_bank_transfer
    | :jp_bank_transfer
    | :mx_bank_transfer
    | :us_bank_transfer
}
```

Additional parameters for `bank_transfer` funding types

# `cash_balance`

```elixir
@type cash_balance() :: %{optional(:settings) =&gt; settings()}
```

Balance information and default balance settings for this customer.

# `created`

```elixir
@type created() :: %{
  optional(:gt) =&gt; integer(),
  optional(:gte) =&gt; integer(),
  optional(:lt) =&gt; integer(),
  optional(:lte) =&gt; integer()
}
```

# `custom_fields`

```elixir
@type custom_fields() :: %{optional(:name) =&gt; binary(), optional(:value) =&gt; binary()}
```

# `eu_bank_transfer`

```elixir
@type eu_bank_transfer() :: %{optional(:country) =&gt; binary()}
```

Configuration for eu_bank_transfer funding type.

# `invoice_settings`

```elixir
@type invoice_settings() :: %{
  optional(:custom_fields) =&gt; [custom_fields()] | binary(),
  optional(:default_payment_method) =&gt; binary(),
  optional(:footer) =&gt; binary(),
  optional(:rendering_options) =&gt; rendering_options() | binary()
}
```

Default invoice settings for this customer.

# `rendering_options`

```elixir
@type rendering_options() :: %{
  optional(:amount_tax_display) =&gt; :exclude_tax | :include_inclusive_tax,
  optional(:template) =&gt; binary()
}
```

# `settings`

```elixir
@type settings() :: %{
  optional(:reconciliation_mode) =&gt; :automatic | :manual | :merchant_default
}
```

Settings controlling the behavior of the customer's cash balance,
such as reconciliation of funds received.

# `shipping`

```elixir
@type shipping() :: %{
  optional(:address) =&gt; address(),
  optional(:name) =&gt; binary(),
  optional(:phone) =&gt; binary()
}
```

# `t`

```elixir
@type t() :: %Stripe.Customer{
  address: term() | nil,
  balance: integer(),
  business_name: binary(),
  cash_balance: Stripe.CashBalance.t() | nil,
  created: integer(),
  currency: binary() | nil,
  default_source: (binary() | Stripe.PaymentSource.t()) | nil,
  delinquent: boolean() | nil,
  description: binary() | nil,
  discount: term() | nil,
  email: binary() | nil,
  id: binary(),
  individual_name: binary(),
  invoice_credit_balance: term(),
  invoice_prefix: binary() | nil,
  invoice_settings: term(),
  livemode: boolean(),
  metadata: term(),
  name: binary() | nil,
  next_invoice_sequence: integer(),
  object: binary(),
  phone: binary() | nil,
  preferred_locales: term() | nil,
  shipping: term() | nil,
  sources: term(),
  subscriptions: term(),
  tax: term(),
  tax_exempt: binary() | nil,
  tax_ids: term(),
  test_clock: (binary() | Stripe.TestHelpers.TestClock.t()) | nil
}
```

The `customer` type.

  * `address` The customer's address.
  * `balance` The current balance, if any, that's stored on the customer in their default currency. If negative, the customer has credit to apply to their next invoice. If positive, the customer has an amount owed that's added to their next invoice. The balance only considers amounts that Stripe hasn't successfully applied to any invoice. It doesn't reflect unpaid invoices. This balance is only taken into account after invoices finalize. For multi-currency balances, see [invoice_credit_balance](https://stripe.com/docs/api/customers/object#customer_object-invoice_credit_balance).
  * `business_name` The customer's business name.
  * `cash_balance` The current funds being held by Stripe on behalf of the customer. You can apply these funds towards payment intents when the source is "cash_balance". The `settings[reconciliation_mode]` field describes if these funds apply to these payment intents manually or automatically.
  * `created` Time at which the object was created. Measured in seconds since the Unix epoch.
  * `currency` Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) the customer can be charged in for recurring billing purposes.
  * `default_source` ID of the default payment source for the customer.

If you use payment methods created through the PaymentMethods API, see the [invoice_settings.default_payment_method](https://stripe.com/docs/api/customers/object#customer_object-invoice_settings-default_payment_method) field instead.
  * `delinquent` Tracks the most recent state change on any invoice belonging to the customer. Paying an invoice or marking it uncollectible via the API will set this field to false. An automatic payment failure or passing the `invoice.due_date` will set this field to `true`.

If an invoice becomes uncollectible by [dunning](https://stripe.com/docs/billing/automatic-collection), `delinquent` doesn't reset to `false`.

If you care whether the customer has paid their most recent subscription invoice, use `subscription.status` instead. Paying or marking uncollectible any customer invoice regardless of whether it is the latest invoice for a subscription will always set this field to `false`.
  * `description` An arbitrary string attached to the object. Often useful for displaying to users.
  * `discount` Describes the current discount active on the customer, if there is one.
  * `email` The customer's email address.
  * `id` Unique identifier for the object.
  * `individual_name` The customer's individual name.
  * `invoice_credit_balance` The current multi-currency balances, if any, that's stored on the customer. If positive in a currency, the customer has a credit to apply to their next invoice denominated in that currency. If negative, the customer has an amount owed that's added to their next invoice denominated in that currency. These balances don't apply to unpaid invoices. They solely track amounts that Stripe hasn't successfully applied to any invoice. Stripe only applies a balance in a specific currency to an invoice after that invoice (which is in the same currency) finalizes.
  * `invoice_prefix` The prefix for the customer used to generate unique invoice numbers.
  * `invoice_settings` 
  * `livemode` Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
  * `metadata` Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
  * `name` The customer's full name or business name.
  * `next_invoice_sequence` The suffix of the customer's next invoice number (for example, 0001). When the account uses account level sequencing, this parameter is ignored in API requests and the field omitted in API responses.
  * `object` String representing the object's type. Objects of the same type share the same value.
  * `phone` The customer's phone number.
  * `preferred_locales` The customer's preferred locales (languages), ordered by preference.
  * `shipping` Mailing and shipping address for the customer. Appears on invoices emailed to this customer.
  * `sources` The customer's payment sources, if any.
  * `subscriptions` The customer's current subscriptions, if any.
  * `tax` 
  * `tax_exempt` Describes the customer's tax exemption status, which is `none`, `exempt`, or `reverse`. When set to `reverse`, invoice and receipt PDFs include the following text: **"Reverse charge"**.
  * `tax_ids` The customer's tax IDs.
  * `test_clock` ID of the test clock that this customer belongs to.

# `tax`

```elixir
@type tax() :: %{
  optional(:ip_address) =&gt; binary() | binary(),
  optional(:validate_location) =&gt; :deferred | :immediately
}
```

Tax details about the customer.

# `tax_id_data`

```elixir
@type tax_id_data() :: %{
  optional(:type) =&gt;
    :ad_nrt
    | :ae_trn
    | :al_tin
    | :am_tin
    | :ao_tin
    | :ar_cuit
    | :au_abn
    | :au_arn
    | :aw_tin
    | :az_tin
    | :ba_tin
    | :bb_tin
    | :bd_bin
    | :bf_ifu
    | :bg_uic
    | :bh_vat
    | :bj_ifu
    | :bo_tin
    | :br_cnpj
    | :br_cpf
    | :bs_tin
    | :by_tin
    | :ca_bn
    | :ca_gst_hst
    | :ca_pst_bc
    | :ca_pst_mb
    | :ca_pst_sk
    | :ca_qst
    | :cd_nif
    | :ch_uid
    | :ch_vat
    | :cl_tin
    | :cm_niu
    | :cn_tin
    | :co_nit
    | :cr_tin
    | :cv_nif
    | :de_stn
    | :do_rcn
    | :ec_ruc
    | :eg_tin
    | :es_cif
    | :et_tin
    | :eu_oss_vat
    | :eu_vat
    | :gb_vat
    | :ge_vat
    | :gn_nif
    | :hk_br
    | :hr_oib
    | :hu_tin
    | :id_npwp
    | :il_vat
    | :in_gst
    | :is_vat
    | :jp_cn
    | :jp_rn
    | :jp_trn
    | :ke_pin
    | :kg_tin
    | :kh_tin
    | :kr_brn
    | :kz_bin
    | :la_tin
    | :li_uid
    | :li_vat
    | :ma_vat
    | :md_vat
    | :me_pib
    | :mk_vat
    | :mr_nif
    | :mx_rfc
    | :my_frp
    | :my_itn
    | :my_sst
    | :ng_tin
    | :no_vat
    | :no_voec
    | :np_pan
    | :nz_gst
    | :om_vat
    | :pe_ruc
    | :ph_tin
    | :ro_tin
    | :rs_pib
    | :ru_inn
    | :ru_kpp
    | :sa_vat
    | :sg_gst
    | :sg_uen
    | :si_tin
    | :sn_ninea
    | :sr_fin
    | :sv_nit
    | :th_vat
    | :tj_tin
    | :tr_tin
    | :tw_vat
    | :tz_vat
    | :ua_vat
    | :ug_tin
    | :us_ein
    | :uy_ruc
    | :uz_tin
    | :uz_vat
    | :ve_rif
    | :vn_tin
    | :za_vat
    | :zm_tin
    | :zw_tin,
  optional(:value) =&gt; binary()
}
```

# `balance_transactions`

```elixir
@spec balance_transactions(
  customer :: binary(),
  params :: %{
    optional(:created) =&gt; created() | integer(),
    optional(:ending_before) =&gt; binary(),
    optional(:expand) =&gt; [binary()],
    optional(:limit) =&gt; integer(),
    optional(:starting_after) =&gt; binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(Stripe.CustomerBalanceTransaction.t())}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}
```

<p>Returns a list of transactions that updated the customer’s <a href="/docs/billing/customer/balance">balances</a>.</p>

#### Details

 * Method: `get`
 * Path: `/v1/customers/{customer}/balance_transactions`

# `create`

```elixir
@spec create(
  params :: %{
    optional(:address) =&gt; address() | binary(),
    optional(:balance) =&gt; integer(),
    optional(:business_name) =&gt; binary() | binary(),
    optional(:cash_balance) =&gt; cash_balance(),
    optional(:description) =&gt; binary(),
    optional(:email) =&gt; binary(),
    optional(:expand) =&gt; [binary()],
    optional(:individual_name) =&gt; binary() | binary(),
    optional(:invoice_prefix) =&gt; binary(),
    optional(:invoice_settings) =&gt; invoice_settings(),
    optional(:metadata) =&gt; %{optional(binary()) =&gt; binary()} | binary(),
    optional(:name) =&gt; binary(),
    optional(:next_invoice_sequence) =&gt; integer(),
    optional(:payment_method) =&gt; binary(),
    optional(:phone) =&gt; binary(),
    optional(:preferred_locales) =&gt; [binary()],
    optional(:shipping) =&gt; shipping() | binary(),
    optional(:source) =&gt; binary(),
    optional(:tax) =&gt; tax(),
    optional(:tax_exempt) =&gt; :exempt | :none | :reverse,
    optional(:tax_id_data) =&gt; [tax_id_data()],
    optional(:test_clock) =&gt; binary(),
    optional(:validate) =&gt; boolean()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
```

<p>Creates a new customer object.</p>

#### Details

 * Method: `post`
 * Path: `/v1/customers`

# `create_funding_instructions`

```elixir
@spec create_funding_instructions(
  customer :: binary(),
  params :: %{
    optional(:bank_transfer) =&gt; bank_transfer(),
    optional(:currency) =&gt; binary(),
    optional(:expand) =&gt; [binary()],
    optional(:funding_type) =&gt; :bank_transfer
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.FundingInstructions.t()}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}
```

<p>Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
funding instructions will be created. If funding instructions have already been created for a given customer, the same
funding instructions will be retrieved. In other words, we will return the same funding instructions each time.</p>

#### Details

 * Method: `post`
 * Path: `/v1/customers/{customer}/funding_instructions`

# `delete`

```elixir
@spec delete(customer :: binary(), opts :: Keyword.t()) ::
  {:ok, Stripe.DeletedCustomer.t()}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}
```

<p>Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer.</p>

#### Details

 * Method: `delete`
 * Path: `/v1/customers/{customer}`

# `delete_discount`

```elixir
@spec delete_discount(customer :: binary(), opts :: Keyword.t()) ::
  {:ok, Stripe.DeletedDiscount.t()}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}
```

<p>Removes the currently applied discount on a customer.</p>

#### Details

 * Method: `delete`
 * Path: `/v1/customers/{customer}/discount`

# `fund_cash_balance`

```elixir
@spec fund_cash_balance(
  customer :: binary(),
  params :: %{
    optional(:amount) =&gt; integer(),
    optional(:currency) =&gt; binary(),
    optional(:expand) =&gt; [binary()],
    optional(:reference) =&gt; binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.CustomerCashBalanceTransaction.t()}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}
```

<p>Create an incoming testmode bank transfer</p>

#### Details

 * Method: `post`
 * Path: `/v1/test_helpers/customers/{customer}/fund_cash_balance`

# `list`

```elixir
@spec list(
  params :: %{
    optional(:created) =&gt; created() | integer(),
    optional(:email) =&gt; binary(),
    optional(:ending_before) =&gt; binary(),
    optional(:expand) =&gt; [binary()],
    optional(:limit) =&gt; integer(),
    optional(:starting_after) =&gt; binary(),
    optional(:test_clock) =&gt; binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
```

<p>Returns a list of your customers. The customers are returned sorted by creation date, with the most recent customers appearing first.</p>

#### Details

 * Method: `get`
 * Path: `/v1/customers`

# `list_payment_methods`

```elixir
@spec list_payment_methods(
  customer :: binary(),
  params :: %{
    optional(:allow_redisplay) =&gt; :always | :limited | :unspecified,
    optional(:ending_before) =&gt; binary(),
    optional(:expand) =&gt; [binary()],
    optional(:limit) =&gt; integer(),
    optional(:starting_after) =&gt; binary(),
    optional(:type) =&gt;
      :acss_debit
      | :affirm
      | :afterpay_clearpay
      | :alipay
      | :alma
      | :amazon_pay
      | :au_becs_debit
      | :bacs_debit
      | :bancontact
      | :billie
      | :blik
      | :boleto
      | :card
      | :cashapp
      | :crypto
      | :custom
      | :customer_balance
      | :eps
      | :fpx
      | :giropay
      | :grabpay
      | :ideal
      | :kakao_pay
      | :klarna
      | :konbini
      | :kr_card
      | :link
      | :mb_way
      | :mobilepay
      | :multibanco
      | :naver_pay
      | :nz_bank_account
      | :oxxo
      | :p24
      | :pay_by_bank
      | :payco
      | :paynow
      | :paypal
      | :pix
      | :promptpay
      | :revolut_pay
      | :samsung_pay
      | :satispay
      | :sepa_debit
      | :sofort
      | :swish
      | :twint
      | :us_bank_account
      | :wechat_pay
      | :zip
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(Stripe.PaymentMethod.t())}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}
```

<p>Returns a list of PaymentMethods for a given Customer</p>

#### Details

 * Method: `get`
 * Path: `/v1/customers/{customer}/payment_methods`

# `retrieve`

```elixir
@spec retrieve(
  customer :: binary(),
  params :: %{optional(:expand) =&gt; [binary()]},
  opts :: Keyword.t()
) ::
  {:ok, t() | Stripe.DeletedCustomer.t()}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}
```

<p>Retrieves a Customer object.</p>

#### Details

 * Method: `get`
 * Path: `/v1/customers/{customer}`

# `retrieve_payment_method`

```elixir
@spec retrieve_payment_method(
  customer :: binary(),
  payment_method :: binary(),
  params :: %{optional(:expand) =&gt; [binary()]},
  opts :: Keyword.t()
) ::
  {:ok, Stripe.PaymentMethod.t()}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}
```

<p>Retrieves a PaymentMethod object for a given Customer.</p>

#### Details

 * Method: `get`
 * Path: `/v1/customers/{customer}/payment_methods/{payment_method}`

# `search`

```elixir
@spec search(
  params :: %{
    optional(:expand) =&gt; [binary()],
    optional(:limit) =&gt; integer(),
    optional(:page) =&gt; binary(),
    optional(:query) =&gt; binary()
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.SearchResult.t(t())}
  | {:error, Stripe.ApiErrors.t()}
  | {:error, term()}
```

<p>Search for customers you’ve previously created using Stripe’s <a href="/docs/search#search-query-language">Search Query Language</a>.
Don’t use search in read-after-write flows where strict consistency is necessary. Under normal operating
conditions, data is searchable in less than a minute. Occasionally, propagation of new or updated data can be up
to an hour behind during outages. Search functionality is not available to merchants in India.</p>

#### Details

 * Method: `get`
 * Path: `/v1/customers/search`

# `update`

```elixir
@spec update(
  customer :: binary(),
  params :: %{
    optional(:address) =&gt; address() | binary(),
    optional(:balance) =&gt; integer(),
    optional(:business_name) =&gt; binary() | binary(),
    optional(:cash_balance) =&gt; cash_balance(),
    optional(:default_source) =&gt; binary(),
    optional(:description) =&gt; binary(),
    optional(:email) =&gt; binary(),
    optional(:expand) =&gt; [binary()],
    optional(:individual_name) =&gt; binary() | binary(),
    optional(:invoice_prefix) =&gt; binary(),
    optional(:invoice_settings) =&gt; invoice_settings(),
    optional(:metadata) =&gt; %{optional(binary()) =&gt; binary()} | binary(),
    optional(:name) =&gt; binary(),
    optional(:next_invoice_sequence) =&gt; integer(),
    optional(:phone) =&gt; binary(),
    optional(:preferred_locales) =&gt; [binary()],
    optional(:shipping) =&gt; shipping() | binary(),
    optional(:source) =&gt; binary(),
    optional(:tax) =&gt; tax(),
    optional(:tax_exempt) =&gt; :exempt | :none | :reverse,
    optional(:validate) =&gt; boolean()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
```

<p>Updates the specified customer by setting the values of the parameters passed. Any parameters not provided will be left unchanged. For example, if you pass the <strong>source</strong> parameter, that becomes the customer’s active source (e.g., a card) to be used for all charges in the future. When you update a customer to a new valid card source by passing the <strong>source</strong> parameter: for each of the customer’s current subscriptions, if the subscription bills automatically and is in the <code>past_due</code> state, then the latest open invoice for the subscription with automatic collection enabled will be retried. This retry will not count as an automatic retry, and will not affect the next regularly scheduled payment for the invoice. Changing the <strong>default_source</strong> for a customer will not trigger this behavior.</p>

<p>This request accepts mostly the same arguments as the customer creation call.</p>

#### Details

 * Method: `post`
 * Path: `/v1/customers/{customer}`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
