View Source Stripe.Token (stripity_stripe v3.3.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 External accounts. Radar, our integrated solution for automatic fraud protection, performs best with integrations that use client-side tokenization.

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 or authorizer'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 individual'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.

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

A document verifying the business.

Documents that may be submitted to satisfy various informational requests.

The persons ethnicity details

Information about the person represented by the account.

Contains information about card networks used to process the payment.

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 persons race details

The person's registered address.

Describes the person’s relationship to the account.

This hash is used to attest that the representative is authorized to act as the representative of their legal entity.

t()

The token type.

Demographic data related to the person.

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 v1 API method in place of a bank account dictionary. You can only use this token once. To do so, attach it to a connected account where controller.requirement_collection is application, which includes Custom accounts.

Retrieves the token with the given ID.

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 or authorizer'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 individual'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(:payment_method) => 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(:networks) => networks(),
  optional(:number) => binary()
}
@type company() :: %{
  optional(:address) => address(),
  optional(:address_kana) => address_kana(),
  optional(:address_kanji) => address_kanji(),
  optional(:directors_provided) => boolean(),
  optional(:directorship_declaration) => directorship_declaration(),
  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(:ownership_exemption_reason) =>
    :qualified_entity_exceeds_ownership_threshold
    | :qualifies_as_financial_institution,
  optional(:phone) => binary(),
  optional(:registration_date) => registration_date() | binary(),
  optional(:registration_number) => binary(),
  optional(:representative_declaration) => representative_declaration(),
  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
    | :registered_charity
    | :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.

Link to this type

directorship_declaration()

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

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

@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 ethnicity_details() :: %{
  optional(:ethnicity) => [
    :cuban
    | :hispanic_or_latino
    | :mexican
    | :not_hispanic_or_latino
    | :other_hispanic_or_latino
    | :prefer_not_to_answer
    | :puerto_rican
  ],
  optional(:ethnicity_other) => binary()
}

The persons ethnicity details

@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(:relationship) => relationship(),
  optional(:ssn_last_4) => binary(),
  optional(:verification) => verification()
}

Information about the person represented by the account.

@type networks() :: %{optional(:preferred) => :cartes_bancaires | :mastercard | :visa}

Contains information about card networks used to process the payment.

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) => :existing | :none,
  optional(:registered_address) => registered_address(),
  optional(:relationship) => relationship(),
  optional(:ssn_last_4) => binary(),
  optional(:us_cfpb_data) => us_cfpb_data(),
  optional(:verification) => verification()
}

Information for the person this token represents.

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

The PII this token represents.

@type race_details() :: %{
  optional(:race) => [
    :african_american
    | :american_indian_or_alaska_native
    | :asian
    | :asian_indian
    | :black_or_african_american
    | :chinese
    | :ethiopian
    | :filipino
    | :guamanian_or_chamorro
    | :haitian
    | :jamaican
    | :japanese
    | :korean
    | :native_hawaiian
    | :native_hawaiian_or_other_pacific_islander
    | :nigerian
    | :other_asian
    | :other_black_or_african_american
    | :other_pacific_islander
    | :prefer_not_to_answer
    | :samoan
    | :somali
    | :vietnamese
    | :white
  ],
  optional(:race_other) => binary()
}

The persons race details

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

The person's registered address.

@type registration_date() :: %{
  optional(:day) => integer(),
  optional(:month) => integer(),
  optional(:year) => integer()
}
@type relationship() :: %{
  optional(:director) => boolean(),
  optional(:executive) => boolean(),
  optional(:owner) => boolean(),
  optional(:percent_ownership) => number() | binary(),
  optional(:title) => binary()
}

Describes the person’s relationship to the account.

Link to this type

representative_declaration()

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

This hash is used to attest that the representative is authorized to act as the representative of their 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 us_cfpb_data() :: %{
  optional(:ethnicity_details) => ethnicity_details(),
  optional(:race_details) => race_details(),
  optional(:self_identified_gender) => binary()
}

Demographic data related to the person.

@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.

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 v1 API method in place of a bank account dictionary. You can only use this token once. To do so, attach it to a connected account where controller.requirement_collection is application, which includes Custom accounts.

#### 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}