Class Token
- All Implemented Interfaces:
HasId,StripeObjectInterface
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
-
Nested Class Summary
Nested classes/interfaces inherited from class com.stripe.net.ApiResource
ApiResource.RequestMethod -
Field Summary
Fields inherited from class com.stripe.net.ApiResource
CHARSET, GSONFields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanstatic Tokencreate(TokenCreateParams params) Creates a single-use token that represents a bank account’s details.static Tokencreate(TokenCreateParams params, RequestOptions options) Creates a single-use token that represents a bank account’s details.static TokenCreates a single-use token that represents a bank account’s details.static Tokencreate(Map<String, Object> params, RequestOptions options) Creates a single-use token that represents a bank account’s details.booleanThese bank accounts are payment methods onCustomerobjects.getCard()You can store multiple cards on a customer in order to charge the customer later.IP address of the client that generated the token.Time at which the object was created.getId()Unique identifier for the object.Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.String representing the object's type.getType()Type of the token:account,bank_account,card, orpii.getUsed()Whether this token has already been used (tokens can be used only once).inthashCode()static TokenRetrieves the token with the given ID.static Tokenretrieve(String token, RequestOptions options) Retrieves the token with the given ID.static Tokenretrieve(String token, TokenRetrieveParams params, RequestOptions options) Retrieves the token with the given ID.static TokenRetrieves the token with the given ID.voidsetBankAccount(BankAccount bankAccount) These bank accounts are payment methods onCustomerobjects.voidYou can store multiple cards on a customer in order to charge the customer later.voidsetClientIp(String clientIp) IP address of the client that generated the token.voidsetCreated(Long created) Time at which the object was created.voidUnique identifier for the object.voidsetLivemode(Boolean livemode) Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.voidString representing the object's type.voidType of the token:account,bank_account,card, orpii.voidWhether this token has already been used (tokens can be used only once).Methods inherited from class com.stripe.net.ApiResource
checkNullTypedParams, classUrl, classUrl, instanceUrl, instanceUrl, request, request, requestCollection, requestCollection, requestSearchResult, requestSearchResult, requestStream, requestStream, setExpandableFieldId, setStripeResponseGetter, singleClassUrl, singleClassUrl, subresourceUrl, urlEncode, urlEncodeIdMethods inherited from class com.stripe.model.StripeObject
equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
-
Constructor Details
-
Token
public Token()
-
-
Method Details
-
create
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.- Throws:
StripeException
-
create
public static Token create(Map<String, Object> params, RequestOptions options) throws StripeExceptionCreates 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.- Throws:
StripeException
-
create
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.- Throws:
StripeException
-
create
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.- Throws:
StripeException
-
retrieve
Retrieves the token with the given ID.- Throws:
StripeException
-
retrieve
Retrieves the token with the given ID.- Throws:
StripeException
-
retrieve
public static Token retrieve(String token, Map<String, Object> params, RequestOptions options) throws StripeExceptionRetrieves the token with the given ID.- Throws:
StripeException
-
retrieve
public static Token retrieve(String token, TokenRetrieveParams params, RequestOptions options) throws StripeException Retrieves the token with the given ID.- Throws:
StripeException
-
getBankAccount
These bank accounts are payment methods onCustomerobjects.On the other hand External Accounts are transfer destinations on
Accountobjects for Custom accounts. They can be bank accounts or debit cards as well, and are documented in the links above.Related guide: Bank Debits and Transfers.
-
getCard
You can store multiple cards on a customer in order to charge the customer later. You can also store multiple debit cards on a recipient in order to transfer to those cards later.Related guide: Card Payments with Sources.
-
getClientIp
IP address of the client that generated the token. -
getCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
getLivemode
Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode. -
getObject
String representing the object's type. Objects of the same type share the same value.Equal to
token. -
getType
Type of the token:account,bank_account,card, orpii. -
getUsed
Whether this token has already been used (tokens can be used only once). -
setBankAccount
These bank accounts are payment methods onCustomerobjects.On the other hand External Accounts are transfer destinations on
Accountobjects for Custom accounts. They can be bank accounts or debit cards as well, and are documented in the links above.Related guide: Bank Debits and Transfers.
-
setCard
You can store multiple cards on a customer in order to charge the customer later. You can also store multiple debit cards on a recipient in order to transfer to those cards later.Related guide: Card Payments with Sources.
-
setClientIp
IP address of the client that generated the token. -
setCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
setId
Unique identifier for the object. -
setLivemode
Has the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode. -
setObject
String representing the object's type. Objects of the same type share the same value.Equal to
token. -
setType
Type of the token:account,bank_account,card, orpii. -
setUsed
Whether this token has already been used (tokens can be used only once). -
equals
-
canEqual
-
hashCode
public int hashCode() -
getId
Unique identifier for the object.
-