View Source Stripe.Token (stripity_stripe v3.1.1)

Tokenization is the process Stripe uses to collect sensitive card or bank account details, or personally identifiable information (PII), directly from your customers in a secure manner. A token representing this information is returned to your server to use. Use our recommended payments integrations to perform this process on the client-side. This guarantees that no sensitive card data touches your server, and allows your integration to operate in a PCI-compliant way.

If you can't use client-side tokenization, you can also create tokens using the API with either your publishable or secret API key. If your integration uses this method, you're responsible for any PCI compliance that it might require, and you must keep your secret API key safe. Unlike with client-side tokenization, your customer's information isn't sent directly to Stripe, so we can't determine how it's handled or stored.

You can't store or use tokens more than once. To store card or bank account information for later use, create Customer objects or Custom accounts. Radar, our integrated solution for automatic fraud protection, performs best with integrations that use client-side tokenization.

Link to this section Summary

Types

Details on the legal guardian's acceptance of the main Stripe service agreement.

A document showing address, either a passport, local ID card, or utility bill from a well-known utility company.

Details on the legal guardian's acceptance of the required Stripe agreements.

The person's address.

The Kana variation of the company's primary address (Japan only).

The Kanji variation of the company's primary address (Japan only).

The bank account this token will represent.

Information about the company or business.

One or more documents that demonstrate proof that this person is authorized to represent the company.

The updated CVC value this token represents.

A document verifying the business.

Documents that may be submitted to satisfy various informational requests.

Information about the person represented by the account.

This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.

One or more documents showing the person's passport page with photo and personal data.

Information for the person this token represents.

The PII this token represents.

The individual's registered address.

The relationship that this person has with the account's legal entity.

t()

The token type.

Information on the verification state of the company.

One or more documents showing the person's visa required for living in the country where they are residing.

Functions

Creates a single-use token that represents a bank account’s details.You can use this token with any API method in place of a bank account dictionary. You can only use this token once. To do so, attach it to a Custom account.

Retrieves the token with the given ID.

Link to this section Types

@type account() :: %{
  optional(:date) => integer(),
  optional(:ip) => binary(),
  optional(:user_agent) => binary() | binary()
}

Details on the legal guardian's acceptance of the main Stripe service agreement.

@type additional_document() :: %{
  optional(:back) => binary(),
  optional(:front) => binary()
}

A document showing address, either a passport, local ID card, or utility bill from a well-known utility company.

Link to this type

additional_tos_acceptances()

View Source
@type additional_tos_acceptances() :: %{optional(:account) => account()}

Details on the legal guardian's acceptance of the required Stripe agreements.

@type address() :: %{
  optional(:city) => binary(),
  optional(:country) => binary(),
  optional(:line1) => binary(),
  optional(:line2) => binary(),
  optional(:postal_code) => binary(),
  optional(:state) => binary()
}

The person's address.

@type address_kana() :: %{
  optional(:city) => binary(),
  optional(:country) => binary(),
  optional(:line1) => binary(),
  optional(:line2) => binary(),
  optional(:postal_code) => binary(),
  optional(:state) => binary(),
  optional(:town) => binary()
}

The Kana variation of the company's primary address (Japan only).

@type address_kanji() :: %{
  optional(:city) => binary(),
  optional(:country) => binary(),
  optional(:line1) => binary(),
  optional(:line2) => binary(),
  optional(:postal_code) => binary(),
  optional(:state) => binary(),
  optional(:town) => binary()
}

The Kanji variation of the company's primary address (Japan only).

@type bank_account() :: %{
  optional(:account_holder_name) => binary(),
  optional(:account_holder_type) => :company | :individual,
  optional(:account_number) => binary(),
  optional(:account_type) => :checking | :futsu | :savings | :toza,
  optional(:country) => binary(),
  optional(:currency) => binary(),
  optional(:routing_number) => binary()
}

The bank account this token will represent.

@type card() :: %{
  optional(:address_city) => binary(),
  optional(:address_country) => binary(),
  optional(:address_line1) => binary(),
  optional(:address_line2) => binary(),
  optional(:address_state) => binary(),
  optional(:address_zip) => binary(),
  optional(:currency) => binary(),
  optional(:cvc) => binary(),
  optional(:exp_month) => binary(),
  optional(:exp_year) => binary(),
  optional(:name) => binary(),
  optional(:number) => binary()
}
@type company() :: %{
  optional(:address) => address(),
  optional(:address_kana) => address_kana(),
  optional(:address_kanji) => address_kanji(),
  optional(:directors_provided) => boolean(),
  optional(:executives_provided) => boolean(),
  optional(:export_license_id) => binary(),
  optional(:export_purpose_code) => binary(),
  optional(:name) => binary(),
  optional(:name_kana) => binary(),
  optional(:name_kanji) => binary(),
  optional(:owners_provided) => boolean(),
  optional(:ownership_declaration) => ownership_declaration(),
  optional(:ownership_declaration_shown_and_signed) => boolean(),
  optional(:phone) => binary(),
  optional(:registration_number) => binary(),
  optional(:structure) =>
    :free_zone_establishment
    | :free_zone_llc
    | :government_instrumentality
    | :governmental_unit
    | :incorporated_non_profit
    | :incorporated_partnership
    | :limited_liability_partnership
    | :llc
    | :multi_member_llc
    | :private_company
    | :private_corporation
    | :private_partnership
    | :public_company
    | :public_corporation
    | :public_partnership
    | :single_member_llc
    | :sole_establishment
    | :sole_proprietorship
    | :tax_exempt_government_instrumentality
    | :unincorporated_association
    | :unincorporated_non_profit
    | :unincorporated_partnership,
  optional(:tax_id) => binary(),
  optional(:tax_id_registrar) => binary(),
  optional(:vat_id) => binary(),
  optional(:verification) => verification()
}

Information about the company or business.

Link to this type

company_authorization()

View Source
@type company_authorization() :: %{optional(:files) => [binary() | binary()]}

One or more documents that demonstrate proof that this person is authorized to represent the company.

@type cvc_update() :: %{optional(:cvc) => binary()}

The updated CVC value this token represents.

@type dob() :: %{
  optional(:day) => integer(),
  optional(:month) => integer(),
  optional(:year) => integer()
}
@type document() :: %{optional(:back) => binary(), optional(:front) => binary()}

A document verifying the business.

@type documents() :: %{
  optional(:company_authorization) => company_authorization(),
  optional(:passport) => passport(),
  optional(:visa) => visa()
}

Documents that may be submitted to satisfy various informational requests.

@type individual() :: %{
  optional(:address) => address(),
  optional(:address_kana) => address_kana(),
  optional(:address_kanji) => address_kanji(),
  optional(:dob) => dob() | binary(),
  optional(:email) => binary(),
  optional(:first_name) => binary(),
  optional(:first_name_kana) => binary(),
  optional(:first_name_kanji) => binary(),
  optional(:full_name_aliases) => [binary()] | binary(),
  optional(:gender) => binary(),
  optional(:id_number) => binary(),
  optional(:id_number_secondary) => binary(),
  optional(:last_name) => binary(),
  optional(:last_name_kana) => binary(),
  optional(:last_name_kanji) => binary(),
  optional(:maiden_name) => binary(),
  optional(:metadata) => %{optional(binary()) => binary()} | binary(),
  optional(:phone) => binary(),
  optional(:political_exposure) => :existing | :none,
  optional(:registered_address) => registered_address(),
  optional(:ssn_last_4) => binary(),
  optional(:verification) => verification()
}

Information about the person represented by the account.

Link to this type

ownership_declaration()

View Source
@type ownership_declaration() :: %{
  optional(:date) => integer(),
  optional(:ip) => binary(),
  optional(:user_agent) => binary()
}

This hash is used to attest that the beneficial owner information provided to Stripe is both current and correct.

@type passport() :: %{optional(:files) => [binary() | binary()]}

One or more documents showing the person's passport page with photo and personal data.

@type person() :: %{
  optional(:additional_tos_acceptances) => additional_tos_acceptances(),
  optional(:address) => address(),
  optional(:address_kana) => address_kana(),
  optional(:address_kanji) => address_kanji(),
  optional(:dob) => dob() | binary(),
  optional(:documents) => documents(),
  optional(:email) => binary(),
  optional(:first_name) => binary(),
  optional(:first_name_kana) => binary(),
  optional(:first_name_kanji) => binary(),
  optional(:full_name_aliases) => [binary()] | binary(),
  optional(:gender) => binary(),
  optional(:id_number) => binary(),
  optional(:id_number_secondary) => binary(),
  optional(:last_name) => binary(),
  optional(:last_name_kana) => binary(),
  optional(:last_name_kanji) => binary(),
  optional(:maiden_name) => binary(),
  optional(:metadata) => %{optional(binary()) => binary()} | binary(),
  optional(:nationality) => binary(),
  optional(:phone) => binary(),
  optional(:political_exposure) => binary(),
  optional(:registered_address) => registered_address(),
  optional(:relationship) => relationship(),
  optional(:ssn_last_4) => binary(),
  optional(:verification) => verification()
}

Information for the person this token represents.

@type pii() :: %{optional(:id_number) => binary()}

The PII this token represents.

@type registered_address() :: %{
  optional(:city) => binary(),
  optional(:country) => binary(),
  optional(:line1) => binary(),
  optional(:line2) => binary(),
  optional(:postal_code) => binary(),
  optional(:state) => binary()
}

The individual's registered address.

@type relationship() :: %{
  optional(:director) => boolean(),
  optional(:executive) => boolean(),
  optional(:legal_guardian) => boolean(),
  optional(:owner) => boolean(),
  optional(:percent_ownership) => number() | binary(),
  optional(:representative) => boolean(),
  optional(:title) => binary()
}

The relationship that this person has with the account's legal entity.

@type t() :: %Stripe.Token{
  bank_account: Stripe.BankAccount.t(),
  card: Stripe.Card.t(),
  client_ip: binary() | nil,
  created: integer(),
  id: binary(),
  livemode: boolean(),
  object: binary(),
  type: binary(),
  used: boolean()
}

The token type.

  • bank_account
  • card
  • client_ip IP address of the client that generates the token.
  • created Time at which the object was created. Measured in seconds since the Unix epoch.
  • id Unique identifier for the object.
  • livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode.
  • object String representing the object's type. Objects of the same type share the same value.
  • type Type of the token: account, bank_account, card, or pii.
  • used Determines if you have already used this token (you can only use tokens once).
@type verification() :: %{optional(:document) => document()}

Information on the verification state of the company.

@type visa() :: %{optional(:files) => [binary() | binary()]}

One or more documents showing the person's visa required for living in the country where they are residing.

Link to this section Functions

Link to this function

create(params \\ %{}, opts \\ [])

View Source
@spec create(
  params :: %{
    optional(:account) => account(),
    optional(:bank_account) => bank_account(),
    optional(:card) => card() | binary(),
    optional(:customer) => binary(),
    optional(:cvc_update) => cvc_update(),
    optional(:expand) => [binary()],
    optional(:person) => person(),
    optional(:pii) => pii()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Creates a single-use token that represents a bank account’s details.You can use this token with any API method in place of a bank account dictionary. You can only use this token once. To do so, attach it to a Custom account.

#### Details * Method: `post` * Path: `/v1/tokens`

Link to this function

retrieve(token, params \\ %{}, opts \\ [])

View Source
@spec retrieve(
  token :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Retrieves the token with the given ID.

Details

  • Method: get
  • Path: /v1/tokens/{token}