PaymentSession

class PaymentSession

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.

Constructors

PaymentSession
Link copied to clipboard
fun PaymentSession(activity: ComponentActivity, config: PaymentSessionConfig)
Create a PaymentSession attached to the given host Activity.
PaymentSession
Link copied to clipboard
fun PaymentSession(fragment: Fragment, config: PaymentSessionConfig)
Create a PaymentSession attached to the given host Fragment.

Types

PaymentSessionListener
Link copied to clipboard
interface PaymentSessionListener
Represents a listener for PaymentSession actions, used to update the host activity when necessary.

Functions

clearPaymentMethod
Link copied to clipboard
fun clearPaymentMethod()
Clear the payment method associated with this PaymentSession in PaymentSessionData.
handlePaymentData
Link copied to clipboard
fun handlePaymentData(requestCode: Int, resultCode: Int, data: Intent?): Boolean
Method to handle Activity results from Stripe activities.
init
Link copied to clipboard
fun init(listener: PaymentSession.PaymentSessionListener)
Initialize the PaymentSession with a PaymentSessionListener to be notified of data changes.
onCompleted
Link copied to clipboard
fun onCompleted()
Notify this payment session that it is complete
presentPaymentMethodSelection
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.
presentShippingFlow
Link copied to clipboard
fun presentShippingFlow()
Launch the PaymentFlowActivity to allow the user to fill in payment details.
setCartTotal
Link copied to clipboard
fun setCartTotal(@IntRange(from = 0.toLong()cartTotal: Long)
Set the cart total for this PaymentSession.