Stripe.PaymentMethod (stripity_stripe v2.17.3) View Source

Work with Stripe payment method objects.

Stripe API reference: https://stripe.com/docs/api/payment_methods

Link to this section Summary

Functions

Attach payment_method to customer

Create a payment method.

Detach payment_method from customer

List all payment methods.

Retrieve a payment method.

Link to this section Types

Specs

acss_debit() :: %{
  bank_name: String.t() | nil,
  fingerprint: String.t() | nil,
  institution_number: String.t() | nil,
  last4: String.t() | nil,
  transit_number: String.t() | nil
}

Specs

au_becs_debit() :: %{
  bsb_number: String.t(),
  fingerprint: String.t(),
  last4: String.t()
}

Specs

bacs_debit() :: %{
  fingerprint: String.t() | nil,
  last4: String.t() | nil,
  sort_code: String.t() | nil
}

Specs

billing_details() :: %{
  optional(:address) => Stripe.Types.address(),
  optional(:email) => String.t(),
  optional(:name) => String.t(),
  optional(:phone) => String.t()
}

Specs

card() :: %{
  exp_month: integer(),
  exp_year: integer(),
  number: String.t(),
  cvc: String.t()
}

Specs

sepa_debit() :: %{
  bank_code: String.t() | nil,
  branch_code: String.t() | nil,
  country: String.t() | nil,
  fingerprint: String.t() | nil,
  last4: String.t() | nil
}

Specs

t() :: %Stripe.PaymentMethod{
  acss_debit: acss_debit() | nil,
  au_becs_debit: au_becs_debit() | nil,
  bacs_debit: bacs_debit() | nil,
  billing_details: %{
    address: Stripe.Types.address(),
    email: String.t() | nil,
    name: String.t() | nil,
    phone: String.t() | nil
  },
  card: Stripe.Card.t() | nil,
  created: Stripe.timestamp(),
  customer: Stripe.id() | Stripe.Customer.t() | nil,
  id: Stripe.id(),
  link: %{persistent_token: String.t() | nil} | nil,
  livemode: boolean(),
  metadata: Stripe.Types.metadata(),
  object: String.t(),
  sepa_debit: sepa_debit() | nil,
  type: String.t(),
  us_bank_account: us_bank_account() | nil
}

Specs

us_bank_account() :: %{
  account_holder_type: String.t() | nil,
  account_type: String.t() | nil,
  bank_name: String.t() | nil,
  financial_connections_account: String.t() | nil,
  fingerprint: String.t() | nil,
  last4: String.t() | nil,
  networks: %{preferred: String.t() | nil, supported: list() | nil} | nil,
  routing_number: String.t() | nil
}

Link to this section Functions

Link to this function

attach(params, opts \\ [])

View Source

Specs

attach(params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
when params: %{
       customer: Stripe.id() | Stripe.Customer.t(),
       payment_method: Stripe.id() | t()
     }

Attach payment_method to customer

Link to this function

create(params, opts \\ [])

View Source

Specs

create(params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
when params: %{
       :type => String.t(),
       optional(:billing_details) => billing_details(),
       optional(:card) => card(),
       optional(:metadata) => Stripe.Types.metadata()
     }

Create a payment method.

Link to this function

detach(params, opts \\ [])

View Source

Specs

detach(params, Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}
when params: %{payment_method: Stripe.id() | t()}

Detach payment_method from customer

Link to this function

list(params, opts \\ [])

View Source

Specs

list(params, Stripe.options()) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.Error.t()}
when params: %{
       :customer => Stripe.id() | Stripe.Customer.t(),
       :type => String.t(),
       optional(:ending_before) => t() | Stripe.id(),
       optional(:limit) => 1..100,
       optional(:starting_after) => t() | Stripe.id()
     }

List all payment methods.

Link to this function

retrieve(id, opts \\ [])

View Source

Specs

retrieve(Stripe.id() | t(), Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}

Retrieve a payment method.

Link to this function

update(id, params, opts \\ [])

View Source

Specs

update(Stripe.id() | t(), params, Stripe.options()) ::
  {:ok, t()} | {:error, Stripe.Error.t()}
when params: %{
       optional(:billing_details) => billing_details(),
       optional(:card) => card(),
       optional(:metadata) => Stripe.Types.metadata()
     }

Update a card.

Takes the id and a map of changes