Stripe

class Stripe

Entry-point to the Stripe SDK.

Supports asynchronous and synchronous methods to access the following Stripe APIs.

Constructors

Link copied to clipboard
constructor(context: Context, publishableKey: String, stripeAccountId: String? = null, enableLogging: Boolean = false, betas: Set<StripeApiBeta> = emptySet())

Constructor with publishable key and Stripe Connect account id.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun authenticateSource(activity: ComponentActivity, source: Source, stripeAccountId: String? = this.stripeAccountId)
fun authenticateSource(fragment: Fragment, source: Source, stripeAccountId: String? = this.stripeAccountId)

Authenticate a Source that requires user action via a redirect (i.e. Source.flow is Source.Flow.Redirect.

Link copied to clipboard
fun confirmAlipayPayment(confirmPaymentIntentParams: ConfirmPaymentIntentParams, authenticator: AlipayAuthenticator, stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<PaymentIntentResult>)

Confirm and authenticate a PaymentIntent using the Alipay SDK

Link copied to clipboard
suspend fun Stripe.confirmAlipayPayment(confirmPaymentIntentParams: ConfirmPaymentIntentParams, authenticator: AlipayAuthenticator, stripeAccountId: String? = this.stripeAccountId): PaymentIntentResult

Confirm and authenticate a PaymentIntent using the Alipay SDK

Link copied to clipboard
fun confirmPayment(activity: ComponentActivity, confirmPaymentIntentParams: ConfirmPaymentIntentParams, stripeAccountId: String? = this.stripeAccountId)
fun confirmPayment(fragment: Fragment, confirmPaymentIntentParams: ConfirmPaymentIntentParams, stripeAccountId: String? = this.stripeAccountId)

Confirm and, if necessary, authenticate a PaymentIntent. Used for automatic confirmation flow.

Link copied to clipboard
suspend fun Stripe.confirmPaymentIntent(confirmPaymentIntentParams: ConfirmPaymentIntentParams, idempotencyKey: String? = null): PaymentIntent

Suspend function to confirm a PaymentIntent object.

Link copied to clipboard

Blocking method to confirm a PaymentIntent object. Do not call this on the UI thread or your app will crash.

Link copied to clipboard
fun confirmSetupIntent(activity: ComponentActivity, confirmSetupIntentParams: ConfirmSetupIntentParams, stripeAccountId: String? = this.stripeAccountId)
fun confirmSetupIntent(fragment: Fragment, confirmSetupIntentParams: ConfirmSetupIntentParams, stripeAccountId: String? = this.stripeAccountId)

Confirm and, if necessary, authenticate a SetupIntent.

Link copied to clipboard
suspend fun Stripe.confirmSetupIntent(confirmSetupIntentParams: ConfirmSetupIntentParams, idempotencyKey: String? = null, expand: List<String> = emptyList()): SetupIntent

Suspend function to confirm a SetupIntent object.

Link copied to clipboard

Blocking method to confirm a SetupIntent object. Do not call this on the UI thread or your app will crash.

Link copied to clipboard
fun confirmWeChatPayPayment(confirmPaymentIntentParams: ConfirmPaymentIntentParams, stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<WeChatPayNextAction>)

Confirm a PaymentIntent for WeChat Pay. Extract params from WeChatPayNextAction to pass to WeChat Pay SDK.

Link copied to clipboard
suspend fun Stripe.confirmWeChatPayPayment(confirmPaymentIntentParams: ConfirmPaymentIntentParams, stripeAccountId: String? = this.stripeAccountId): WeChatPayNextAction

Suspend function to confirm a PaymentIntent for WeChat Pay. Extract params from WeChatPayNextAction to pass to WeChat Pay SDK.

Link copied to clipboard
fun createAccountToken(accountParams: AccountParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<Token>)

Create a Token asynchronously.

Link copied to clipboard
suspend fun Stripe.createAccountToken(accountParams: AccountParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Token

Create a Token from a coroutine.

Link copied to clipboard
fun createAccountTokenSynchronous(accountParams: AccountParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Token

Blocking method to create a Token for a Connect Account. Do not call this on the UI thread or your app will crash.

Link copied to clipboard
fun createBankAccountToken(bankAccountTokenParams: BankAccountTokenParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<Token>)

Create a BankAccount token asynchronously.

Link copied to clipboard
suspend fun Stripe.createBankAccountToken(bankAccountTokenParams: BankAccountTokenParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Token

Create a bank account token from a coroutine.

Link copied to clipboard
fun createBankAccountTokenSynchronous(bankAccountTokenParams: BankAccountTokenParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Token

Blocking method to create a Token for a BankAccount. Do not call this on the UI thread or your app will crash.

Link copied to clipboard
fun createCardToken(cardParams: CardParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<Token>)

Create a Card token asynchronously.

Link copied to clipboard
suspend fun Stripe.createCardToken(cardParams: CardParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Token

Create a Card token from a coroutine.

Link copied to clipboard
fun createCardTokenSynchronous(cardParams: CardParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Token

Blocking method to create a Token. Do not call this on the UI thread or your app will crash.

Link copied to clipboard
fun createCvcUpdateToken(@Size(min = 3, max = 4) cvc: String, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<Token>)

Create a CVC update token asynchronously.

Link copied to clipboard
suspend fun Stripe.createCvcUpdateToken(@Size(min = 3, max = 4) cvc: String, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Token

Create a CVC update token from a coroutine.

Link copied to clipboard
fun createCvcUpdateTokenSynchronous(cvc: String, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Token

Blocking method to create a Token for CVC updating. Do not call this on the UI thread or your app will crash.

Link copied to clipboard
fun createFile(fileParams: StripeFileParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<StripeFile>)

Create a file asynchronously

Link copied to clipboard
suspend fun Stripe.createFile(fileParams: StripeFileParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): StripeFile

Create a StripeFile from a coroutine.

Link copied to clipboard
fun createFileSynchronous(fileParams: StripeFileParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): StripeFile

Create a file synchronously

Link copied to clipboard
fun createPaymentMethod(paymentMethodCreateParams: PaymentMethodCreateParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<PaymentMethod>)

Create a PaymentMethod asynchronously.

Link copied to clipboard
suspend fun Stripe.createPaymentMethod(paymentMethodCreateParams: PaymentMethodCreateParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): PaymentMethod

Create a PaymentMethod from a coroutine.

Link copied to clipboard
fun createPaymentMethodSynchronous(paymentMethodCreateParams: PaymentMethodCreateParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): PaymentMethod

Blocking method to create a PaymentMethod object. Do not call this on the UI thread or your app will crash.

Link copied to clipboard
fun createPersonToken(params: PersonTokenParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<Token>)

Creates a single-use token that represents the details for a person. Use this when creating or updating persons associated with a Connect account. See the documentation to learn more.

Link copied to clipboard
suspend fun Stripe.createPersonToken(params: PersonTokenParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Token

Creates a single-use token that represents the details for a person. Use this when creating or updating persons associated with a Connect account. See the documentation to learn more.

Link copied to clipboard
fun createPersonTokenSynchronous(params: PersonTokenParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Token

Creates a single-use token that represents the details for a person. Use this when creating or updating persons associated with a Connect account. See the documentation to learn more.

Link copied to clipboard
fun createPiiToken(personalId: String, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<Token>)

Create a PII token asynchronously.

Link copied to clipboard
suspend fun Stripe.createPiiToken(personalId: String, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Token

Create a PII token from a coroutine.

Link copied to clipboard
fun createPiiTokenSynchronous(personalId: String, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Token

Blocking method to create a Token for PII. Do not call this on the UI thread or your app will crash.

Link copied to clipboard
fun createRadarSession(stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<RadarSession>, activity: AppCompatActivity? = null)

Create a Radar Session asynchronously.

Link copied to clipboard

Create a Radar Session.

Link copied to clipboard
fun createSource(sourceParams: SourceParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<Source>)

Create a Source asynchronously.

Link copied to clipboard
suspend fun Stripe.createSource(sourceParams: SourceParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Source

Create a Source from a coroutine.

Link copied to clipboard
fun createSourceSynchronous(params: SourceParams, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): Source

Blocking method to create a Source object. Do not call this on the UI thread or your app will crash.

Link copied to clipboard
suspend fun Stripe.getAuthenticateSourceResult(requestCode: Int, data: Intent): Source

Get the Source from Intent returned via Activity#onActivityResult(int, int, Intent)}} for Source authentication. (see Stripe.authenticateSource)

Link copied to clipboard
suspend fun Stripe.getPaymentIntentResult(requestCode: Int, data: Intent): PaymentIntentResult

Get the PaymentIntentResult from Intent returned via Activity#onActivityResult(int, int, Intent)}} for PaymentIntent automatic confirmation (see Stripe.confirmPayment) or manual confirmation (see Stripe.handleNextActionForPayment})

Link copied to clipboard
suspend fun Stripe.getSetupIntentResult(requestCode: Int, data: Intent): SetupIntentResult

Get the SetupIntentResult from Intent returned via Activity#onActivityResult(int, int, Intent)}} for SetupIntentResult confirmation. (see confirmSetupIntent)

Link copied to clipboard
fun handleNextActionForPayment(activity: ComponentActivity, clientSecret: String, stripeAccountId: String? = this.stripeAccountId)
fun handleNextActionForPayment(fragment: Fragment, clientSecret: String, stripeAccountId: String? = this.stripeAccountId)

Handle the next_action for a previously confirmed PaymentIntent.

Link copied to clipboard
fun handleNextActionForSetupIntent(activity: ComponentActivity, clientSecret: String, stripeAccountId: String? = this.stripeAccountId)
fun handleNextActionForSetupIntent(fragment: Fragment, clientSecret: String, stripeAccountId: String? = this.stripeAccountId)

Handle next_action for a previously confirmed SetupIntent. Used for manual confirmation flow.

Link copied to clipboard
fun isAuthenticateSourceResult(requestCode: Int, data: Intent?): Boolean

Check if the requestCode and Intent is for Source authentication. The Intent should be retrieved from the result from Activity#onActivityResult(int, int, Intent)}} by Activity started with authenticateSource.

Link copied to clipboard
fun isPaymentResult(requestCode: Int, data: Intent?): Boolean

Check if the requestCode and Intent is for PaymentIntentResult. The Intent should be retrieved from the result from Activity#onActivityResult(int, int, Intent)}} by Activity started with confirmPayment or handleNextActionForPayment.

Link copied to clipboard
fun isSetupResult(requestCode: Int, data: Intent?): Boolean

Check if the requestCode and Intent is for SetupIntentResult. The Intent should be retrieved from the result from Activity#onActivityResult(int, int, Intent)}} by Activity started with confirmSetupIntent.

Link copied to clipboard

The result of a call to authenticateSource.

Link copied to clipboard

Should be called via Activity#onActivityResult(int, int, Intent)}} to handle the result of a PaymentIntent automatic confirmation (see confirmPayment) or manual confirmation (see handleNextActionForPayment})

Link copied to clipboard

Should be called via Activity#onActivityResult(int, int, Intent)}} to handle the result of a SetupIntent confirmation (see confirmSetupIntent).

Link copied to clipboard
fun retrievePaymentIntent(clientSecret: String, stripeAccountId: String? = this.stripeAccountId, expand: List<String> = emptyList(), callback: ApiResultCallback<PaymentIntent>)

Retrieve a PaymentIntent asynchronously.

Link copied to clipboard
suspend fun Stripe.retrievePaymentIntent(clientSecret: String, stripeAccountId: String? = this.stripeAccountId, expand: List<String> = emptyList()): PaymentIntent

Retrieve a PaymentIntent from a coroutine.

Link copied to clipboard
fun retrievePaymentIntentSynchronous(clientSecret: String, stripeAccountId: String? = this.stripeAccountId, expand: List<String> = emptyList()): PaymentIntent

Blocking method to retrieve a PaymentIntent object. Do not call this on the UI thread or your app will crash.

Link copied to clipboard

Retrieve a list of possible brands for the given card number. Returns an error if the cardNumber length is less than 6 characters.

Link copied to clipboard

Retrieve a list of possible brands for the given card number. Returns an error if the cardNumber length is less than 6 characters.

Link copied to clipboard
fun retrieveSetupIntent(clientSecret: String, stripeAccountId: String? = this.stripeAccountId, expand: List<String> = emptyList(), callback: ApiResultCallback<SetupIntent>)

Retrieve a SetupIntent asynchronously.

Link copied to clipboard
suspend fun Stripe.retrieveSetupIntent(clientSecret: String, stripeAccountId: String? = this.stripeAccountId, expand: List<String> = emptyList()): SetupIntent

Retrieve a SetupIntent asynchronously.

Link copied to clipboard
fun retrieveSetupIntentSynchronous(clientSecret: String, stripeAccountId: String? = this.stripeAccountId, expand: List<String> = emptyList()): SetupIntent

Blocking method to retrieve a SetupIntent object. Do not call this on the UI thread or your app will crash.

Link copied to clipboard
fun retrieveSource(@Size(min = 1) sourceId: String, @Size(min = 1) clientSecret: String, stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<Source>)

Retrieve a Source asynchronously.

Link copied to clipboard
suspend fun Stripe.retrieveSource(@Size(min = 1) sourceId: String, @Size(min = 1) clientSecret: String, stripeAccountId: String? = this.stripeAccountId): Source

Retrieve a Source from a coroutine.

Link copied to clipboard
fun retrieveSourceSynchronous(@Size(min = 1) sourceId: String, @Size(min = 1) clientSecret: String, stripeAccountId: String? = this.stripeAccountId): Source

Retrieve an existing Source from the Stripe API. Do not call this on the UI thread or your app will crash.

Link copied to clipboard
fun updatePaymentMethod(paymentMethodId: String, paymentMethodUpdateParams: PaymentMethodUpdateParams, ephemeralKeySecret: String, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId, callback: ApiResultCallback<PaymentMethod>)

Update a PaymentMethod asynchronously.

Link copied to clipboard
suspend fun Stripe.updatePaymentMethod(paymentMethodId: String, paymentMethodUpdateParams: PaymentMethodUpdateParams, ephemeralKeySecret: String, idempotencyKey: String? = null, stripeAccountId: String? = this.stripeAccountId): PaymentMethod

Update a PaymentMethod from a coroutine.

Link copied to clipboard
fun verifyPaymentIntentWithMicrodeposits(clientSecret: String, firstAmount: Int, secondAmount: Int, callback: ApiResultCallback<PaymentIntent>)

Verify a customer's bank account with micro-deposits

Link copied to clipboard
suspend fun Stripe.verifyPaymentIntentWithMicrodeposits(clientSecret: String, descriptorCode: String): PaymentIntent
suspend fun Stripe.verifyPaymentIntentWithMicrodeposits(clientSecret: String, firstAmount: Int, secondAmount: Int): PaymentIntent

Suspend function to verify a customer's bank account with micro-deposits

Link copied to clipboard
fun verifySetupIntentWithMicrodeposits(clientSecret: String, firstAmount: Int, secondAmount: Int, callback: ApiResultCallback<SetupIntent>)

Verify a customer's bank account with micro-deposits

Link copied to clipboard
suspend fun Stripe.verifySetupIntentWithMicrodeposits(clientSecret: String, descriptorCode: String): SetupIntent
suspend fun Stripe.verifySetupIntentWithMicrodeposits(clientSecret: String, firstAmount: Int, secondAmount: Int): SetupIntent

Suspend function to verify a customer's bank account with micro-deposits