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.

Prerequisites

  • iOS 15.0+ deployment target
  • Swift 6.0+
  • Xcode 16.0+
  • A clientToken from your server via the Client Session API
The Primer Checkout SDK uses SwiftUI. You can drop it into a SwiftUI view hierarchy directly, or present it from UIKit with PrimerCheckoutPresenter.

Install the SDK

Choose CocoaPods or Swift Package Manager. Both install the same PrimerSDK framework, which includes the Checkout Components UI.
This is a beta release line. The current version is 3.0.0-beta.8. Pin to the exact beta version so a new beta tag does not change your build without you opting in.

With CocoaPods

Add the following to your Podfile:
RUBY
Then run pod install to install PrimerSDK into your workspace:
Open the generated .xcworkspace (not the .xcodeproj) from now on.
If Xcode reports that a resource bundle target needs signing, add the following post-install script to your Podfile.
RUBY

With Swift Package Manager

Swift Package Manager is integrated into Xcode. To add PrimerSDK:
  1. Select your project, then navigate to Package Dependencies.
  2. Click the + button at the bottom-left of the Packages section.
  3. Paste https://github.com/primer-io/primer-sdk-ios.git into the search bar.
  4. Under Dependency Rule, choose Exact Version and enter the beta tag 3.0.0-beta.8.
  5. Press Add Package and let Xcode resolve and link the dependency.
Or declare it directly in your Package.swift:

Optional: Klarna

Native Klarna appears in the payment method list only when your app includes the PrimerKlarnaSDK pod. Adyen Klarna does not need it. With CocoaPods, add PrimerKlarnaSDK next to PrimerSDK in your Podfile, then run pod install:
RUBY
The PrimerSDK Swift package does not include PrimerKlarnaSDK, so native Klarna requires CocoaPods.

Basic Usage

Import PrimerSDK and present PrimerCheckout with a clientToken. This renders the SDK’s default screens as a managed modal and reports the outcome through onCompletion:
PrimerCheckout requires iOS 15.0+ and runs on the main actor. Its initializer also accepts primerSettings and primerTheme, plus two optional Apple Pay Express Checkout shipping handlers:
Building a UIKit app? Present the checkout from a UIViewController with PrimerCheckoutPresenter instead of embedding the SwiftUI view.

Verify Installation

Build and run your app to confirm the SDK is resolved and links correctly:
If the build succeeds and import PrimerSDK resolves, the SDK is installed and ready to use.

Next Steps

API Overview

Tour the Checkout Components API surface

PrimerCheckout

The managed modal entry point in depth

Theming

Customize the appearance with design tokens

Handle Payment Result

Respond to success, failure, and dismissal