PrimerCheckout is the prebuilt, fully managed SwiftUI flow. Drop it into your view hierarchy with a client token and it renders Primer’s default screens end to end — splash, payment method selection, card form, processing, and the success and error results — including 3DS and redirect handling.
This is the fastest way to integrate. You do not compose any screens or wire up sessions yourself; the view manages its own lifecycle and reports the outcome through onCompletion.
PrimerCheckout renders the SDK’s default screens and does not expose the composable views or their @ViewBuilder slots. For full UI customization, embed views such as PrimerCardForm and PrimerPaymentMethods in your own layout and wire them up with PrimerCheckoutSession.Declaration
Initializer
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
clientToken | String | Required | The client token obtained from your backend. See Client session. |
primerSettings | PrimerSettings | PrimerSettings() | Configuration settings including payment options and UI preferences. |
primerTheme | PrimerCheckoutTheme | PrimerCheckoutTheme() | Theme configuration for design tokens applied across all default screens. |
onCompletion | ((PrimerCheckoutState) -> Void)? | nil | Optional completion callback invoked when checkout completes with the final state (success, failure, or dismissed). See PrimerCheckoutState. |
PrimerCheckout requires iOS 15.0 or later and must be used on the main actor, like any SwiftUI View.Usage
Minimal
Present the managed flow with just a client token. All other parameters use their defaults.With settings and theme
Customize payment options and design tokens by passingprimerSettings and primerTheme.
Handling the result
Pass anonCompletion closure and switch over the terminal PrimerCheckoutState to react to the outcome.
Presenting modally
PrimerCheckout is an ordinary SwiftUI View, so present it however your navigation pattern prefers — for example, in a .sheet.
Customizing the UI
PrimerCheckout does not accept screen slots. When you need to control layout, styling, or which fields appear, build your own UI from the composable views and drive them with a session instead.
| Goal | Use |
|---|---|
| Fastest integration, default screens | PrimerCheckout (this page) |
| Custom SwiftUI layout and slots | PrimerCheckoutSession + PrimerCardForm / PrimerPaymentMethods |
| UIKit apps | PrimerCheckoutPresenter |
PrimerCheckoutSession as a @StateObject, place the composable views in your layout, and attach the .primerCheckoutSession(_:onCompletion:) modifier. The modifier injects the session that those views resolve from the environment.
See also
PrimerCheckoutSession
Compose custom UI from the SwiftUI views.
PrimerCheckoutPresenter
Present the managed flow from UIKit.
PrimerCheckoutState
The terminal states delivered to onCompletion.
PrimerCheckoutTheme
Style the default screens with design tokens.