Fully custom implementation
For complete control, you can bypass<primer-main> entirely and provide your own implementation.
Choose one error display approach:
- Built-in error container
- Custom error element
Events
When implementing a custom layout without<primer-main>, you’ll need to listen for events to manage checkout states.
For comprehensive information on all available events, event payloads, and best practices, see the Events Guide.
Key events to listen for
Key events to listen for
primer:state-change- Fired when checkout state changesprimer:methods-update- Fired when available payment methods are loadedprimer:ready- Fired when the SDK is ready
Configuring payment methods
When customizing the payment method layout, you can include specific payment methods:type attribute specifies which payment method to display. If a payment method isn’t available in your Dashboard configuration, it simply won’t render.
Payment method filtering with include, exclude and type
The primer-payment-method-container component provides a declarative way to organize payment methods:
Dynamic rendering with events
You can also dynamically render payment methods by listening to theprimer:methods-update event:
Example: Dynamic payment method rendering
Example: Dynamic payment method rendering
Avoiding duplicate card forms
PAYMENT_CARD payment method in your layout.
Filtering to avoid duplicate card forms
Filtering to avoid duplicate card forms
Important: If you’re using a custom card form, you should filter out the
PAYMENT_CARD type to avoid duplicate card forms: