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.
PrimerError is the error type delivered when a payment or checkout fails. Every error carries a stable errorId for programmatic handling, a diagnosticsId to share with Primer support, and (where applicable) a recoverySuggestion describing how to recover.
PrimerError conforms to LocalizedError and CustomNSError, so you also get localizedDescription for free and can bridge it to NSError when needed.

How errors are delivered

You never construct a PrimerError yourself. The SDK delivers it to you through one of two channels, depending on how you present checkout. See Handle the payment result for the full success / failure / dismissed flow.

Properties

errorDescription and localizedDescription include the error and diagnostics IDs and are meant for logs. The SDK’s default error screen shows plainDescription. In your own UI, show your own localized, branded message.

Handling an error

Receive the checkout state through the completion closure and, in the .failure branch, log the diagnosticsId and errorId. Branch on errorId only when you need behavior specific to a category (for example "payment-failed" for a declined payment versus a configuration error such as "invalid-client-token").
A shopper who cancels a payment method (closing the Apple Pay sheet or PayPal, leaving a redirect) is not a failure. Tapping PayPal’s “Cancel and return” link is also a cancel. For Klarna, closing the consent alert or the web sheet is a cancel, and so is a decline from Klarna. CheckoutComponents returns to the payment method list, or delivers .dismissed when there is no list to return to. Klarna SDK errors ("klarna-sdk-error") reach .failure. "payment-cancelled" reaches .failure only in rare edge cases.
For a UIKit / presenter integration, the same PrimerError arrives through the delegate:
When filing a support ticket, include the diagnosticsId. It lets Primer trace the exact occurrence of the failure across SDK and backend logs.

See also

PrimerCheckoutState

The checkout state that delivers .failure(PrimerError, checkoutData:).

Handle the payment result

Handle success, failure, and dismissal end to end.

PrimerCheckoutPresenter

Receive failures through the presenter delegate.

ValidationResult

Inline field validation, distinct from checkout errors.