Factory
Options
All keys are optional.fieldLayout shape
fields.holderName.hidden, fields.postalCode.hidden, or fields.cardSecurityCode.hidden.
fields
cardNumber
Set
fields.cardNumber.autoFocus: true to focus the card number field on mount.
Use acceptedBrands to restrict the brand icons that render alongside the card number ('auto' uses every brand your merchant configuration supports). acceptedBrandsPlacement controls where the brand row renders: 'inline' alongside the input, 'stacked' below it, or 'hidden' to omit it.
cardExpiration
cardSecurityCode
Hide the security code only for card programs that do not require CVC (for example, some private-label or corporate cards). Hiding it removes the field from validation.
holderName
The card element does not autofocus on mount unless
fields.cardNumber.autoFocus: true.
postalCode
Same shape as holderName. Default label 'Postal code'.
Value
The card element emits an encrypted value envelope ononSubmit. Sensitive fields are encrypted before they reach your handler.
encrypted* fields. holderName and postalCode are present only when the corresponding field is visible and non-empty. encryptedSecurityCode is always present — it is an empty string ('') when fields.cardSecurityCode.hidden is true.
Card error codes
CardonError events surface validation_failed, not_mounted, network, tokenization_failed, and unknown. See Error codes.
Events
Every element event is supported:onReady, onChange, onSubmit, onError, onFocus, onBlur, onEscapeKeyPressed. See Events overview.
FieldError.field values
'cardNumber', 'cardExpiration', 'cardSecurityCode', 'holderName', 'postalCode'.
Methods
card.mount(selector)card.update(partialOptions)card.submit(): void— validates and emitsonSubmit(encrypted envelope) oronError.card.unmount()card.destroy()card.on(event, handler)— subscribe to events.