<primer-main>
Optional container that provides structured slots for payment methods, checkout completion, and initialization errors. Handles state transitions (loading, success, error) automatically.Quick reference
Examples
Default (all methods)
Custom payment methods
Custom success screen
Custom initialization error screen
primer:state-change and read primerJsError from the event detail — see Error handling.
Both slots
Slots
Events
<primer-main> does not emit its own events. It subscribes to parent events internally to manage slot visibility. When bypassing <primer-main>, you handle these events yourself.
Relevant parent events
When you bypass <primer-main>
If you use a custom <div slot="main"> instead of <primer-main>, you must handle these events directly:
CSS properties
States
This component automatically manages visibility based on checkout state:Usage guidelines
Do
- Use for structured customization with automatic state handling
- Include
<primer-error-message-container>when customizingpaymentsslot (for payment failures) - Provide custom success screen via
checkout-completeslot - Provide a custom initialization-failure screen via
checkout-errorslot
Don’t
- Don’t use if you need full control over state — use custom
mainslot on<primer-checkout>instead - Don’t confuse
checkout-error(SDK initialization failures) with<primer-error-message-container>(payment failures) — see Error handling
Alternative: full customization
For complete control, bypass<primer-main>:
Content guidelines
Success screen text
Section headings
See also
primer-checkout
Parent component
Layout customization
Slot usage guide
Error handling
Error display patterns