public class Stripe
extends java.lang.Object
| Constructor and Description |
|---|
Stripe(android.content.Context context)
A constructor with only context, to set the key later.
|
Stripe(android.content.Context context,
java.lang.String publishableKey)
Constructor with publishable key.
|
| Modifier and Type | Method and Description |
|---|---|
PaymentIntent |
confirmPaymentIntentSynchronous(PaymentIntentParams paymentIntentParams,
java.lang.String publishableKey)
Blocking method to confirm a
PaymentIntent object. |
Token |
createAccountTokenSynchronous(AccountParams accountParams)
Blocking method to create a
Token for a Connect Account. |
Token |
createAccountTokenSynchronous(AccountParams accountParams,
java.lang.String publishableKey)
Blocking method to create a
Token for a Connect Account. |
void |
createBankAccountToken(BankAccount bankAccount,
java.lang.String publishableKey,
java.util.concurrent.Executor executor,
TokenCallback callback)
|
void |
createBankAccountToken(BankAccount bankAccount,
TokenCallback callback)
The simplest way to create a
BankAccount token. |
Token |
createBankAccountTokenSynchronous(BankAccount bankAccount)
Blocking method to create a
Token for a BankAccount. |
Token |
createBankAccountTokenSynchronous(BankAccount bankAccount,
java.lang.String publishableKey)
Blocking method to create a
Token using a BankAccount. |
void |
createPiiToken(java.lang.String personalId,
java.lang.String publishableKey,
java.util.concurrent.Executor executor,
TokenCallback callback)
Call to create a
Token for PII with the publishable key and
Executor specified. |
void |
createPiiToken(java.lang.String personalId,
TokenCallback callback)
The simplest way to create a PII token.
|
Token |
createPiiTokenSynchronous(java.lang.String personalId)
Blocking method to create a
Token for PII. |
Token |
createPiiTokenSynchronous(java.lang.String personalId,
java.lang.String publishableKey)
Blocking method to create a
Token for PII. |
void |
createSource(SourceParams sourceParams,
SourceCallback callback)
|
void |
createSource(SourceParams sourceParams,
SourceCallback callback,
java.lang.String publishableKey,
java.util.concurrent.Executor executor)
Create a
Source using an AsyncTask. |
Source |
createSourceSynchronous(SourceParams params)
|
Source |
createSourceSynchronous(SourceParams params,
java.lang.String publishableKey)
Blocking method to create a
Source object. |
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 |
logEventSynchronous(java.util.List<java.lang.String> productUsageTokens,
StripePaymentSource paymentSource) |
PaymentIntent |
retrievePaymentIntentSynchronous(PaymentIntentParams paymentIntentParams,
java.lang.String publishableKey)
Blocking method to retrieve a
PaymentIntent object. |
Source |
retrieveSourceSynchronous(java.lang.String sourceId,
java.lang.String clientSecret)
Retrieve an existing
Source from the Stripe API. |
Source |
retrieveSourceSynchronous(java.lang.String sourceId,
java.lang.String clientSecret,
java.lang.String publishableKey)
Retrieve an existing
Source from the Stripe API. |
void |
setDefaultPublishableKey(java.lang.String publishableKey)
Set the default publishable key to use with this
Stripe instance. |
void |
setStripeAccount(java.lang.String stripeAccount)
Set the Stripe Connect account to use with this Stripe instance.
|
public Stripe(android.content.Context context)
context - Context for resolving resourcespublic Stripe(android.content.Context context,
java.lang.String publishableKey)
context - Context for resolving resourcespublishableKey - the client's publishable keypublic void createBankAccountToken(BankAccount bankAccount, TokenCallback callback)
BankAccount token. This runs on the default
Executor and with the currently set mDefaultPublishableKey.bankAccount - the BankAccount used to create this tokencallback - a TokenCallback to receive either the token or an errorpublic void createBankAccountToken(BankAccount bankAccount, java.lang.String publishableKey, java.util.concurrent.Executor executor, TokenCallback callback)
bankAccount - the BankAccount for which to create a 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 void createPiiToken(java.lang.String personalId,
TokenCallback callback)
Executor and with the currently set mDefaultPublishableKey.personalId - the personal id used to create this tokencallback - a TokenCallback to receive either the token or an errorpublic void createPiiToken(java.lang.String personalId,
java.lang.String publishableKey,
java.util.concurrent.Executor executor,
TokenCallback callback)
Token for PII with the publishable key and
Executor specified.personalId - the personal id used to create 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 createBankAccountTokenSynchronous(BankAccount bankAccount) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException
Token for a BankAccount. Do not call this on
the UI thread or your app will crash.
This method uses the default publishable key for this Stripe instance.bankAccount - the Card to use for this tokenToken that can be used for this BankAccountAuthenticationException - failure to properly authenticate yourself (check your key)InvalidRequestException - your request has invalid parametersAPIConnectionException - failure to connect to Stripe's APICardException - should not be thrown with this type of token, but is theoretically
possible given the underlying methods calledAPIException - any other type of problem (for instance, a temporary issue with
Stripe's serverspublic Token createBankAccountTokenSynchronous(BankAccount bankAccount, java.lang.String publishableKey) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException
Token using a BankAccount. Do not call this on
the UI thread or your app will crash.bankAccount - the BankAccount to use for this tokenpublishableKey - the publishable key to use with this requestToken that can be used for this BankAccountAuthenticationException - failure to properly authenticate yourself (check your key)InvalidRequestException - your request has invalid parametersAPIConnectionException - failure to connect to Stripe's APICardException - should not be thrown with this type of token, but is theoretically
possible given the underlying methods calledAPIException - any other type of problempublic void createSource(SourceParams sourceParams, SourceCallback callback)
Source using an AsyncTask on the default Executor with a
publishable api key that has already been set on this Stripe instance.sourceParams - the SourceParams to be usedcallback - a SourceCallback to receive a result or an error messagepublic void createSource(SourceParams sourceParams, SourceCallback callback, java.lang.String publishableKey, java.util.concurrent.Executor executor)
Source using an AsyncTask.sourceParams - the SourceParams to be usedcallback - a SourceCallback to receive a result or an error messagepublishableKey - the publishable api key to be usedexecutor - an Executor on which to execute the task, or null for defaultpublic void createToken(Card card, TokenCallback callback)
Card and TokenCallback. This
runs on the default Executor and with the
currently set mDefaultPublishableKey.card - the Card used to create this payment tokencallback - a TokenCallback to receive either the token or an errorpublic void createToken(Card card, java.lang.String publishableKey, 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(Card card, java.util.concurrent.Executor executor, 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 createTokenFromParams methods.callback - a TokenCallback to receive the result of this operationpublic void createToken(Card card, java.lang.String publishableKey, java.util.concurrent.Executor executor, 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 Source createSourceSynchronous(SourceParams params) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException
Source object using this object's
key.
Do not call this on the UI thread or your app will crash.params - a set of SourceParams with which to create the sourceSource, or null if a problem occurredAuthenticationException - 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 Source createSourceSynchronous(SourceParams params, java.lang.String publishableKey) throws AuthenticationException, InvalidRequestException, APIConnectionException, APIException
Source object.
Do not call this on the UI thread or your app will crash.params - a set of SourceParams with which to create the sourcepublishableKey - a publishable API key to useSource, or null if a problem occurredAuthenticationException - failure to properly authenticate yourself (check your key)InvalidRequestException - your request has invalid parametersAPIConnectionException - failure to connect to Stripe's APIAPIException - any other type of problem (for instance, a temporary issue with
Stripe's serverspublic PaymentIntent retrievePaymentIntentSynchronous(PaymentIntentParams paymentIntentParams, java.lang.String publishableKey) throws AuthenticationException, InvalidRequestException, APIConnectionException, APIException
PaymentIntent object.
Do not call this on the UI thread or your app will crash.paymentIntentParams - a set of params with which to retrieve the Payment IntentpublishableKey - a publishable API key to usePaymentIntent or null if a problem occurredAuthenticationExceptionInvalidRequestExceptionAPIConnectionExceptionAPIExceptionpublic PaymentIntent confirmPaymentIntentSynchronous(PaymentIntentParams paymentIntentParams, java.lang.String publishableKey) throws AuthenticationException, InvalidRequestException, APIConnectionException, APIException
PaymentIntent object.
Do not call this on the UI thread or your app will crash.paymentIntentParams - a set of params with which to confirm the Payment IntentpublishableKey - a publishable API key to usePaymentIntent or null if a problem occurredAuthenticationExceptionInvalidRequestExceptionAPIConnectionExceptionAPIExceptionpublic 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 APIAPIException - any other type of problem (for instance, a temporary issue with
Stripe's servers)CardExceptionpublic Token createPiiTokenSynchronous(java.lang.String personalId) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException
Token for PII. Do not call this on the UI thread
or your app will crash. The method uses the currently set mDefaultPublishableKey.personalId - the personal ID 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 APIAPIException - any other type of problem (for instance, a temporary issue with
Stripe's servers)CardExceptionpublic Token createPiiTokenSynchronous(java.lang.String personalId, java.lang.String publishableKey) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException
Token for PII. Do not call this on the UI thread
or your app will crash.personalId - the personal ID 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 APIAPIException - any other type of problem (for instance, a temporary issue with
Stripe's servers)CardExceptionpublic Token createAccountTokenSynchronous(AccountParams accountParams) throws AuthenticationException, InvalidRequestException, APIConnectionException, APIException
Token for a Connect Account. Do not call this on the UI
thread or your app will crash. The method uses the currently set
mDefaultPublishableKey.accountParams - params to use for this token.Token that can be used for this account.AuthenticationException - failure to properly authenticate yourself (check your key)InvalidRequestException - your request has invalid parametersAPIConnectionException - failure to connect to Stripe's APIAPIException - any other type of problem (for instance, a temporary issue with
Stripe's servers)public Token createAccountTokenSynchronous(AccountParams accountParams, java.lang.String publishableKey) throws AuthenticationException, InvalidRequestException, APIConnectionException, APIException
Token for a Connect Account. Do not call this on the UI
thread.accountParams - params to use for this token.publishableKey - the publishable key to use with this request. If null is passed in as
the publishable key, we will use the default publishable key.Token that can be used for this account.AuthenticationException - failure to properly authenticate yourself (check your key)InvalidRequestException - your request has invalid parametersAPIConnectionException - failure to connect to Stripe's APIAPIException - any other type of problem (for instance, a temporary issue with
Stripe's servers)public void logEventSynchronous(java.util.List<java.lang.String> productUsageTokens,
StripePaymentSource paymentSource)
public Source retrieveSourceSynchronous(java.lang.String sourceId, java.lang.String clientSecret) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException
Source from the Stripe API. Note that this is a
synchronous method, and cannot be called on the main thread. Doing so will cause your app
to crash. This method uses the default publishable key for this Stripe instance.sourceId - the Source.mId field of the desired Source objectclientSecret - the Source.mClientSecret field of the desired Source objectSource if one could be found based on the input params, or null if
no such Source could be found.AuthenticationException - failure to properly authenticate yourself (check your key)InvalidRequestException - your request has invalid parametersAPIConnectionException - failure to connect to Stripe's APIAPIException - any other type of problem (for instance, a temporary issue with
Stripe's servers)CardExceptionpublic Source retrieveSourceSynchronous(java.lang.String sourceId, java.lang.String clientSecret, java.lang.String publishableKey) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException
Source from the Stripe API. Note that this is a
synchronous method, and cannot be called on the main thread. Doing so will cause your app
to crash.sourceId - the Source.mId field of the desired Source objectclientSecret - the Source.mClientSecret field of the desired Source objectpublishableKey - a publishable API key to useSource if one could be found based on the input params, or null if
no such Source could be found.AuthenticationException - failure to properly authenticate yourself (check your key)InvalidRequestException - your request has invalid parametersAPIConnectionException - failure to connect to Stripe's APIAPIException - any other type of problem (for instance, a temporary issue with
Stripe's servers)CardExceptionpublic void setDefaultPublishableKey(java.lang.String publishableKey)
Stripe instance.publishableKey - the key to be setpublic void setStripeAccount(java.lang.String stripeAccount)
stripeAccount - the account ID to be set