Represents a single start-to-finish payment operation.

See Using Android basic integration for more information.

If PaymentSessionConfig.shouldPrefetchCustomer is true, and the customer has previously selected a payment method, PaymentSessionData.paymentMethod will be updated with the payment method and PaymentSessionListener.onPaymentSessionDataChanged will be called.


Link copied to clipboard
constructor(activity: ComponentActivity, config: PaymentSessionConfig)

Create a PaymentSession attached to the given host Activity.

constructor(fragment: Fragment, config: PaymentSessionConfig)

Create a PaymentSession attached to the given host Fragment.


Link copied to clipboard

Represents a listener for PaymentSession actions, used to update the host activity when necessary.


Link copied to clipboard

Clear the payment method associated with this PaymentSession in PaymentSessionData.

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

Method to handle Activity results from Stripe activities. Pass data here from your host's #onActivityResult(int, int, Intent) function.

Link copied to clipboard

Initialize the PaymentSession with a PaymentSessionListener to be notified of data changes. The reference to the listener will be released when the host (i.e. Activity or Fragment) is destroyed.

Link copied to clipboard

Notify this payment session that it is complete

Link copied to clipboard
fun presentPaymentMethodSelection(selectedPaymentMethodId: String? = null)

Launch the PaymentMethodsActivity to allow the user to select a payment method, or to add a new one.

Link copied to clipboard

Launch the PaymentFlowActivity to allow the user to fill in payment details.

Link copied to clipboard
fun setCartTotal(@IntRange(from = 0) cartTotal: Long)

Set the cart total for this PaymentSession. This should not include shipping costs.