public class Stripe
extends java.lang.Object
| Constructor and Description |
|---|
Stripe()
A blank constructor to set the key later.
|
Stripe(java.lang.String publishableKey)
Constructor with publishable key.
|
| Modifier and Type | Method and Description |
|---|---|
void |
createToken(Card card,
java.util.concurrent.Executor executor,
TokenCallback callback)
Call to create a
Token on a specific Executor. |
void |
createToken(Card card,
java.lang.String publishableKey,
java.util.concurrent.Executor executor,
TokenCallback callback)
Call to create a
Token with the publishable key and Executor specified. |
void |
createToken(Card card,
java.lang.String publishableKey,
TokenCallback callback)
Call to create a
Token with a specific public key. |
void |
createToken(Card card,
TokenCallback callback)
The simplest way to create a token, using a
Card and TokenCallback. |
Token |
createTokenSynchronous(Card card)
Blocking method to create a
Token. |
Token |
createTokenSynchronous(Card card,
java.lang.String publishableKey)
Blocking method to create a
Token. |
void |
setDefaultPublishableKey(java.lang.String publishableKey)
Set the default publishable key to use with this
Stripe instance. |
public Stripe()
public Stripe(java.lang.String publishableKey)
throws AuthenticationException
publishableKey - the client's publishable keyAuthenticationException - if the key is invalidpublic void createToken(@NonNull
Card card,
@NonNull
TokenCallback callback)
Card and TokenCallback. This
runs on the default Executor and with the
currently set defaultPublishableKey.card - the Card used to create this payment tokencallback - a TokenCallback to receive either the token or an errorpublic void createToken(@NonNull
Card card,
@NonNull
java.lang.String publishableKey,
@NonNull
TokenCallback callback)
Token with a specific public key.card - the Card used for this transactionpublishableKey - the public key used for this transactioncallback - a TokenCallback to receive the result of this operationpublic void createToken(@NonNull
Card card,
@NonNull
java.util.concurrent.Executor executor,
@NonNull
TokenCallback callback)
Token on a specific Executor.card - the Card to use for this token creationexecutor - An Executor on which to run this operation. If you don't wish to
specify an executor, use one of the other createToken methods.callback - a TokenCallback to receive the result of this operationpublic void createToken(@NonNull
Card card,
@NonNull
java.lang.String publishableKey,
@Nullable
java.util.concurrent.Executor executor,
@NonNull
TokenCallback callback)
Token with the publishable key and Executor specified.card - the Card used for this tokenpublishableKey - the publishable key to useexecutor - an Executor to run this operation on. If null, this is run on a
default non-ui executorcallback - a TokenCallback to receive the result or error messagepublic Token createTokenSynchronous(Card card) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException
Token. Do not call this on the UI thread or your app
will crash. This method uses the default publishable key for this Stripe instance.card - the Card to use for this tokenToken that can be used for this cardAuthenticationException - failure to properly authenticate yourself (check your key)InvalidRequestException - your request has invalid parametersAPIConnectionException - failure to connect to Stripe's APICardException - the card cannot be charged for some reasonAPIException - any other type of problem (for instance, a temporary issue with
Stripe's serverspublic Token createTokenSynchronous(Card card, java.lang.String publishableKey) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException
Token. Do not call this on the UI thread or your app
will crash.card - the Card to use for this tokenpublishableKey - the publishable key to use with this requestToken that can be used for this cardAuthenticationException - failure to properly authenticate yourself (check your key)InvalidRequestException - your request has invalid parametersAPIConnectionException - failure to connect to Stripe's APICardException - the card cannot be charged for some reasonAPIException - any other type of problem (for instance, a temporary issue with
Stripe's servers)public void setDefaultPublishableKey(@NonNull
java.lang.String publishableKey)
throws AuthenticationException
Stripe instance.publishableKey - the key to be setAuthenticationException - if the key is null, empty, or a secret key