Skip to main content
Primer Checkout iOS SDK is currently in beta (v3.0.0-beta.5). 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 receives outcome states only — .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. .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. Only a failure that occurs before the checkout becomes ready is terminal.
Do not treat the first .failure as the end of the session. If you tear down your checkout UI on it, a customer who retries after a decline and then succeeds will never reach your success handling. Tear down on .success and .dismissed.
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

Because .ready is never delivered to onCompletion, read the client session from the session object instead — PrimerCheckoutSession.clientSession is @Published and becomes non-nil as soon as the checkout is ready:
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.

Lifecycle

A checkout session progresses from the lifecycle states to an outcome. .success and .dismissed end it; a .failure after .ready does not:
.success and .dismissed are delivered at most once per session. .failure is terminal only before .ready; after that it is delivered once per failed attempt. The lifecycle states .initializing and .ready are never passed to onCompletion.

Handling completion

Pass an onCompletion 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.
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, see Handle payment result.

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

taxCode and taxAmount are per line item. Do not read the order’s total tax from them — a three-item order reports each item’s own tax, and the values will not sum to a field you can find elsewhere on the session unless your client session was configured that way.

PrimerOrder

PrimerCustomer

PrimerAddress

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.