Stripe.Token (stripity_stripe v2.17.2) View Source

Work with Stripe token objects.

You can:

  • Create a token for a Connect customer with a card
  • Create a token with all options - Only for Unit Tests with Stripe
  • Retrieve a token

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

Link to this section Summary

Functions

Creates a single use token that wraps the details of a credit card. This token can be used in place of a credit card dictionary with any API method. These tokens can only be used once: by creating a new charge object, or attaching them to a customer.

Retrieve a token.

Link to this section Types

Specs

t() :: %Stripe.Token{
  bank_account: token_bank_account() | nil,
  card: token_card() | nil,
  client_ip: String.t() | nil,
  created: Stripe.timestamp(),
  id: Stripe.id(),
  livemode: boolean(),
  object: String.t(),
  type: String.t(),
  used: boolean()
}

Specs

token_bank_account() :: %{
  id: Stripe.id(),
  object: String.t(),
  account_holder_name: String.t() | nil,
  account_holder_type: String.t() | nil,
  bank_name: String.t() | nil,
  country: String.t(),
  currency: String.t(),
  fingerprint: String.t() | nil,
  last4: String.t(),
  routing_number: String.t() | nil,
  status: String.t()
}

Specs

token_card() :: %{
  id: Stripe.id(),
  object: String.t(),
  address_city: String.t() | nil,
  address_country: String.t() | nil,
  address_line1: String.t() | nil,
  address_line1_check: String.t() | nil,
  address_line2: String.t() | nil,
  address_state: String.t() | nil,
  address_zip: String.t() | nil,
  address_zip_check: String.t() | nil,
  brand: String.t(),
  country: String.t() | nil,
  currency: String.t(),
  cvc_check: String.t() | nil,
  dynamic_last4: String.t() | nil,
  exp_month: integer(),
  exp_year: integer(),
  fingerprint: String.t() | nil,
  funding: String.t(),
  last4: String.t(),
  metadata: Stripe.Types.metadata(),
  name: String.t() | nil,
  tokenization_method: String.t() | nil
}

Link to this section Functions

Link to this function

create(params, opts \\ [])

View Source

Specs

create(map(), Stripe.options()) :: {:ok, t()} | {:error, Stripe.Error.t()}

Creates a single use token that wraps the details of a credit card. This token can be used in place of a credit card dictionary with any API method. These tokens can only be used once: by creating a new charge object, or attaching them to a customer.

In most cases, you should create tokens client-side using Checkout, Elements, or Stripe's mobile libraries, instead of using the API.

Link to this function

retrieve(id, opts \\ [])

View Source

Specs

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

Retrieve a token.