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.

Core API

Card Form

Payment Methods

Theming

Common Objects

Session pattern

The iOS SDK offers a managed checkout and a composable one. The managed checkout, PrimerCheckout in SwiftUI or PrimerCheckoutPresenter from UIKit, builds its own checkout and needs no session. An observable PrimerCheckoutSession drives the composable views and owns the checkout lifecycle. It loads the client session and tracks the lifecycle Phase. In SwiftUI, outcomes reach your onCompletion handler as PrimerCheckoutState. .failure arrives once per failed attempt. .success or .dismissed arrives at most once and ends the checkout. With the default error screen, the shopper can retry after a failed payment. If initialization fails, an inline PrimerCheckoutSession ends after that single .failure.

Composable (inline)

Hold a PrimerCheckoutSession as a @StateObject, then attach it to your view hierarchy with the .primerCheckoutSession(_:theme:onCompletion:) modifier. The composable views — PrimerCardForm, PrimerPaymentMethods, and PrimerVaultedPaymentMethods — resolve their per-feature session from the SwiftUI environment and expose slots you can override. PrimerCardForm and PrimerPaymentMethods take @ViewBuilder slots. PrimerVaultedPaymentMethods slots return AnyView, so wrap your custom content in AnyView.
The PrimerCardForm slots, the PrimerPaymentMethods header and emptyState slots, and the PrimerVaultedPaymentMethods header slot receive their session as a parameter. Use it to read state and call actions from your custom UI. The PrimerPaymentMethods method slot and the PrimerVaultedPaymentMethods item and submitButton slots receive only row data and callbacks.
Sessions are @MainActor ObservableObjects. Observe them with @StateObject (when you own them) or @ObservedObject (when they are passed into a slot), and read their @Published state/phase directly in your views.

Managed (modal)

For a turnkey flow that renders the SDK’s default screens, use PrimerCheckout in SwiftUI, or PrimerCheckoutPresenter from UIKit.
Start with the managed PrimerCheckout view to get a working checkout quickly, then move to the composable views and @ViewBuilder slots when you need full control over the UI.

See also

PrimerCheckoutSession

Own the checkout lifecycle for inline, composable checkout.

PrimerCheckout

Drop in the managed SwiftUI checkout view.

PrimerCardForm

Build a custom card form with @ViewBuilder slots.

Handle payment result

React to the final PrimerCheckoutState.