<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:Disabled state
Hidden labels
Custom layout
With error container
Properties
Events
Emitted events
Listened events
External submit example:
Note:bubbles: trueandcomposed: trueare 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
- Validates all inputs on submission
- If invalid, dispatches
primer:card-error - Child inputs display error messages
- 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-submitevent 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
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