View Source Stripe.Token (Striped v0.4.0)
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. You should use our recommended payments integrations to perform this process client-side. This ensures that no sensitive card data touches your server, and allows your integration to operate in a PCI-compliant way.
If you cannot use client-side tokenization, you can also create tokens using the API with either your publishable or secret API key. Keep in mind that if your integration uses this method, you are responsible for any PCI compliance that may be required, and you must keep your secret API key safe. Unlike with client-side tokenization, your customer's information is not sent directly to Stripe, so we cannot determine how it is handled or stored.
Tokens cannot be stored or used more than once. To store card or bank account information for later use, you can create Customer objects or Custom accounts. Note that Radar, our integrated solution for automatic fraud protection, performs best with integrations that use client-side tokenization.
Related guide: Accept a payment
Link to this section Summary
Types
Information for the account this token will represent.
A document showing address, either a passport, local ID card, or utility bill from a well-known utility company.
The company's primary 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 will represent.
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 will represent.
The PII this token will represent.
The individual's registered address.
The relationship that this person has with the account's legal entity.
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.This token can be used with any API method in place of a bank account dictionary. This token can be used only once, by attaching it to a Custom account.
Retrieves the token with the given ID.
Link to this section Types
@type account() :: %{ optional(:business_type) => :company | :government_entity | :individual | :non_profit, optional(:company) => company(), optional(:individual) => individual(), optional(:tos_shown_and_accepted) => boolean() }
Information for the account this token will represent.
A document showing address, either a passport, local ID card, or utility bill from a well-known utility company.
@type address() :: %{ optional(:city) => binary(), optional(:country) => binary(), optional(:line1) => binary(), optional(:line2) => binary(), optional(:postal_code) => binary(), optional(:state) => binary() }
The company's primary 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(: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 | :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, optional(:tax_id) => binary(), optional(:tax_id_registrar) => binary(), optional(:vat_id) => binary(), optional(:verification) => verification() }
Information about the company or business.
@type company_authorization() :: %{optional(:files) => [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 will represent.
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.
@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()]}
One or more documents showing the person's passport page with photo and personal data.
@type person() :: %{ 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 will represent.
@type pii() :: %{optional(:id_number) => binary()}
The PII this token will represent.
@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(: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 generated 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 valuetrue
if the object exists in live mode or the valuefalse
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
, orpii
.used
Whether this token has already been used (tokens can be used only once).
@type verification() :: %{optional(:document) => document()}
Information on the verification state of the company.
@type visa() :: %{optional(:files) => [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
@spec create( client :: Stripe.t(), 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.This token can be used with any API method in place of a bank account dictionary. This token can be used only once, by attaching it to a Custom account.
#### Details * Method: `post` * Path: `/v1/tokens`@spec retrieve( client :: Stripe.t(), 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}