View Source Stripe.PaymentMethod (stripity_stripe v3.2.0)
PaymentMethod objects represent your customer's payment instruments. You can use them with PaymentIntents to collect payments or save them to Customer objects to store instrument details for future payments.
Related guides: Payment Methods and More Payment Scenarios.
Summary
Types
If this is an acss_debit
PaymentMethod, this hash contains details about the ACSS Debit payment method.
If this is an au_becs_debit
PaymentMethod, this hash contains details about the bank account.
If this is a bacs_debit
PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.
Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
If this is a boleto
PaymentMethod, this hash contains details about the Boleto payment method.
Customer's date of birth
If this is an eps
PaymentMethod, this hash contains details about the EPS payment method.
If this is an fpx
PaymentMethod, this hash contains details about the FPX payment method.
If this is an ideal
PaymentMethod, this hash contains details about the iDEAL payment method.
If this is a klarna
PaymentMethod, this hash contains details about the Klarna payment method.
If this is a p24
PaymentMethod, this hash contains details about the P24 payment method.
Options to configure Radar. See Radar Session for more information.
If this is a sepa_debit
PaymentMethod, this hash contains details about the SEPA debit bank account.
If this is a sofort
PaymentMethod, this hash contains details about the SOFORT payment method.
The payment_method
type.
If this is an us_bank_account
PaymentMethod, this hash contains details about the US bank account payment method.
Functions
Attaches a PaymentMethod object to a Customer.
Creates a PaymentMethod object. Read the Stripe.js reference to learn how to create PaymentMethods via Stripe.js.
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.
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 List a Customer’s PaymentMethods API instead.
Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method attached to a Customer, you should use Retrieve a Customer’s PaymentMethods
Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated.
Types
@type acss_debit() :: %{ optional(:account_number) => binary(), optional(:institution_number) => binary(), optional(:transit_number) => binary() }
If this is an acss_debit
PaymentMethod, this hash contains details about the ACSS Debit payment method.
@type au_becs_debit() :: %{ optional(:account_number) => binary(), optional(:bsb_number) => binary() }
If this is an au_becs_debit
PaymentMethod, this hash contains details about the bank account.
If this is a bacs_debit
PaymentMethod, this hash contains details about the Bacs Direct Debit bank account.
@type billing_details() :: %{ optional(:address) => address() | binary(), optional(:email) => binary() | binary(), optional(:name) => binary() | binary(), optional(:phone) => binary() | binary() }
Billing information associated with the PaymentMethod that may be used or required by particular types of payment methods.
@type boleto() :: %{optional(:tax_id) => binary()}
If this is a boleto
PaymentMethod, this hash contains details about the Boleto payment method.
@type dob() :: %{ optional(:day) => integer(), optional(:month) => integer(), optional(:year) => integer() }
Customer's date of birth
@type eps() :: %{
optional(:bank) =>
: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.
@type fpx() :: %{
optional(:account_holder_type) => :company | :individual,
optional(:bank) =>
: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.
@type ideal() :: %{
optional(:bank) =>
:abn_amro
| :asn_bank
| :bunq
| :handelsbanken
| :ing
| :knab
| :moneyou
| :n26
| :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.
@type klarna() :: %{optional(:dob) => dob()}
If this is a klarna
PaymentMethod, this hash contains details about the Klarna payment method.
@type p24() :: %{
optional(:bank) =>
: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
| :volkswagen_bank
}
If this is a p24
PaymentMethod, this hash contains details about the P24 payment method.
@type radar_options() :: %{optional(:session) => binary()}
Options to configure Radar. See Radar Session for more information.
@type sepa_debit() :: %{optional(:iban) => binary()}
If this is a sepa_debit
PaymentMethod, this hash contains details about the SEPA debit bank account.
@type sofort() :: %{optional(:country) => :AT | :BE | :DE | :ES | :IT | :NL}
If this is a sofort
PaymentMethod, this hash contains details about the SOFORT payment method.
@type t() :: %Stripe.PaymentMethod{ acss_debit: term(), affirm: term(), afterpay_clearpay: term(), alipay: term(), au_becs_debit: term(), bacs_debit: term(), bancontact: term(), billing_details: term(), blik: term(), boleto: term(), card: term(), card_present: term(), cashapp: term(), created: integer(), customer: (binary() | Stripe.Customer.t()) | nil, customer_balance: term(), eps: term(), fpx: term(), giropay: term(), grabpay: term(), id: binary(), ideal: term(), interac_present: term(), klarna: term(), konbini: term(), link: term(), livemode: boolean(), metadata: term() | nil, object: binary(), oxxo: term(), p24: term(), paynow: term(), paypal: term(), pix: term(), promptpay: term(), radar_options: term(), revolut_pay: term(), sepa_debit: term(), sofort: term(), type: binary(), us_bank_account: term(), wechat_pay: term(), zip: term() }
The payment_method
type.
acss_debit
affirm
afterpay_clearpay
alipay
au_becs_debit
bacs_debit
bancontact
billing_details
blik
boleto
card
card_present
cashapp
created
Time at which the object was created. Measured in seconds since the Unix epoch.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
klarna
konbini
link
livemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.metadata
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.object
String representing the object's type. Objects of the same type share the same value.oxxo
p24
paynow
paypal
pix
promptpay
radar_options
revolut_pay
sepa_debit
sofort
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
@type us_bank_account() :: %{ optional(:account_holder_type) => :company | :individual, optional(:account_number) => binary(), optional(:account_type) => :checking | :savings, optional(:financial_connections_account) => binary(), optional(:routing_number) => binary() }
If this is an us_bank_account
PaymentMethod, this hash contains details about the US bank account payment method.
Functions
@spec attach( payment_method :: binary(), params :: %{optional(:customer) => binary(), optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Attaches a PaymentMethod object to a Customer.
To attach a new PaymentMethod to a customer for future payments, we recommend you use a SetupIntentor a PaymentIntent with setup_future_usage.
These approaches will perform any necessary steps to set up the PaymentMethod for future payments. Using the /v1/payment_methods/:id/attach
endpoint without first using a SetupIntent or PaymentIntent with setup_future_usage
does not optimize the PaymentMethod for
future use, which makes later declines and payment friction more likely.
See Optimizing cards for future payments for more information about setting up
future payments.
To use this PaymentMethod as the default for invoice or subscription payments,set invoice_settings.default_payment_method
,
on the Customer to the PaymentMethod’s ID.
@spec create( params :: %{ optional(:pix) => map(), optional(:payment_method) => binary(), optional(:fpx) => fpx(), optional(:affirm) => map(), optional(:acss_debit) => acss_debit(), optional(:bacs_debit) => bacs_debit(), optional(:alipay) => map(), optional(:giropay) => map(), optional(:ideal) => ideal(), optional(:revolut_pay) => map(), optional(:expand) => [binary()], optional(:card) => card() | card(), optional(:radar_options) => radar_options(), optional(:metadata) => %{optional(binary()) => binary()}, optional(:link) => map(), optional(:promptpay) => map(), optional(:cashapp) => map(), optional(:oxxo) => map(), optional(:interac_present) => map(), optional(:customer) => binary(), optional(:us_bank_account) => us_bank_account(), optional(:zip) => map(), optional(:paypal) => map(), optional(:boleto) => boleto(), optional(:konbini) => map(), optional(:billing_details) => billing_details(), optional(:blik) => map(), optional(:wechat_pay) => map(), optional(:sofort) => sofort(), optional(:p24) => p24(), optional(:afterpay_clearpay) => map(), optional(:type) => :acss_debit | :affirm | :afterpay_clearpay | :alipay | :au_becs_debit | :bacs_debit | :bancontact | :blik | :boleto | :card | :cashapp | :customer_balance | :eps | :fpx | :giropay | :grabpay | :ideal | :klarna | :konbini | :link | :oxxo | :p24 | :paynow | :paypal | :pix | :promptpay | :revolut_pay | :sepa_debit | :sofort | :us_bank_account | :wechat_pay | :zip, optional(:grabpay) => map(), optional(:bancontact) => map(), optional(:au_becs_debit) => au_becs_debit(), optional(:customer_balance) => map(), optional(:sepa_debit) => sepa_debit(), optional(:klarna) => klarna(), optional(:paynow) => map(), optional(:eps) => eps() }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Creates a PaymentMethod object. Read the Stripe.js reference to learn how to create PaymentMethods via Stripe.js.
Instead of creating a PaymentMethod directly, we recommend using the PaymentIntents API to accept a payment immediately or the SetupIntent API to collect payment method details ahead of a future payment.
Details
- Method:
post
- Path:
/v1/payment_methods
@spec detach( payment_method :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
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.
Details
- Method:
post
- Path:
/v1/payment_methods/{payment_method}/detach
@spec list( params :: %{ optional(:customer) => binary(), optional(:ending_before) => binary(), optional(:expand) => [binary()], optional(:limit) => integer(), optional(:starting_after) => binary(), optional(:type) => :acss_debit | :affirm | :afterpay_clearpay | :alipay | :au_becs_debit | :bacs_debit | :bancontact | :blik | :boleto | :card | :cashapp | :customer_balance | :eps | :fpx | :giropay | :grabpay | :ideal | :klarna | :konbini | :link | :oxxo | :p24 | :paynow | :paypal | :pix | :promptpay | :revolut_pay | :sepa_debit | :sofort | :us_bank_account | :wechat_pay | :zip }, opts :: Keyword.t() ) :: {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
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 List a Customer’s PaymentMethods API instead.
Details
- Method:
get
- Path:
/v1/payment_methods
@spec retrieve( payment_method :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieves a PaymentMethod object attached to the StripeAccount. To retrieve a payment method attached to a Customer, you should use Retrieve a Customer’s PaymentMethods
Details
- Method:
get
- Path:
/v1/payment_methods/{payment_method}
@spec update( payment_method :: binary(), params :: %{ optional(:billing_details) => billing_details(), optional(:card) => card(), optional(:expand) => [binary()], optional(:link) => map(), optional(:metadata) => %{optional(binary()) => binary()} | binary(), optional(:us_bank_account) => us_bank_account() }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Updates a PaymentMethod object. A PaymentMethod must be attached a customer to be updated.
Details
- Method:
post
- Path:
/v1/payment_methods/{payment_method}