Skip to main content

<primer-card-form>

Container for card payment inputs. Provides context to child components, handles validation, and manages form submission. Uses secure iframes for PCI compliance.

Quick reference


Examples

Default layout

Renders all card inputs automatically:
Renders: Card number, expiry, CVV, cardholder name, and submit button.

Disabled state

Hidden labels

Custom layout

With error container


Properties


Events

Emitted events

Listened events

External submit example:
Note: bubbles: true and composed: true are required for shadow DOM traversal.

Slots


Methods


CSS properties


Dependencies

Internally uses:

Cardholder name configuration


Co-branded card schemes

Supports co-branded cards like Cartes Bancaires (CB). Network switcher displays automatically when detected. No configuration needed.

Submit options


Validation

  1. Validates all inputs on submission
  2. If invalid, dispatches primer:card-error
  3. Child inputs display error messages
  4. If valid, proceeds with payment

States


Usage guidelines

Do

  • Place all card inputs inside <primer-card-form>
  • Include <primer-error-message-container> for payment failures
  • Use primer:card-submit event for external submit buttons
  • Configure cardholder name via SDK options

Don’t

  • Don’t use alongside <primer-payment-method type="PAYMENT_CARD"> (causes duplicates)
  • Don’t place card inputs outside the form
  • Don’t use multiple card forms on one page
Using both <primer-card-form> and <primer-payment-method type="PAYMENT_CARD"> in the same layout creates duplicate card forms. Choose one approach.

Content guidelines

Submit button text

Error messages


See also

Build custom card form

Step-by-step guide

Troubleshooting

Common issues and solutions

Events guide

Event handling