Skip to main content
Primer Checkout iOS SDK is currently in beta (v3.0.0-beta.1). The API is subject to change before the stable release.
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 terminal outcome (success, failure, dismissed). Your onCompletion closure on PrimerCheckout or on the .primerCheckoutSession(_:onCompletion:) modifier fires exactly once per session, and only with a terminal state: .success, .failure, or .dismissed. The lifecycle states .initializing and .ready are part of the enum’s definition but are never delivered to onCompletion; they describe internal progress the SDK drives on your behalf.
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

Lifecycle

A checkout session progresses from the lifecycle states to one of three mutually exclusive terminal outcomes:
.success, .failure, and .dismissed are parallel terminal branches — a session ends in exactly one of them.
.success, .failure, and .dismissed are terminal. The onCompletion closure receives exactly one of them per session. The lifecycle states .initializing and .ready are never passed to onCompletion.

Handling completion

Pass an onCompletion closure when you present checkout. The closure fires once, with one of the terminal states (.success, .failure, or .dismissed).
onCompletion only delivers terminal states, but a switch on PrimerCheckoutState must still be exhaustive. Cover the lifecycle cases with a default: (or @unknown default:) so future state additions don’t break compilation.

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:
For a full integration walkthrough, including manual payment handling, see Handle payment result.

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.