<primer-main>
Optional container that provides structured slots for payment methods and checkout completion. Handles state transitions (loading, success, error) automatically.Quick Reference
| Parent | <primer-checkout> (in main slot) |
| Slots | payments, checkout-complete |
| CSS Variables | --primer-space-small |
Examples
Default (all methods)
Custom Payment Methods
Custom Success Screen
Both Slots
Slots
| Slot | Description | Default |
|---|---|---|
payments | Payment method area | All available methods |
checkout-complete | Success screen | Default success component |
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
| Event | Emitted by | How <primer-main> uses it |
|---|---|---|
primer:state-change | <primer-checkout> | Switches between payments and checkout-complete slots based on isSuccessful |
primer:methods-update | <primer-checkout> | Populates the payments slot with available methods (when slot is not customized) |
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
| Property | Description | Default |
|---|---|---|
--primer-space-small | Gap between payment methods | 8px |
States
This component automatically manages visibility based on checkout state:| State | Description | Visible Slot |
|---|---|---|
| Loading | SDK initializing | Loading indicator |
| Ready | Payment methods available | payments slot |
| Processing | Payment in progress | payments slot (with loading overlay) |
| Success | Payment completed | checkout-complete slot |
| Error | SDK initialization failed | Error message |
Usage Guidelines
Do
- Use for structured customization with automatic state handling
- Include
<primer-error-message-container>when customizingpaymentsslot - Provide custom success screen via
checkout-completeslot
Don’t
- Don’t use if you need full control over state — use custom
mainslot on<primer-checkout>instead - Don’t handle error states here — managed by
<primer-checkout>
Alternative: Full Customization
For complete control, bypass<primer-main>:
Content Guidelines
Success screen text
| Do | Don’t |
|---|---|
| ”Thank you for your order!" | "Payment successful” (too technical) |
| “Your payment has been processed" | "Transaction complete” |
Section headings
| Do | Don’t |
|---|---|
| ”Choose payment method" | "SELECT YOUR PAYMENT METHOD” |
| Use sentence case | Use all caps |
Related
- primer-checkout — Parent component
- Layout Customization — Slot usage guide
- Error Handling — Error display patterns