PrimerSelectionSession is the observable session that drives payment-method selection. It publishes the selection state (available methods, current selection, search and filtering) and the customer’s saved vaultedPaymentMethods, and provides the methods that act on them. The SDK raises the CVV recapture screen when a saved card needs one.
A single PrimerSelectionSession backs both PrimerPaymentMethods (the list of available methods) and PrimerVaultedPaymentMethods (saved methods). Both views resolve the same session from the environment supplied by the .primerCheckoutSession(_:) modifier, so you rarely construct or hold it yourself — you read it from the slots those views hand you.
PrimerSelectionSession is a @MainActor, ObservableObject final class available on iOS 15.0 and later (@available(iOS 15.0, *)). Observe it with @ObservedObject and call its methods from the main actor.Declaration
PrimerPaymentMethods and PrimerVaultedPaymentMethods receive it directly, so you do not initialize it yourself.
Properties
state is the snapshot you render from; vaultedPaymentMethods is the list of saved cards. Which card the SDK’s own screens act on is reflected back through state.selectedVaultedPaymentMethod. Keep the highlight in your own view state.Methods
select(_:)
state.selectedPaymentMethod.
cancel()
selectVaulted(_:)
.primerCheckoutSession(_:theme:onCompletion:).
Keep which row looks selected in your own view state. Returns immediately; the payment runs on.
delete(_:)
vaultedPaymentMethods. Throws if the deletion fails, leaving the list unchanged.
showAll()
PrimerCheckout modal and the inline integration.
PrimerPaymentMethodSelectionState
PrimerPaymentMethodSelectionState is the immutable snapshot published by state. It conforms to Equatable. Every stored property is public internal(set) — readable from your code but mutated only by the SDK, so treat it as read-only and call the session’s methods to change selection.
Properties
CheckoutPaymentMethod
paymentMethods and filteredPaymentMethods are arrays of CheckoutPaymentMethod, the model describing a single selectable method. It is documented in full on the PrimerPaymentMethods page; the key fields are id, type, name, icon, and the surcharge and styling properties.
Usage
Reading state and selecting a method
PrimerPaymentMethods hands each method slot a CheckoutPaymentMethod and an onSelect closure that calls select(_:) for you. To select outside a slot — for example from a custom header — call select(_:) on the session directly.
Working with vaulted methods and CVV recapture
When rendering saved methods, iteratevaultedPaymentMethods, keep the highlight in your own view state, and call selectVaulted(_:) from your pay button. A card that needs CVV recapture raises the CVV recapture screen on submit, and that screen finishes the payment.
See also
PrimerPaymentMethods
The slot-based view that renders the available payment methods.
PrimerVaultedPaymentMethods
Render and select saved (vaulted) payment methods.
PaymentMethodsDefaults
Default slot bodies used by the payment-method views.
PrimerCheckoutSession
The top-level session injected via .primerCheckoutSession(_:).