Use this file to discover all available pages before exploring further.
Primer Checkout lets you customize the structure and layout of your checkout using platform-specific customization points.You can rearrange components, insert your own content, and control how payment methods are displayed, while Primer continues to handle payment logic, state management, and security for you.
Primer Checkout uses named slots within Web Components as the primary mechanism for layout customization. Slots are named placeholders in components where you can insert your own content or Primer components.
Slots are designated areas within Web Components where custom content can be inserted.
Each slot has a specific name (i.e. main) that determines where the content will appear.
<primer-checkout client-token="your-client-token"> <div slot="main"> Your custom content goes here </div></primer-checkout>
When a component renders, it replaces each slot with the content you provide.
If you don’t provide content for a slot, the component uses default content instead.
Primer Checkout SDK uses standard Jetpack Compose @Composable slot parameters for layout customization. Every component provides a Defaults object with pre-built sub-components that you can selectively override.
Primer Checkout SDK uses scope-based customization via closures. Each scope exposes properties for replacing individual fields, sections, or entire screens with custom SwiftUI views.
Error states are managed by the parent <primer-checkout> component, not by <primer-main>. If you need custom error handling, implement it directly in the main slot of <primer-checkout> without using <primer-main>.
The checkout layout uses Compose slot parameters at each level. Use defaults for a complete checkout with no custom layout code, or override individual slots:
The checkout layout uses a scope hierarchy. Each scope exposes customization points for the UI it manages:
For complete control, you can bypass <primer-main> entirely and provide your own implementation. This requires handling state management yourself through events.For details on implementing fully custom layouts, see Layout with Event Handling.
Replace full screens while keeping scope access for state and actions:
if let cardScope: PrimerCardFormScope = checkoutScope.getPaymentMethodScope(PrimerCardFormScope.self) { cardScope.screen = { scope in AnyView(MyCustomCardFormScreen(scope: scope)) }}
Component targeting - Names tell the component exactly where to insert your content
Default content - Components can provide default content for slots that aren’t filled
Preventing accidental rendering - Content without a matching slot won’t be displayed
Multiple insertion points - Different named slots allow multiple insertion points
Using the wrong slot name or omitting it entirely can lead to content not appearing where expected.
Compose slot parameters serve the same purpose as Web slots:
Component targeting - Named lambda parameters define exactly which part of the UI you’re customizing
Default content - Defaults objects provide pre-built content for any slots you don’t override
Type safety - The compiler enforces that your custom content matches the expected slot signature
Passing content to the wrong parameter won’t compile, preventing layout mistakes at build time.
Scope-based customization provides similar benefits to Web slots and Android slot parameters:
Component targeting - Each scope property maps to a specific part of the UI
Default content - Any scope property you don’t override uses the built-in default
Type safety - Closures receive typed scope parameters, giving you access to state and actions
When replacing a screen, your closure receives the relevant scope object, ensuring you have access to everything needed to build a functional replacement.
Using these properties ensures your custom layout maintains visual consistency with the checkout components.For detailed information on available components and their slots, refer to the component SDK Reference documentation:
Use PrimerTheme design tokens to maintain visual consistency with checkout components. See Styling Customization for details.
Use PrimerCheckoutTheme design tokens to maintain visual consistency with checkout components. Use PrimerFieldStyling for per-field styling overrides. See Styling Customization for details.