Style the drop-in
Change the drop-in's colors, fonts, list shapes, Pay button, and method icons, or start from Pay.com's web look.
PayDropInAppearance sets how the drop-in looks. Its defaults follow the system appearance, using dynamic colors for light and dark mode, your app's tint for the selection and Pay button, system fonts with Dynamic Type, and inset-grouped lists. Method rows show Pay.com's logos. Change the properties you want, or start from PayDropInAppearance.web, the look of Universal checkout in Pay.com.js, and pass it as the configuration's appearance.
Colors are UIColor values, so a dynamic color, such as one from your asset catalog, keeps its own light and dark values. PayDropInAppearance is a struct used on the main actor.
var appearance = PayDropInAppearance()
appearance.colors.primary = .systemIndigo
configuration.appearance = appearanceProperties
| Property | Type | Default | Description |
|---|---|---|---|
colors | PayDropInAppearance.Colors | System colors | The sheet's colors. See Colors. |
font | PayDropInAppearance.Font | The system font | Sets the sheet's typography. base is the font used for sizes and weights (nil uses the system font), and sizeScale multiplies every text size on top of Dynamic Type. Default: Font(base: nil, sizeScale: 1). |
cornerRadius | CGFloat? | nil | The lists' corner radius. Uses the system's inset-grouped radius when nil. |
borderWidth | CGFloat | 0 | A border around each list in colors.separator. 0 draws no border, matching system lists. |
shadow | PayDropInAppearance.Shadow? | nil | A shadow under each list, with color (default black), opacity (0.08), offset (0 by 2), and radius (6). Draws no shadow when nil. |
primaryButton | PayDropInAppearance.PrimaryButton | The system style | The Pay button. See Pay button. |
rowStyle | PayDropInAppearance.RowStyle | .checkmark | How the selected method is marked (.checkmark on the selected row, as in Settings, or .radio for a radio circle on every row). |
methodIcons | [String: UIImage] | [:] | Your own icons for method rows, by API type, for example your artwork for paypal. They're drawn in their own colors, at up to 40 by 28 points. A type without one shows Pay.com's logo for the method, or its monogram. |
fieldStyle | PayFieldStyle? | nil | The card inputs' style. See Style the card fields. When nil, inherits colors and font without individual borders because the form draws the lines between fields. |
applePayButtonStyle | PKPaymentButtonStyle | .automatic | The Apple Pay button's style. .automatic follows light and dark mode, and .black, .white, and .whiteOutline don't. Its height and corners follow primaryButton. |
resolvedFieldStyle | PayFieldStyle | Read-only resolved style for the card inputs, using fieldStyle or the style derived from colors and font. |
Colors
Each color defaults to a system color, and .web sets a fixed one.
| Property | Default | .web | What it colors |
|---|---|---|---|
primary | .tintColor | #1E1E1E | The selection mark, the Pay button, and the card inputs' cursor. Once you change it, also the save-card switch when it's on, which is the system's green otherwise. |
onPrimary | .white | #FFFFFF | The Pay button's text and spinner. |
background | .systemGroupedBackground | #FFFFFF | The sheet, with its title bar and the bar behind the Pay button. |
surface | .secondarySystemGroupedBackground | #FFFFFF | The method lists, the card form, and the save-card switch's row. |
text | .label | #1E1E1E | The rows' titles, what's typed in the card inputs, the switch's label, and the failure message. The sheet's title too, once you change background or the base font. |
secondaryText | .secondaryLabel | #6B6B6B | The section headers, subtitles, the default badge, "or", and the spinner on a row that's being removed. |
placeholder | .placeholderText | #ACACAC | The card inputs' placeholders. |
separator | .separator | #D5D5D5 | The lines between rows, between fields, and beside "or", the lists' borders, and unselected radio circles. |
error | .systemRed | #D9372D | The errors under the fields, invalid card details, and the failure message's icon and tinted background. The remove controls stay the system's red. |
Pay button
primaryButton styles the Pay button.
| Property | Type | Default | Description |
|---|---|---|---|
backgroundColor | UIColor? | nil | Button background color. Uses colors.primary when nil. |
textColor | UIColor? | nil | Button text and spinner color. Uses colors.onPrimary when nil. |
cornerRadius | CGFloat? | nil | Button corner radius. Uses the system shape (capsule on iOS 26 and later, rounded on earlier versions) when nil. |
borderColor | UIColor? | nil | Drawn when borderWidth is above 0. |
borderWidth | CGFloat | 0 | Border width around the button. |
height | CGFloat | 50 | The minimum height. The Apple Pay button takes it too. |
font | UIFont? | nil | Button label font. Uses the system font when nil. |
On iOS 26 and later, the Pay button uses the system's Liquid Glass style. Set any of its colors, cornerRadius, a border, or font, and it's drawn with those instead.
The web look
PayDropInAppearance.web matches the look of Universal checkout in Pay.com.js, featuring white surfaces, bordered lists with 8-point corners, a near-black Pay button 48 points tall, radio rows, and a black Apple Pay button. Its colors are fixed, so they don't follow dark mode. Its Pay button has colors of its own. To change them, set primaryButton.backgroundColor and primaryButton.textColor along with primary and onPrimary.
The system look, and PayDropInAppearance.web:
Example
import PayDropIn
import UIKit
var appearance = PayDropInAppearance.web
appearance.colors.primary = UIColor(named: "Brand") ?? .systemIndigo
appearance.primaryButton.backgroundColor = appearance.colors.primary
appearance.font = PayDropInAppearance.Font(base: UIFont(name: "AvenirNext-Regular", size: 17))
if let logo = UIImage(named: "PayPalLogo") {
appearance.methodIcons["paypal"] = logo
}
let dropIn = PayDropIn(checkout: checkout, configuration: .init(appearance: appearance))Next steps
- Change the drop-in's text: Replace or translate every text.
- Present the drop-in: The rest of the configuration.