Skip to main content
Primer Checkout iOS SDK is currently in beta (v3.0.0-beta.8). The API is subject to change before the stable release.
PaymentMethodsDefaults is a public enum (used as a namespace) providing the pre-built @ViewBuilder content that PrimerPaymentMethods renders when you omit a slot. Use these helpers inside your own slots to mix custom and default content, or as a reference for the default look and feel.
Each helper is the default value for the matching PrimerPaymentMethods slot. The component falls back to PaymentMethodsDefaults.header($0), PaymentMethodsDefaults.method($0, onSelect: $1), and PaymentMethodsDefaults.emptyState($0) when those slots are not supplied.

Builders

Renders the section title using the theme’s typography and color tokens, with the header accessibility trait applied. The session parameter exists only so this helper matches the header slot’s closure signature — the default header does not read from it.

method

Renders a tappable row for a single payment method. The row’s content and VoiceOver label depend on the payment method type: The default row does not display a surcharge. To show one, read method.formattedSurcharge in your own method slot, as in the example below.

emptyState

Rendered automatically by PrimerPaymentMethods when session.state.paymentMethods is empty.

unavailable

Rendered by PrimerPaymentMethods instead of its slots when no PrimerSelectionSession is in the environment. That is the case when the view is not inside .primerCheckoutSession(_:), or when the session has not reached .ready yet. It returns an EmptyView, so the list occupies no space.

Return types

Each slot builder returns a concrete public view type so it can serve as a @ViewBuilder default argument. These types have no public initializer. To get an instance, call the matching builder. You can still use the type name, for example as a property type or a return type.

Using defaults inside custom slots

Reuse a default builder for one part of the list while customizing another. Here the default header and empty state are kept, but each row is replaced with a branded row:
Because the header and emptyState slots are omitted, PrimerPaymentMethods falls back to PaymentMethodsDefaults.header and PaymentMethodsDefaults.emptyState. You can also call a default builder explicitly — for example, to render the default row while wrapping it in your own container:
The header and emptyState slots pass you the PrimerSelectionSession, so you can branch on session.state to show custom content while still falling back to a default builder when appropriate.

See also

PrimerPaymentMethods

The slot-based payment method list these defaults power.

PrimerSelectionSession

Session that exposes the available methods and the select action.

VaultedPaymentMethods

Saved payment methods and their own default sub-components.

CardFormDefaults

The equivalent default sub-components for the card form.