PrimerCheckoutState value:
The same
PrimerCheckoutState also has lifecycle cases (.initializing, .ready) that you do not need to handle when reacting to the final outcome. Always include a default case when switching, so future enum additions stay source-compatible.SwiftUI
Using PrimerCheckout
The prebuiltPrimerCheckout view accepts an onCompletion closure that fires once with the final state.
Using the .primerCheckoutSession modifier
When you embed the composable views (for examplePrimerCardForm) inline in your own layout, hold a PrimerCheckoutSession as a @StateObject and receive the outcome through the onCompletion parameter of the .primerCheckoutSession(_:onCompletion:) modifier.
.success and .dismissed are delivered at most once — the session latches the first state that ends it, so a later .dismissed produced by a view-lifecycle teardown is ignored..failure is different. Once checkout is ready, a failed payment attempt does not end the session: the SDK shows its error screen, the customer can retry, and onCompletion is called again with the next attempt’s outcome. Only a failure before the checkout becomes ready is terminal. Keep your checkout UI alive on .failure — otherwise a customer who retries after a decline and then succeeds never reaches your success handling.Navigating on success
Use thePaymentResult to drive navigation. PaymentResult is Equatable but not Hashable, so it cannot be appended to a NavigationPath or used with navigationDestination(for:) directly. Instead, store the result in @State and present the confirmation screen with navigationDestination(isPresented:).
UIKit
In UIKit, present the checkout withPrimerCheckoutPresenter and adopt PrimerCheckoutPresenterDelegate to receive the outcome. The presenter dismisses its own modal before calling the relevant delegate method.
PrimerCheckoutState cases:
Reading the PaymentResult
On success you receive aPaymentResult. Read its properties to build your confirmation UI, send analytics, or reconcile against your backend.
status is usually .success for a .success(PaymentResult) outcome. Payment methods that settle later, such as bank transfers and vouchers, report .pending until the processor confirms the payment. Primer Checkout creates the payment for you, PrimerSettings(paymentHandling: .manual) is not supported.Handling the PrimerError
On failure you receive aPrimerError. The SDK already surfaces failures inside the checkout UI, so you typically use the error for logging, analytics, and support workflows rather than for displaying a message yourself.
See also
PrimerCheckoutState
The full state enum and the PaymentResult model.
PrimerError
Error categories, IDs, and diagnostics.
PrimerCheckoutPresenter
The UIKit entry point and delegate callbacks.
PrimerCheckout
The prebuilt SwiftUI checkout view.