PaymentSheet

A drop-in class that presents a bottom sheet to collect and process a customer's payment.

Constructors

Link copied to clipboard
constructor(activity: ComponentActivity, callback: PaymentSheetResultCallback)

Constructor to be used when launching PaymentSheet from a ComponentActivity.

constructor(activity: ComponentActivity, externalPaymentMethodConfirmHandler: ExternalPaymentMethodConfirmHandler, callback: PaymentSheetResultCallback)

Constructor to be used when launching PaymentSheet from a ComponentActivity and external payment methods are specified in your Configuration.

constructor(activity: ComponentActivity, createIntentCallback: CreateIntentCallback, paymentResultCallback: PaymentSheetResultCallback)

Constructor to be used when launching PaymentSheet from a ComponentActivity and intending to create and optionally confirm the PaymentIntent or SetupIntent on your server.

constructor(activity: ComponentActivity, createIntentCallback: CreateIntentCallback, externalPaymentMethodConfirmHandler: ExternalPaymentMethodConfirmHandler, paymentResultCallback: PaymentSheetResultCallback)

Constructor to be used when launching PaymentSheet from a ComponentActivity and intending to create and optionally confirm the PaymentIntent or SetupIntent on your server and external payment methods are specified in your Configuration.

constructor(fragment: Fragment, callback: PaymentSheetResultCallback)

Constructor to be used when launching the payment sheet from a Fragment.

constructor(fragment: Fragment, externalPaymentMethodConfirmHandler: ExternalPaymentMethodConfirmHandler, callback: PaymentSheetResultCallback)

Constructor to be used when launching the payment sheet from a Fragment and external payment methods are specified in your Configuration.

constructor(fragment: Fragment, createIntentCallback: CreateIntentCallback, paymentResultCallback: PaymentSheetResultCallback)

Constructor to be used when launching PaymentSheet from a Fragment and intending to create and optionally confirm the PaymentIntent or SetupIntent on your server.

constructor(fragment: Fragment, createIntentCallback: CreateIntentCallback, externalPaymentMethodConfirmHandler: ExternalPaymentMethodConfirmHandler, paymentResultCallback: PaymentSheetResultCallback)

Constructor to be used when launching PaymentSheet from a Fragment and intending to create and optionally confirm the PaymentIntent or SetupIntent on your server and external payment methods are specified in your Configuration.

Types

Link copied to clipboard
data class Address(val city: String? = null, val country: String? = null, val line1: String? = null, val line2: String? = null, val postalCode: String? = null, val state: String? = null) : Parcelable
Link copied to clipboard
data class Appearance(val colorsLight: PaymentSheet.Colors = Colors.defaultLight, val colorsDark: PaymentSheet.Colors = Colors.defaultDark, val shapes: PaymentSheet.Shapes = Shapes.default, val typography: PaymentSheet.Typography = Typography.default, val primaryButton: PaymentSheet.PrimaryButton = PrimaryButton()) : Parcelable
Link copied to clipboard
data class BillingDetails(val address: PaymentSheet.Address? = null, val email: String? = null, val name: String? = null, val phone: String? = null) : Parcelable
Link copied to clipboard
data class BillingDetailsCollectionConfiguration(val name: PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode = CollectionMode.Automatic, val phone: PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode = CollectionMode.Automatic, val email: PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode = CollectionMode.Automatic, val address: PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode = AddressCollectionMode.Automatic, val attachDefaultsToPaymentMethod: Boolean = false) : Parcelable

Configuration for how billing details are collected during checkout.

Link copied to clipboard
class Builder(resultCallback: PaymentSheetResultCallback)

Builder to add optional callbacks to PaymentSheet.

Link copied to clipboard

Options to block certain card brands on the client

Link copied to clipboard
data class Colors(@ColorInt val primary: Int, @ColorInt val surface: Int, @ColorInt val component: Int, @ColorInt val componentBorder: Int, @ColorInt val componentDivider: Int, @ColorInt val onComponent: Int, @ColorInt val onSurface: Int, @ColorInt val subtitle: Int, @ColorInt val placeholderText: Int, @ColorInt val appBarIcon: Int, @ColorInt val error: Int) : Parcelable
Link copied to clipboard
object Companion
Link copied to clipboard

Configuration for PaymentSheet

Link copied to clipboard
Link copied to clipboard
interface FlowController

A class that presents the individual steps of a payment sheet flow.

Link copied to clipboard
data class GooglePayConfiguration @JvmOverloads constructor(val environment: PaymentSheet.GooglePayConfiguration.Environment, val countryCode: String, val currencyCode: String? = null, val amount: Long? = null, val label: String? = null, val buttonType: PaymentSheet.GooglePayConfiguration.ButtonType = ButtonType.Pay) : Parcelable
Link copied to clipboard
class IntentConfiguration @JvmOverloads constructor(val mode: PaymentSheet.IntentConfiguration.Mode, val paymentMethodTypes: List<String> = emptyList(), val paymentMethodConfigurationId: String? = null, val onBehalfOf: String? = null, requireCvcRecollection: Boolean = false) : Parcelable

Contains information needed to render PaymentSheet. The values are used to calculate the payment methods displayed and influence the UI.

Link copied to clipboard

Defines the layout orientations available for displaying payment methods in PaymentSheet.

Link copied to clipboard
data class PrimaryButton(val colorsLight: PaymentSheet.PrimaryButtonColors = PrimaryButtonColors.defaultLight, val colorsDark: PaymentSheet.PrimaryButtonColors = PrimaryButtonColors.defaultDark, val shape: PaymentSheet.PrimaryButtonShape = PrimaryButtonShape(), val typography: PaymentSheet.PrimaryButtonTypography = PrimaryButtonTypography()) : Parcelable
Link copied to clipboard
data class PrimaryButtonColors(@ColorInt val background: Int?, @ColorInt val onBackground: Int, @ColorInt val border: Int, @ColorInt val successBackgroundColor: Int = PRIMARY_BUTTON_SUCCESS_BACKGROUND_COLOR.toArgb(), @ColorInt val onSuccessBackgroundColor: Int = onBackground) : Parcelable
Link copied to clipboard
data class PrimaryButtonShape(val cornerRadiusDp: Float? = null, val borderStrokeWidthDp: Float? = null) : Parcelable
Link copied to clipboard
data class PrimaryButtonTypography(@FontRes val fontResId: Int? = null, val fontSizeSp: Float? = null) : Parcelable
Link copied to clipboard
data class Shapes(val cornerRadiusDp: Float, val borderStrokeWidthDp: Float) : Parcelable
Link copied to clipboard
data class Typography(val sizeScaleFactor: Float, @FontRes val fontResId: Int?) : Parcelable

Functions

Link copied to clipboard
fun presentWithPaymentIntent(paymentIntentClientSecret: String, configuration: PaymentSheet.Configuration? = null)

Present PaymentSheet to process a PaymentIntent.

Link copied to clipboard
fun presentWithSetupIntent(setupIntentClientSecret: String, configuration: PaymentSheet.Configuration? = null)

Present PaymentSheet to process a SetupIntent.