Class Token
- All Implemented Interfaces:
HasId
,StripeActiveObject
,StripeObjectInterface
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.
-
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, GSON, INTERNAL_GSON
Fields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
static Token
create
(TokenCreateParams params) Creates a single-use token that represents a bank account’s details.static Token
create
(TokenCreateParams params, RequestOptions options) Creates a single-use token that represents a bank account’s details.static Token
Creates a single-use token that represents a bank account’s details.static Token
create
(Map<String, Object> params, RequestOptions options) Creates a single-use token that represents a bank account’s details.boolean
These bank accounts are payment methods onCustomer
objects.getCard()
You can store multiple cards on a customer in order to charge the customer later.IP address of the client that generates the token.Time at which the object was created.getId()
Unique identifier for the object.Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.String representing the object's type.getType()
Type of the token:account
,bank_account
,card
, orpii
.getUsed()
Determines if you have already used this token (you can only use tokens once).int
hashCode()
static Token
Retrieves the token with the given ID.static Token
retrieve
(String token, RequestOptions options) Retrieves the token with the given ID.static Token
retrieve
(String token, TokenRetrieveParams params, RequestOptions options) Retrieves the token with the given ID.static Token
Retrieves the token with the given ID.void
setBankAccount
(BankAccount bankAccount) These bank accounts are payment methods onCustomer
objects.void
You can store multiple cards on a customer in order to charge the customer later.void
setClientIp
(String clientIp) IP address of the client that generates the token.void
setCreated
(Long created) Time at which the object was created.void
Unique identifier for the object.void
setLivemode
(Boolean livemode) Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.void
String representing the object's type.void
setResponseGetter
(StripeResponseGetter responseGetter) Method is used by the containing object orStripeResponseGetter
implementations to set theStripeResponseGetter
instance used to make further requests.void
Type of the token:account
,bank_account
,card
, orpii
.void
Determines if you have already used this token (you can only use tokens once).Methods inherited from class com.stripe.net.ApiResource
checkNullTypedParams, getGlobalResponseGetter, getResponseGetter, setExpandableFieldId, setStripeResponseGetter, urlEncode, urlEncodeId
Methods inherited from class com.stripe.model.StripeObject
deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.stripe.model.StripeActiveObject
trySetResponseGetter
-
Constructor Details
-
Token
public Token()
-
-
Method Details
-
create
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 connected account where controller.requirement_collection isapplication
, which includes Custom accounts.- 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. 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 connected account where controller.requirement_collection isapplication
, which includes Custom accounts.- Throws:
StripeException
-
create
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 connected account where controller.requirement_collection isapplication
, which includes Custom accounts.- Throws:
StripeException
-
create
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 connected account where controller.requirement_collection isapplication
, which includes Custom accounts.- 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
-
setResponseGetter
Description copied from interface:StripeActiveObject
Method is used by the containing object orStripeResponseGetter
implementations to set theStripeResponseGetter
instance used to make further requests.- Specified by:
setResponseGetter
in interfaceStripeActiveObject
- Overrides:
setResponseGetter
in classApiResource
- Parameters:
responseGetter
- theStripeResponseGetter
instance to use for making further requests.
-
getBankAccount
These bank accounts are payment methods onCustomer
objects.On the other hand External Accounts are transfer destinations on
Account
objects for connected 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 generates the token. -
getCreated
Time at which the object was created. Measured in seconds since the Unix epoch. -
getLivemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if 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
Determines if you have already used this token (you can only use tokens once). -
setBankAccount
These bank accounts are payment methods onCustomer
objects.On the other hand External Accounts are transfer destinations on
Account
objects for connected 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 generates 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 valuetrue
if the object exists in live mode or the valuefalse
if 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
Determines if you have already used this token (you can only use tokens once). -
equals
-
canEqual
-
hashCode
public int hashCode() -
getId
Unique identifier for the object.
-