PaymentSheet

class PaymentSheet

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

Constructors

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

Constructor to be used when launching the payment sheet from an Activity.

Link copied to clipboard
fun PaymentSheet(fragment: Fragment, callback: PaymentSheetResultCallback)

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

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 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
data class Configuration @JvmOverloads constructor(    val merchantDisplayName: String,     val customer: PaymentSheet.CustomerConfiguration? = null,     val googlePay: PaymentSheet.GooglePayConfiguration? = null,     val primaryButtonColor: ColorStateList? = null,     val defaultBillingDetails: PaymentSheet.BillingDetails? = null,     val shippingDetails: AddressDetails? = null,     val allowsDelayedPaymentMethods: Boolean = false,     val appearance: PaymentSheet.Appearance = Appearance()) : Parcelable

Configuration for PaymentSheet

Link copied to clipboard
data class CustomerConfiguration(val id: String, val ephemeralKeySecret: String) : Parcelable
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(    val environment: PaymentSheet.GooglePayConfiguration.Environment,     val countryCode: String,     val currencyCode: String? = null) : Parcelable
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) : 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 the payment sheet to process a PaymentIntent. If the PaymentIntent is already confirmed, PaymentSheetResultCallback will be invoked with PaymentSheetResult.Completed.

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

Present the payment sheet to process a SetupIntent. If the SetupIntent is already confirmed, PaymentSheetResultCallback will be invoked with PaymentSheetResult.Completed.