A payment method a customer saved at the provider (pm_... at Stripe), such as a card, so a
later invoice or subscription charges it without the buyer typing it again. A guarded_struct
the provider fills in.
A checkout in mode: :setup saves one (MishkaPay.Checkout). Read with
MishkaPay.fetch_payment_method/3 and MishkaPay.list_payment_methods/3, made the customer's
default with MishkaPay.set_default_payment_method/4, and taken off the customer with
MishkaPay.detach_payment_method/3.
:provider: which provider keeps it.:id: the provider's id of the payment method.:customer_id: the customer it is saved on;nilonce it is taken off.:type: the provider's kind of payment method, such as"card"or"sepa_debit".:card_brand,:card_last4,:card_exp_month,:card_exp_year: for a card, its brand ("visa"), its last four digits and when it expires;nilfor other kinds.:created_at: when it was saved.
Summary
Functions
A sample %MishkaPay.Customer.PaymentMethod{} populated from defaults + type-based fallbacks.
Types
@type t() :: %MishkaPay.Customer.PaymentMethod{ card_brand: String.t() | nil, card_exp_month: pos_integer() | nil, card_exp_year: pos_integer() | nil, card_last4: String.t() | nil, created_at: DateTime.t() | nil, customer_id: String.t() | nil, id: String.t() | nil, provider: String.t() | nil, type: String.t() | nil }
The struct that builder/1 returns.
| Field | Type | Required | Default | Description | Derives |
|---|---|---|---|---|---|
:provider | String.t() | nil | no | validate(string, not_empty) | ||
:id | String.t() | nil | no | validate(string, not_empty) | ||
:customer_id | String.t() | nil | no | validate(string) | ||
:type | String.t() | nil | no | validate(string) | ||
:card_brand | String.t() | nil | no | validate(string) | ||
:card_last4 | String.t() | nil | no | validate(string) | ||
:card_exp_month | pos_integer() | nil | no | validate(integer) | ||
:card_exp_year | pos_integer() | nil | no | validate(integer) | ||
:created_at | DateTime.t() | nil | no | validate(struct) |