PrimerCheckoutState is a public, Equatable enum that represents the current state of the checkout flow. It captures both the lifecycle of the session (initializing, ready) and its outcome (success, failure, dismissed).
Your onCompletion closure on PrimerCheckout or on the .primerCheckoutSession(_:theme:onCompletion:) modifier receives the outcome states .success, .failure and .dismissed. To follow the lifecycle states .initializing and .ready, read PrimerCheckoutSession.phase.
.success and .dismissed end the session and are delivered at most once. .failure depends on when it happens: once the checkout is ready, a failed payment attempt does not end the session — the SDK shows its error screen, offers a retry, and your closure is called again with the outcome of each further attempt. An initialization failure (before the checkout becomes ready) ends an inline PrimerCheckoutSession. PrimerCheckout keeps its initialization error view open with a Retry button, so a later outcome can still arrive. With uiOptions.isErrorScreenEnabled set to false, the SDK shows no error view and your app decides what to show. PrimerCheckoutPresenter closes its sheet on the failure instead.
On iOS, a single
PrimerCheckoutState enum covers what the Android SDK splits across PrimerCheckoutState (lifecycle) and PrimerCheckoutEvent (outcomes). The .initializing and .ready cases mirror the lifecycle; .success, .failure, and .dismissed mirror the outcome events delivered to onCompletion.Definition
States
.ready associated values
To read the client session, use
PrimerCheckoutSession.clientSession. It is @Published and becomes non-nil as soon as the checkout is ready:
refresh() renews clientSession, and cancel() sets it back to nil. The value is a snapshot. A client-session update during checkout, such as a surcharge or a billing address, does not update it.
This requires the inline integration.
PrimerCheckout — the managed modal — renders the SDK’s own screens and exposes no session object, so the client session is not reachable from it..failure associated values
Lifecycle
A checkout session progresses from the lifecycle states to an outcome..success and .dismissed end it. A .failure ends it only when initialization fails on an inline PrimerCheckoutSession, or when PrimerCheckoutPresenter closes its sheet with the error screen off:
.success and .dismissed are delivered at most once per session. .failure is delivered once per failed attempt. A failure before .ready ends an inline PrimerCheckoutSession. With the error screen off, any failure ends a PrimerCheckoutPresenter checkout. The lifecycle states .initializing and .ready are never passed to onCompletion.Handling completion
Pass anonCompletion closure when you present checkout. It receives the outcome states — .success, .failure, or .dismissed — and may be called more than once if a payment attempt fails and the customer retries.
PaymentResult
PaymentResult is the value carried by .success. It is a public, Sendable, Equatable struct describing the completed payment.
PaymentStatus
PaymentStatus is a public, Sendable enum describing the final status of a payment.
Always include a
default: (or @unknown default:) case when switching on PaymentStatus to handle future additions.Handling the result
Use the.success payload to read the payment details and route your UI:
PrimerClientSession
The resolved client session, carried by.ready and published on PrimerCheckoutSession.clientSession.
Every property is optional because the client session itself is merchant-configured — a session created without line items has none. Read them defensively rather than assuming a shape.
PrimerLineItem
PrimerOrder
PrimerCustomer
PrimerAddress
PrimerClientSession.PaymentMethod
ACodable, Equatable struct nested in PrimerClientSession, so name it as PrimerClientSession.PaymentMethod.
PrimerFee
See also
PrimerCheckout
Present checkout and receive the final state through
onCompletion.PrimerError
Error details carried by the
.failure state.Handle payment result
Route your UI based on the checkout outcome.
PrimerCheckoutSession
Drive the inline checkout lifecycle from your own layout.