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

PaymentMethod objects represent your customer's payment instruments.
You can use them with [PaymentIntents](https://stripe.com/docs/payments/payment-intents) to collect payments or save them to
Customer objects to store instrument details for future payments.

Related guides: [Payment Methods](https://stripe.com/docs/payments/payment-methods) and [More Payment Scenarios](https://stripe.com/docs/payments/more-payment-scenarios).

# `acss_debit`

```elixir
@type acss_debit() :: %{
  optional(:account_number) =&gt; binary(),
  optional(:institution_number) =&gt; binary(),
  optional(:transit_number) =&gt; binary()
}
```

If this is an `acss_debit` PaymentMethod, this hash contains details about the ACSS Debit payment method.

# `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()
}
```

# `au_becs_debit`

```elixir
@type au_becs_debit() :: %{
  optional(:account_number) =&gt; binary(),
  optional(:bsb_number) =&gt; binary()
}
```

If this is an `au_becs_debit` PaymentMethod, this hash contains details about the bank account.

# `bacs_debit`

```elixir
@type bacs_debit() :: %{
  optional(:account_number) =&gt; binary(),
  optional(:sort_code) =&gt; binary()
}
```

If this is a `bacs_debit` PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.

# `billing_details`

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

Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.

# `boleto`

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

If this is a `boleto` PaymentMethod, this hash contains details about the Boleto payment method.

# `card`

```elixir
@type card() :: %{
  optional(:cvc) =&gt; binary(),
  optional(:exp_month) =&gt; integer(),
  optional(:exp_year) =&gt; integer(),
  optional(:networks) =&gt; networks(),
  optional(:number) =&gt; binary()
}
```

# `custom`

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

If this is a `custom` PaymentMethod, this hash contains details about the Custom payment method.

# `dob`

```elixir
@type dob() :: %{
  optional(:day) =&gt; integer(),
  optional(:month) =&gt; integer(),
  optional(:year) =&gt; integer()
}
```

Customer's date of birth

# `eps`

```elixir
@type eps() :: %{
  optional(:bank) =&gt;
    :arzte_und_apotheker_bank
    | :austrian_anadi_bank_ag
    | :bank_austria
    | :bankhaus_carl_spangler
    | :bankhaus_schelhammer_und_schattera_ag
    | :bawag_psk_ag
    | :bks_bank_ag
    | :brull_kallmus_bank_ag
    | :btv_vier_lander_bank
    | :capital_bank_grawe_gruppe_ag
    | :deutsche_bank_ag
    | :dolomitenbank
    | :easybank_ag
    | :erste_bank_und_sparkassen
    | :hypo_alpeadriabank_international_ag
    | :hypo_bank_burgenland_aktiengesellschaft
    | :hypo_noe_lb_fur_niederosterreich_u_wien
    | :hypo_oberosterreich_salzburg_steiermark
    | :hypo_tirol_bank_ag
    | :hypo_vorarlberg_bank_ag
    | :marchfelder_bank
    | :oberbank_ag
    | :raiffeisen_bankengruppe_osterreich
    | :schoellerbank_ag
    | :sparda_bank_wien
    | :volksbank_gruppe
    | :volkskreditbank_ag
    | :vr_bank_braunau
}
```

If this is an `eps` PaymentMethod, this hash contains details about the EPS payment method.

# `fpx`

```elixir
@type fpx() :: %{
  optional(:account_holder_type) =&gt; :company | :individual,
  optional(:bank) =&gt;
    :affin_bank
    | :agrobank
    | :alliance_bank
    | :ambank
    | :bank_islam
    | :bank_muamalat
    | :bank_of_china
    | :bank_rakyat
    | :bsn
    | :cimb
    | :deutsche_bank
    | :hong_leong_bank
    | :hsbc
    | :kfh
    | :maybank2e
    | :maybank2u
    | :ocbc
    | :pb_enterprise
    | :public_bank
    | :rhb
    | :standard_chartered
    | :uob
}
```

If this is an `fpx` PaymentMethod, this hash contains details about the FPX payment method.

# `ideal`

```elixir
@type ideal() :: %{
  optional(:bank) =&gt;
    :abn_amro
    | :asn_bank
    | :bunq
    | :buut
    | :finom
    | :handelsbanken
    | :ing
    | :knab
    | :moneyou
    | :n26
    | :nn
    | :rabobank
    | :regiobank
    | :revolut
    | :sns_bank
    | :triodos_bank
    | :van_lanschot
    | :yoursafe
}
```

If this is an `ideal` PaymentMethod, this hash contains details about the iDEAL payment method.

# `klarna`

```elixir
@type klarna() :: %{optional(:dob) =&gt; dob()}
```

If this is a `klarna` PaymentMethod, this hash contains details about the Klarna payment method.

# `naver_pay`

```elixir
@type naver_pay() :: %{optional(:funding) =&gt; :card | :points}
```

If this is a `naver_pay` PaymentMethod, this hash contains details about the Naver Pay payment method.

# `networks`

```elixir
@type networks() :: %{optional(:preferred) =&gt; :cartes_bancaires | :mastercard | :visa}
```

Contains information about card networks used to process the payment.

# `nz_bank_account`

```elixir
@type nz_bank_account() :: %{
  optional(:account_holder_name) =&gt; binary(),
  optional(:account_number) =&gt; binary(),
  optional(:bank_code) =&gt; binary(),
  optional(:branch_code) =&gt; binary(),
  optional(:reference) =&gt; binary(),
  optional(:suffix) =&gt; binary()
}
```

If this is an nz_bank_account PaymentMethod, this hash contains details about the nz_bank_account payment method.

# `p24`

```elixir
@type p24() :: %{
  optional(:bank) =&gt;
    :alior_bank
    | :bank_millennium
    | :bank_nowy_bfg_sa
    | :bank_pekao_sa
    | :banki_spbdzielcze
    | :blik
    | :bnp_paribas
    | :boz
    | :citi_handlowy
    | :credit_agricole
    | :envelobank
    | :etransfer_pocztowy24
    | :getin_bank
    | :ideabank
    | :ing
    | :inteligo
    | :mbank_mtransfer
    | :nest_przelew
    | :noble_pay
    | :pbac_z_ipko
    | :plus_bank
    | :santander_przelew24
    | :tmobile_usbugi_bankowe
    | :toyota_bank
    | :velobank
    | :volkswagen_bank
}
```

If this is a `p24` PaymentMethod, this hash contains details about the P24 payment method.

# `radar_options`

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

Options to configure Radar. See [Radar Session](https://stripe.com/docs/radar/radar-session) for more information.

# `sepa_debit`

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

If this is a `sepa_debit` PaymentMethod, this hash contains details about the SEPA debit bank account.

# `sofort`

```elixir
@type sofort() :: %{optional(:country) =&gt; :AT | :BE | :DE | :ES | :IT | :NL}
```

If this is a `sofort` PaymentMethod, this hash contains details about the SOFORT payment method.

# `t`

```elixir
@type t() :: %Stripe.PaymentMethod{
  acss_debit: term(),
  affirm: term(),
  afterpay_clearpay: term(),
  alipay: term(),
  allow_redisplay: binary(),
  alma: term(),
  amazon_pay: term(),
  au_becs_debit: term(),
  bacs_debit: term(),
  bancontact: term(),
  billie: term(),
  billing_details: term(),
  blik: term(),
  boleto: term(),
  card: term(),
  card_present: term(),
  cashapp: term(),
  created: integer(),
  crypto: term(),
  custom: term(),
  customer: (binary() | Stripe.Customer.t()) | nil,
  customer_balance: term(),
  eps: term(),
  fpx: term(),
  giropay: term(),
  grabpay: term(),
  id: binary(),
  ideal: term(),
  interac_present: term(),
  kakao_pay: term(),
  klarna: term(),
  konbini: term(),
  kr_card: term(),
  link: term(),
  livemode: boolean(),
  mb_way: term(),
  metadata: term() | nil,
  mobilepay: term(),
  multibanco: term(),
  naver_pay: term(),
  nz_bank_account: term(),
  object: binary(),
  oxxo: term(),
  p24: term(),
  pay_by_bank: term(),
  payco: term(),
  paynow: term(),
  paypal: term(),
  pix: term(),
  promptpay: term(),
  radar_options: term(),
  revolut_pay: term(),
  samsung_pay: term(),
  satispay: term(),
  sepa_debit: term(),
  sofort: term(),
  swish: term(),
  twint: term(),
  type: binary(),
  us_bank_account: term(),
  wechat_pay: term(),
  zip: term()
}
```

The `payment_method` type.

  * `acss_debit` 
  * `affirm` 
  * `afterpay_clearpay` 
  * `alipay` 
  * `allow_redisplay` This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to “unspecified”.
  * `alma` 
  * `amazon_pay` 
  * `au_becs_debit` 
  * `bacs_debit` 
  * `bancontact` 
  * `billie` 
  * `billing_details` 
  * `blik` 
  * `boleto` 
  * `card` 
  * `card_present` 
  * `cashapp` 
  * `created` Time at which the object was created. Measured in seconds since the Unix epoch.
  * `crypto` 
  * `custom` 
  * `customer` The ID of the Customer to which this PaymentMethod is saved. This will not be set when the PaymentMethod has not been saved to a Customer.
  * `customer_balance` 
  * `eps` 
  * `fpx` 
  * `giropay` 
  * `grabpay` 
  * `id` Unique identifier for the object.
  * `ideal` 
  * `interac_present` 
  * `kakao_pay` 
  * `klarna` 
  * `konbini` 
  * `kr_card` 
  * `link` 
  * `livemode` Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
  * `mb_way` 
  * `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.
  * `mobilepay` 
  * `multibanco` 
  * `naver_pay` 
  * `nz_bank_account` 
  * `object` String representing the object's type. Objects of the same type share the same value.
  * `oxxo` 
  * `p24` 
  * `pay_by_bank` 
  * `payco` 
  * `paynow` 
  * `paypal` 
  * `pix` 
  * `promptpay` 
  * `radar_options` 
  * `revolut_pay` 
  * `samsung_pay` 
  * `satispay` 
  * `sepa_debit` 
  * `sofort` 
  * `swish` 
  * `twint` 
  * `type` The type of the PaymentMethod. An additional hash is included on the PaymentMethod with a name matching this value. It contains additional information specific to the PaymentMethod type.
  * `us_bank_account` 
  * `wechat_pay` 
  * `zip` 

# `us_bank_account`

```elixir
@type us_bank_account() :: %{
  optional(:account_holder_type) =&gt; :company | :individual,
  optional(:account_number) =&gt; binary(),
  optional(:account_type) =&gt; :checking | :savings,
  optional(:financial_connections_account) =&gt; binary(),
  optional(:routing_number) =&gt; binary()
}
```

If this is an `us_bank_account` PaymentMethod, this hash contains details about the US bank account payment method.

# `attach`

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

<p>Attaches a PaymentMethod object to a Customer.</p>

<p>To attach a new PaymentMethod to a customer for future payments, we recommend you use a <a href="/docs/api/setup_intents">SetupIntent</a>
or a PaymentIntent with <a href="/docs/api/payment_intents/create#create_payment_intent-setup_future_usage">setup_future_usage</a>.
These approaches will perform any necessary steps to set up the PaymentMethod for future payments. Using the <code>/v1/payment_methods/:id/attach</code>
endpoint without first using a SetupIntent or PaymentIntent with <code>setup_future_usage</code> does not optimize the PaymentMethod for
future use, which makes later declines and payment friction more likely.
See <a href="/docs/payments/payment-intents#future-usage">Optimizing cards for future payments</a> for more information about setting up
future payments.</p>

<p>To use this PaymentMethod as the default for invoice or subscription payments,
set <a href="/docs/api/customers/update#update_customer-invoice_settings-default_payment_method"><code>invoice_settings.default_payment_method</code></a>,
on the Customer to the PaymentMethod’s ID.</p>

#### Details

 * Method: `post`
 * Path: `/v1/payment_methods/{payment_method}/attach`

# `create`

```elixir
@spec create(
  params :: %{
    optional(:sofort) =&gt; sofort(),
    optional(:customer_balance) =&gt; map(),
    optional(:satispay) =&gt; map(),
    optional(:boleto) =&gt; boleto(),
    optional(:alipay) =&gt; map(),
    optional(:au_becs_debit) =&gt; au_becs_debit(),
    optional(:amazon_pay) =&gt; map(),
    optional(:metadata) =&gt; %{optional(binary()) =&gt; binary()},
    optional(:bancontact) =&gt; map(),
    optional(:interac_present) =&gt; map(),
    optional(:bacs_debit) =&gt; bacs_debit(),
    optional(:affirm) =&gt; map(),
    optional(:billing_details) =&gt; billing_details(),
    optional(:mobilepay) =&gt; map(),
    optional(:pay_by_bank) =&gt; map(),
    optional(:nz_bank_account) =&gt; nz_bank_account(),
    optional(:grabpay) =&gt; map(),
    optional(:eps) =&gt; eps(),
    optional(:billie) =&gt; map(),
    optional(:ideal) =&gt; ideal(),
    optional(:pix) =&gt; map(),
    optional(:giropay) =&gt; map(),
    optional(:multibanco) =&gt; map(),
    optional(:revolut_pay) =&gt; map(),
    optional(:klarna) =&gt; klarna(),
    optional(:card) =&gt; card() | card(),
    optional(:mb_way) =&gt; map(),
    optional(:twint) =&gt; map(),
    optional(:naver_pay) =&gt; naver_pay(),
    optional(:crypto) =&gt; map(),
    optional(:acss_debit) =&gt; acss_debit(),
    optional(:link) =&gt; map(),
    optional(:kr_card) =&gt; map(),
    optional(:konbini) =&gt; map(),
    optional(:blik) =&gt; map(),
    optional(:p24) =&gt; p24(),
    optional(:paypal) =&gt; map(),
    optional(:custom) =&gt; custom(),
    optional(:fpx) =&gt; fpx(),
    optional(:payment_method) =&gt; binary(),
    optional(:oxxo) =&gt; map(),
    optional(:paynow) =&gt; map(),
    optional(:alma) =&gt; map(),
    optional(:wechat_pay) =&gt; map(),
    optional(:promptpay) =&gt; map(),
    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,
    optional(:samsung_pay) =&gt; map(),
    optional(:customer) =&gt; binary(),
    optional(:kakao_pay) =&gt; map(),
    optional(:expand) =&gt; [binary()],
    optional(:radar_options) =&gt; radar_options(),
    optional(:cashapp) =&gt; map(),
    optional(:sepa_debit) =&gt; sepa_debit(),
    optional(:afterpay_clearpay) =&gt; map(),
    optional(:payco) =&gt; map(),
    optional(:allow_redisplay) =&gt; :always | :limited | :unspecified,
    optional(:us_bank_account) =&gt; us_bank_account(),
    optional(:swish) =&gt; map(),
    optional(:zip) =&gt; map()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
```

<p>Creates a PaymentMethod object. Read the <a href="/docs/stripe-js/reference#stripe-create-payment-method">Stripe.js reference</a> to learn how to create PaymentMethods via Stripe.js.</p>

<p>Instead of creating a PaymentMethod directly, we recommend using the <a href="/docs/payments/accept-a-payment">PaymentIntents</a> API to accept a payment immediately or the <a href="/docs/payments/save-and-reuse">SetupIntent</a> API to collect payment method details ahead of a future payment.</p>

#### Details

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

# `detach`

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

<p>Detaches a PaymentMethod object from a Customer. After a PaymentMethod is detached, it can no longer be used for a payment or re-attached to a Customer.</p>

#### Details

 * Method: `post`
 * Path: `/v1/payment_methods/{payment_method}/detach`

# `list`

```elixir
@spec list(
  params :: %{
    optional(:customer) =&gt; binary(),
    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(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
```

<p>Returns a list of PaymentMethods for Treasury flows. If you want to list the PaymentMethods attached to a Customer for payments, you should use the <a href="/docs/api/payment_methods/customer_list">List a Customer’s PaymentMethods</a> API instead.</p>

#### Details

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

# `retrieve`

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

<p>Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method attached to a Customer, you should use <a href="/docs/api/payment_methods/customer">Retrieve a Customer’s PaymentMethods</a></p>

#### Details

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

# `update`

```elixir
@spec update(
  payment_method :: binary(),
  params :: %{
    optional(:allow_redisplay) =&gt; :always | :limited | :unspecified,
    optional(:billing_details) =&gt; billing_details(),
    optional(:card) =&gt; card(),
    optional(:expand) =&gt; [binary()],
    optional(:metadata) =&gt; %{optional(binary()) =&gt; binary()} | binary(),
    optional(:us_bank_account) =&gt; us_bank_account()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
```

<p>Updates a PaymentMethod object. A PaymentMethod must be attached to a customer to be updated.</p>

#### Details

 * Method: `post`
 * Path: `/v1/payment_methods/{payment_method}`

---

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