Style object reference
Complete reference for all keys accepted by the style parameter in checkout.universal().
The style parameter in checkout.universal() accepts a plain JavaScript object. Each key targets a specific region of the checkout form. All CSS property names must be in camelCase (for example, borderRadius, not border-radius). Values that aren't valid CSS properties are silently ignored.
For examples of how to apply these styles, see Customize the checkout.
Top-level keys
The style object accepts these keys at its top level. Simple keys accept CSS properties directly. Object keys have their own sub-keys, listed in Sub-key reference.
| Key | Type | Description |
|---|---|---|
base | CSS properties | Outermost wrapper of the entire form. Styles cascade into child regions unless a more specific key overrides them. |
submit | CSS properties | Main submit button at the bottom of the checkout form (the "Pay" button). |
savedPaymentMethods | CSS properties | Container wrapping the saved payment methods section. Only visible when the customer has saved cards. |
expressCheckout | CSS properties | Container wrapping the alternative payment method buttons (for example, Neosurf and paysafecard), the "Pay with" and "Pay with card" dividers, and the card form. |
apmButtons | CSS properties | Container wrapping wallet buttons (Google Pay and Apple Pay). |
cardForm | Object | Card input fields, checkboxes, and related elements. Nested inside expressCheckout. |
dividers | Object | Horizontal divider lines with text labels that separate form sections. |
existingSource | Object | Saved card rows, radio buttons, CVV re-entry field, and deletion UI. |
paymentMethodFields | Object | Input fields that APMs render in the radio layout (alternatives: 'radio'), for example the iDEAL bank selector. |
Sub-key reference
Each object key takes the sub-keys in its section.
Card form fields (cardForm)
Controls the card input fields and checkboxes. Styles applied to base affect all four card fields as a group. Use individual field keys to target each field separately.
| Key | Type | Description |
|---|---|---|
base | CSS properties | Shared container around all four card fields. |
number | CSS properties | Card number input field (input text and background only). |
cvv | CSS properties | CVV input field (input text and background only). |
expiry | CSS properties | Expiration date input field (input text and background only). |
name | CSS properties | Cardholder name input field (input text and background only). |
number[':focus'] | { borderColor: string } | Focus state for the card number field. Sets the focus border color and tints the focus ring to match. Only borderColor is read. Error and warning states take priority. |
expiry[':focus'] | { borderColor: string } | Focus state for the expiration field. Same behavior as number[':focus']. |
cvv[':focus'] | { borderColor: string } | Focus state for the CVV field. Same behavior as number[':focus']. |
name[':focus'] | { borderColor: string } | Focus state for the cardholder name field. Same behavior as number[':focus']. |
submit | CSS properties | Reserved for the submit button inside the card form. |
checkboxes.buttonBackground | string | Background color of checkbox buttons, for example "Save card for future use". |
checkboxes.labelColor | string | Text color of checkbox labels. |
Card form configuration (cardForm.formConfig)
formConfig is passed directly inside cardForm on checkout.universal(). It isn't part of the style object. Use it to control labels, placeholders, error message styles, and input sizes for each card field.
checkout.universal({
container: '#payment_container',
cardForm: {
formConfig: { ... }
}
})formConfig.base accepts these keys:
| Key | Type | Description |
|---|---|---|
formTitle | string | Title displayed at the top of the card form section. |
titleStyles | CSS properties | Style for the form title text. |
inputSpacing | string | Vertical spacing between fields, for example '16px'. |
To style the wrapper around the card fields, use style.cardForm.base.
formConfig.number, formConfig.expiry, formConfig.cvv, formConfig.name each accept:
| Key | Type | Description |
|---|---|---|
label | string | Label text shown above the input. |
labelStyle | CSS properties | Color, font size, weight, and other styles for the label. |
placeholder | string | Placeholder text shown inside the input when empty. |
errorMessageStyle | CSS properties | Style for the inline validation error message. |
inputSize | 'small' | 'medium' | 'large' | Controls the height of the input field. |
style | CSS properties | Additional styles applied to the input element itself. |
Section dividers (dividers)
Controls the horizontal lines with text labels that separate sections of the checkout form.
| Key | Description |
|---|---|
dividers.payWith | "Pay with" divider between the wallet button and the alternative payment method buttons. |
dividers.payWithCard | "Pay with card" divider between the alternative payment method buttons and the card form. |
dividers.savedPaymentMethods | "Saved payment methods" divider above the saved payment methods list. Only visible when the customer has saved cards. |
dividers.showOtherWaysToPay | "Show other ways to pay" divider that appears when a customer has saved cards. Clicking it expands the full form with APMs and the card form. |
Each divider accepts these sub-keys:
| Sub-key | Type | Description |
|---|---|---|
text | CSS properties | Text label displayed on the divider. |
divider | CSS properties | The horizontal line, including color and height. |
Saved card rows (existingSource)
Controls how saved card rows and their related UI appear when a returning customer has stored payment methods.
| Key | Type | Description |
|---|---|---|
base | CSS properties | Default appearance of each saved card row. |
base[':selected'] | CSS properties | Appearance of the currently selected saved card row. |
radioButton.color | string | Default color of the radio button. |
radioButton[':selected'].color | string | Color of the radio button when that card row is selected. |
cvv.style | CSS properties | CVV re-entry input field shown when a saved card is selected. |
cvv.errorMessageStyle | CSS properties | Validation error text below the CVV field. |
icons.delete | CSS properties | Delete icon in its default state. |
icons.confirmDeletion | CSS properties | Confirm icon shown when the customer starts a deletion. |
icons.cancelDeletion | CSS properties | Cancel icon shown when the customer starts a deletion. |
deleteText | CSS properties | Confirmation message shown when the customer starts a deletion. |
To style the label of the CVV re-entry field, use cardForm.formConfig.cvv.labelStyle, which is outside the style object.
APM input styles (paymentMethodFields)
Styles the input fields that APMs render in the radio layout (alternatives: 'radio' on checkout.universal()). It has no effect in the default button layout.
| Key | Type | Description |
|---|---|---|
label | CSS properties | Labels above APM input fields. |
input | CSS properties | Text input fields. |
date | CSS properties | Date input fields. |
radio.color | string | Color of radio button indicators. |
radio.label | CSS properties | Labels next to radio buttons. |
select | CSS-in-JS properties | Select (dropdown) elements. |
checkbox | Object | Checkbox elements. |
Next steps
- Customize the checkout: See worked examples of every style key applied to a real checkout form.
- Render the checkout form: Every option of
checkout.universal(), includingstyle.