Skip to main content
Design custom card payment form layouts with live preview and generated code. Choose a layout preset, toggle components on/off, configure form options, and copy the generated HTML, CSS, and JavaScript code.

How to Use

  1. Choose a layout preset: Select from vertical, grouped, compact, single-line, or with-billing layouts
  2. Toggle components: Enable or disable optional components like cardholder name, billing address, and error container
  3. Configure form options: Set hide-labels and disabled state
  4. Customize submit button: Choose between different submit methods and button variants
  5. Copy the code: Switch between HTML, CSS, and JavaScript tabs and copy the generated code

Layout Presets

PresetDescriptionBest For
VerticalAll fields stacked in a single columnSimple forms, mobile-first designs
GroupedExpiry and CVV side by sideStandard desktop layouts
CompactMinimal height with 2-column gridSpace-constrained UIs
Single-lineCore card fields in one rowInline checkout experiences
With BillingFull form with billing addressComplete checkout flows

Submit Button Options

The card form supports multiple ways to trigger submission:
MethodUse Case
primer-card-form-submitBuilt-in localized button
button type="submit"Standard HTML button styling
primer-button type="submit"Primer-styled button
button data-submitCustom element trigger
External (JS event)Button outside the checkout component
When using external submit, set submitButton.useBuiltInButton: false in your SDK options and dispatch the primer:card-submit event with bubbles: true and composed: true.

See also