<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)
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 withloader-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 setoptionsvia direct JavaScript assignment, not viasetAttribute(). HTML attributes are only appropriate for simple string values likeclient-token.
With custom styling
Dark theme
Properties
Setting properties
Important: UsesetAttribute()forclient-token,custom-styles, andloader-disabled. Use direct property assignment foroptions.
Events
Emitted events
Listened events
Event handling example
Slots
CSS properties
Style via CSS variables or thecustom-styles attribute:
Dependencies
This component is the parent for:States
Usage guidelines
Do
- Provide a valid
client-tokenfrom your backend - Listen for
primer:payment-successandprimer:payment-failureto 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
optionsviasetAttribute()— use direct assignment - Don’t call SDK methods before
primer:readyfires
Localization
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