Skip to main content

<primer-checkout>

The root container for all Primer payment components. Initializes the SDK, manages checkout state, and provides context to child components. Use as a drop-in solution or customize fully.

Quick reference


Examples

Drop-in (minimal)

Automatically displays all configured payment methods with default styling.

With primer-main

Fully custom

Note: Without <primer-main>, you must handle state changes via events.

Custom content during loading

Render slotted content immediately, before the SDK is ready. Combine with loader-disabled to suppress the default loader and show your own UI until the primer:ready event fires. The slotted element must use display: block to override the default style that hides it during initialization.

With options

Note: Always set options via direct JavaScript assignment, not via setAttribute(). HTML attributes are only appropriate for simple string values like client-token.

With custom styling

Dark theme


Properties

Setting properties

Important: Use setAttribute() for client-token, custom-styles, and loader-disabled. Use direct property assignment for options.

Events

Emitted events

Listened events

Event handling example


Slots


CSS properties

Style via CSS variables or the custom-styles attribute:
See Styling Variables Reference for all available properties.

Dependencies

This component is the parent for:

States


Usage guidelines

Do

  • Provide a valid client-token from your backend
  • Listen for primer:payment-success and primer:payment-failure to handle outcomes
  • Handle both success and failure states
  • Use <primer-error-message-container> for payment failures

Don’t

  • Don’t use multiple <primer-checkout> instances (single instance per page)
  • Don’t set options via setAttribute() — use direct assignment
  • Don’t call SDK methods before primer:ready fires
Only use a single <primer-checkout> instance per page. Multiple instances will cause initialization conflicts and unpredictable behavior.

Localization

See Localization Guide for supported locales. Falls back to en-GB if unsupported.
Note: Only left-to-right (LTR) languages are currently supported.

Content guidelines

Loading state

Error messages (default experience)


See also

SDK options reference

All configuration options

Events guide

Event handling patterns

Styling variables

CSS customization

Installation

Getting started