Card form
Style the card input fields, field labels, placeholders, error messages, submit buttons, and checkboxes in the Universal checkout form.
The cardForm key in the style object controls the card input
area of the checkout form. You can customize this area in several
ways:
- Input field styling: Set colors, borders, and backgrounds on card fields as a group or individually.
- Labels, placeholders, and error messages: Control text content and styles for each field using
formConfig. - Toggles: Show or hide elements like the cardholder name, save-card checkbox, or the submit button.
- Submit button: Style the main "Pay" button or replace it with your own.
- Checkboxes: Style the save-card and terms checkboxes.
Style card input fields
The checkout form has four card input fields: card number, expiration date, CVV, and cardholder name. You can style them in two ways:
- As a group: Use
cardForm.baseto apply a shared background, padding, or border around all four fields. - Individually: Use
cardForm.number,cardForm.expiry,cardForm.cvv, andcardForm.nameto target each field.

Style all fields as a group
Use cardForm.base to set shared styles on the container around
all four fields:
style: {
cardForm: {
base: {
backgroundColor: '#ffffff',
borderRadius: '10px',
padding: '16px',
}
}
}Style individual fields
Use cardForm.number, cardForm.expiry, cardForm.cvv, and
cardForm.name to target each field separately:
style: {
cardForm: {
number: {
backgroundColor: '#ffffff',
color: '#111827',
border: '1px solid #d1d5db',
borderRadius: '8px',
fontSize: '15px',
},
expiry: {
border: '1px solid #d1d5db',
borderRadius: '8px',
},
cvv: {
border: '1px solid #d1d5db',
borderRadius: '8px',
},
name: {
border: '1px solid #d1d5db',
borderRadius: '8px',
}
}
}Style the focus state
Use the ':focus' key inside any individual field to set a custom
border color when the field is focused. The borderColor value
also tints the focus ring to match.
const field = {
backgroundColor: '#000',
':focus': { borderColor: '#32E34B' }
}
checkout.universal({
container: '#universal',
style: {
cardForm: {
number: field,
expiry: field,
cvv: field,
name: field,
}
}
})Your account manager can also save the same configuration on your account, as JSON:
{
"style": {
"cardForm": {
"number": { ":focus": { "borderColor": "#32E34B" } },
"expiry": { ":focus": { "borderColor": "#32E34B" } },
"cvv": { ":focus": { "borderColor": "#32E34B" } },
"name": { ":focus": { "borderColor": "#32E34B" } }
}
}
}Customize field labels, placeholders, and error messages
Use cardForm.formConfig to control the label text, label styles,
placeholder text, error message styles, and input size for each
card field. This is a separate parameter on checkout.universal(),
not part of the style object.

Labels sit above each field, placeholders appear inside the input when it is empty, and error messages appear below the field when validation fails.
checkout.universal({
container: '#payment_container',
cardForm: {
formConfig: {
base: {
formTitle: 'Pay with card',
titleStyles: {
color: '#111827',
fontSize: '16px',
fontWeight: '600',
},
inputSpacing: '16px',
},
number: {
label: 'Card number',
labelStyle: {
color: '#6b7280',
fontSize: '13px',
fontWeight: '500',
},
placeholder: '1234 5678 9012 3456',
errorMessageStyle: {
color: '#f87171',
fontSize: '12px',
},
inputSize: 'medium',
},
expiry: {
label: 'Expiry date',
labelStyle: { color: '#6b7280' },
},
cvv: {
label: 'CVV',
labelStyle: { color: '#6b7280' },
},
name: {
label: 'Cardholder name',
labelStyle: { color: '#6b7280' },
},
}
}
})For a full list of accepted formConfig properties, see the
style object reference.
Configure card form toggles
Card form toggles control which elements appear in the card form.
Pass a toggles object inside cardForm on checkout.universal()
to turn individual fields and behaviors on or off.
| Key | Default | Description |
|---|---|---|
withTitle | true | Hide the form title when false. |
withCardHolderName | true | Hide the cardholder name field when false. |
formWrapper | true | Use a <div> wrapper instead of <form> when false. Useful when embedding the card form inside a larger form on your page. |
saveSourceForFutureUseCheckbox | false | Show a "save card for future use" checkbox. |
acceptTermsAndConditionsCheckbox | false | Show an "accept terms and conditions" checkbox. |
disableAdditionalFields | false | Hide additional fields (for example, email for EU 3DS) when true. |
nativeCheckboxes | false | Render native browser checkboxes instead of Pay.com-styled checkboxes. |
mobileColumn | false | Stack all fields into a single column on mobile. |
withCardNumberBrand | false | Show the card brand logo on the card number input. |
withCvvTooltip | false | Show a tooltip on the CVV input. |
To hide the built-in submit button, pass toggles: { submitButton: false } at the top level of checkout.universal(), not in cardForm.toggles (see Use a custom submit button).
checkout.universal({
container: '#pay-com-checkout',
cardForm: {
toggles: {
withCardHolderName: false,
saveSourceForFutureUseCheckbox: true,
withCvvTooltip: true,
}
}
})To style the checkboxes enabled by saveSourceForFutureUseCheckbox
or acceptTermsAndConditionsCheckbox, use the cardForm.checkboxes
key in the style object. See Style checkboxes.
Style the submit button
The top-level submit key styles the main "Pay" button at the
bottom of the checkout form.

style: {
submit: {
backgroundColor: '#2563eb',
color: '#ffffff',
borderRadius: '8px',
fontSize: '15px',
fontWeight: '700',
padding: '14px',
}
}If you use a custom submit button with toggles: { submitButton: false },
you don't need to style submit.
Use a custom submit button
When you hide the built-in button with
toggles: { submitButton: false }, wire your own button to call
checkout.validate()
first, then
checkout.submit()
only if validation passes.
checkout.universal({
container: '#pay-com-checkout',
toggles: { submitButton: false }
})
// On your own button's click handler:
document.getElementById('my-pay-button')
.addEventListener('click', async () => {
const { valid, invalidFields } = await checkout.validate()
if (!valid) {
console.log('Fix these fields:', invalidFields)
return
}
await checkout.submit()
})Skipping the checkout.validate() step submits the form without
checking for empty or invalid fields, which can lead to failed
payments.
Style checkboxes
If your card form includes checkboxes (enabled via
toggles), use
cardForm.checkboxes to style them:

style: {
cardForm: {
checkboxes: {
buttonBackground: '#2563eb',
labelColor: '#111827',
}
}
}Next steps
Related checkout customization guides:
- Payment methods: Style wallet buttons, the payment form container, and section dividers.
- Saved payment methods: Style saved card rows and the CVV re-entry field.
- Style object reference: Full list of every accepted key and CSS property.