Skip to Content
Docs

Style the drop-in

Set the drop-in's colors for light and dark mode, its corners, borders, and fonts, its Pay button, its method rows, and its card fields.

PayDropInAppearance sets how the drop-in looks. By default, the sheet uses Material 3 with a color scheme that follows light and dark mode, applies your app theme's colorPrimary when set, and renders radio-button list items, outlined card fields, and a filled Pay button. Method rows show Pay.com's logos. Change only what you need, pass your Compose app's color schemes, or start from PayDropInAppearance.Web, the look of Universal checkout in Pay.com.js.

Pass it as the drop-in's appearance. Its texts are in PayDropInStrings.

val appearance = PayDropInAppearance(cornerRadius = 8.dp, rowStyle = PayDropInAppearance.RowStyle.CHECKMARK)
val dropIn = PayDropIn(checkout, PayDropIn.Configuration(appearance = appearance))

Parameters

ParameterTypeRequiredDescription
colorsLightPayDropInColorsNoThe colors in light mode. See PayDropInColors. Default: PayDropInColors(), all from the Material 3 scheme.
colorsDarkPayDropInColorsNoThe colors in dark mode. Default: PayDropInColors().
colorModePayDropInAppearance.ColorModeNoSYSTEM follows the device's dark theme setting. LIGHT and DARK fix the mode. Default: SYSTEM.
dynamicColorBooleanNoOn Android 12 and later, takes the colors you leave null from the wallpaper (Material You), instead of the baseline scheme and your colorPrimary. Default: false.
cornerRadiusDp?NoThe corner radius of the method lists and the save-card switch. Default: null, for Material 3's large shape (16 dp).
borderWidthDpNoA border around each list, in the separator color. Default: 0.dp, no border.
elevationDpNoA shadow under each list. Default: 0.dp, no shadow.
fontFamilyFontFamily?NoThe font of every text in the sheet, the card fields included. Default: null, the system font.
fontScaleFloatNoMultiplies every text size. The device's font size setting still applies on top. Default: 1f.
primaryButtonPayDropInPrimaryButtonNoThe Pay button. See PayDropInPrimaryButton. Default: PayDropInPrimaryButton().
rowStylePayDropInAppearance.RowStyleNoHow the selected method is marked (RADIO for a radio button on every row, or CHECKMARK for a check mark on the selected row only). Default: RADIO.
methodIconsMap<String, Int>NoDrawable resource IDs for the method rows, by payment method type, for example your own artwork for paypal. They're drawn at 24 dp, in their own colors. Rows without one show Pay.com's logo for the method, or its monogram. Default: none.
fieldStylePayFieldStyle?NoThe card fields' style. See Style the card fields. fontFamily applies to it when its textStyle sets no font. Default: null, for Material 3 outlined fields in the sheet's colors.

PayDropInColors

The sheet's colors for one mode. Each is an optional Color?, and one you leave null comes from the Material 3 scheme's role below. PayDropInColors.from(scheme) takes every color from a Compose ColorScheme, with surface from its surfaceContainerHighest.

ParameterDefaultWebWhat it colors
primaryYour theme's colorPrimary, else primary#1E1E1EThe selection, the Pay button, the save-card switch when it's on, Edit and Done, and a focused field's outline, label, and cursor.
onPrimaryonPrimary, or near-black or white on your own primary#FFFFFFThe Pay button's text and spinner, and the switch's thumb when it's on.
backgroundsurfaceContainerLow#FFFFFFThe sheet, behind the lists and the card fields.
surfacesurfaceContainerHigh#FFFFFFThe method lists and the save-card switch's row. Not the card fields, which are outlined on background.
textonSurface#1E1E1EThe title, the close button, the rows' titles, what's typed in the fields, the switch's label, and the failure message.
secondaryTextonSurfaceVariant#6B6B6BThe section headers, subtitles, the Default badge, "or", unselected radio buttons, the fields' labels and placeholders, and the spinner on a row that's being removed.
separatoroutlineVariant#D5D5D5The lines between rows and beside "or", the lists' borders, and the field outlines.
errorerror#D9372DThe errors under the fields, invalid fields, the failure message's icon and tinted background, and the remove buttons.

PayDropInPrimaryButton

The Pay button. The Google Pay button takes its height and corners too.

ParameterTypeRequiredDescription
backgroundColorColor?NoThe button's color. Default: null, for primary.
textColorColor?NoIts text and spinner. Default: null, for onPrimary.
cornerRadiusDp?NoIts corners. Default: null, fully rounded as Material 3 buttons are.
borderColorColor?NoA border, drawn when borderWidth is more than 0. Default: null.
borderWidthDpNoThe border's width. Default: 0.dp.
heightDpNoIts minimum height. Default: 56.dp.

PayDropInAppearance.Web

Matches the appearance of Universal checkout in Pay.com.js with a white surface, bordered lists, 8 dp corners, and a near-black 48 dp Pay button. It's light only. Its card fields have a style of their own, with a #6663D8 outline when focused, so the colors don't reach them. To change them, set fieldStyle. Change any part of the look with copy.

Material 3's default look, and PayDropInAppearance.Web:

Illustration of the Android drop-in for a new customer twice: on the left with Material 3's default look (tinted sheet, purple radios and Pay button), on the right with the Web preset (white sheet, bordered lists with small corners, black radios, near-black Google Pay and Pay buttons).

Example

In a Compose app, give the sheet your theme's colors and font:

val appearance = PayDropInAppearance(
    colorsLight = PayDropInColors.from(shopLightColorScheme),
    colorsDark = PayDropInColors.from(shopDarkColorScheme),
    fontFamily = FontFamily(Font(R.font.inter_regular), Font(R.font.inter_medium, FontWeight.Medium)),
    primaryButton = PayDropInPrimaryButton(cornerRadius = 12.dp),
    methodIcons = mapOf("paypal" to R.drawable.ic_paypal),
)
val dropIn = PayDropIn(checkout, PayDropIn.Configuration(appearance = appearance))

Or start from the web look:

val appearance = PayDropInAppearance.Web.copy(fontFamily = FontFamily(Font(R.font.inter_regular)))

Next steps

Was this page helpful?