Style the drop-in
Set the drop-in's colors for light and dark mode, its corners, borders, text size, Pay button, and card inputs.
By default, the drop-in follows the platform's native look, using system colors that adapt to light and dark mode, the app's tint on iOS or theme primary color on Android, and system fonts and lists. The appearance option of checkout.presentDropIn() changes that look. preset: 'web' starts from the look of Universal checkout in Pay.com.js instead, and anything else you set applies on top of the preset. The method rows always show Pay.com's logos.
Colors must be plain values (a hex string such as '#0D6B57', a color name, or a number). A PlatformColor or a dynamic color isn't supported, so give dark mode its own colors in colorsDark. Sizes are in points on iOS and dp on Android.
const result = await checkout.presentDropIn({
appearance: { colors: { primary: '#0D6B57' }, cornerRadius: 12 },
})Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
preset | 'system' | 'web' | No | 'system', the platform's look, or 'web', the look of Universal checkout in Pay.com.js. Default: 'system'. |
colors | PayDropInColors | No | The colors in light mode, and in dark mode for any color colorsDark doesn't set. See Colors. |
colorsDark | PayDropInColors | No | The colors in dark mode. |
cornerRadius | number | No | The lists' corner radius. |
borderWidth | number | No | The width of a border around each list, in the separator color. |
fontScale | number | No | Multiplies every text size. It must be above 0, and the customer's text size setting still applies. |
primaryButton | PayDropInPrimaryButton | No | The Pay button. See Pay button. |
rowStyle | 'checkmark' | 'radio' | No | How the selected method is marked. Default: 'checkmark' on iOS, 'radio' on Android. |
fieldStyle | PayFieldStyle | No | The card inputs, as for the card fields. Its colors are the same in light and dark mode. To keep dark mode, set colors instead. |
applePayButtonStyle | 'automatic' | 'black' | 'white' | 'whiteOutline' | No | The Apple Pay button's style (iOS only). Default: 'automatic', which follows light and dark mode. |
Colors
colors and colorsDark are PayDropInColors. Each color is an optional ColorValue, and one you leave out comes from the preset.
| Parameter | 'web' | What it colors |
|---|---|---|
primary | #1E1E1E | The selection, the Pay button, the card inputs' cursor, and the save-card switch when it's on. On Android, also Edit, Done, and a focused field's outline and label. On iOS, the switch stays the system's green until you set primary. Default: the app's tint on iOS, or its theme's primary color on Android. |
onPrimary | #FFFFFF | The Pay button's text and spinner. |
background | #FFFFFF | The sheet, behind the lists and the Pay button. On Android, also behind the card fields, which are outlined on it. |
surface | #FFFFFF | The method lists and the save-card switch's row. On iOS, also the card form. |
text | #1E1E1E | The title, the rows, what's typed in the card inputs, the switch's label, and the failure message. On iOS, the title follows it only with the web preset or once you set background. |
secondaryText | #6B6B6B | The section headers, subtitles, the default badge, and "or". On Android, also unselected radio buttons, and the fields' labels and placeholders. |
separator | #D5D5D5 | The lines between rows and beside "or", and the lists' borders. On iOS, also unselected radio circles and the lines between fields. On Android, also the field outlines. |
error | #D9372D | The errors under the fields, invalid card details, and the failure message's icon and tinted background. On Android, also the remove buttons. |
The web look
preset: 'web' is white, with bordered lists, corners of 8, and a near-black Pay button 48 high. It's light only. Some of its parts differ by platform:
- On iOS, rows have radio circles and Apple Pay's button is black. The Pay button has colors of its own, so set
primaryButton.backgroundColoralong withcolors.primary. - On Android, the card fields have a style of their own, with a
#6663D8outline when focused, so setfieldStyleto change them.
preset: 'system' on the left and preset: 'web' on the right, on iOS, then on Android:
Pay button
primaryButton is a PayDropInPrimaryButton. A value you leave out follows the platform's button.
| Parameter | Type | Required | Description |
|---|---|---|---|
backgroundColor | ColorValue | No | The button's color. |
textColor | ColorValue | No | The label's color. |
borderColor | ColorValue | No | The border's color. |
borderWidth | number | No | The border's width. |
cornerRadius | number | No | The corner radius. Default: a capsule on Android and iOS 26, and the system's rounded corners on earlier iOS versions. |
height | number | No | The button's minimum height. |
Errors
presentDropIn() rejects with a TypeError before the sheet opens when a value has an invalid type or range, such as a non-plain color, a size below 0, a fontScale of 0, or a preset, rowStyle, or applePayButtonStyle outside the allowed values.
Example
const result = await checkout.presentDropIn({
merchantDisplayName: 'My Shop',
appearance: {
colors: { primary: '#0D6B57', background: '#F4F6F5', surface: '#FFFFFF', text: '#1B1F1D' },
colorsDark: { primary: '#4FC3A1', background: '#000000', surface: '#1C1F1E', text: '#F4F6F5' },
cornerRadius: 12,
fontScale: 1.1,
primaryButton: { cornerRadius: 8, height: 50 },
rowStyle: 'radio',
},
})Next steps
- Change the drop-in's text: Translate the sheet, or change any of its text.
- Style the card fields: The
PayFieldStyleobjectfieldStyletakes. - Present the drop-in: The sheet's other options.