Overview
INFO
The iOS / Swift SDK is designed for Bolt Managed Checkout and SSO Login. It handles the full checkout experience — including shipping, payment, and order completion — as well as Bolt account authentication via OAuth 2.0 with optional PKCE.
The Bolt iOS SDK (BoltInternal) provides a streamlined integration for launching Bolt’s managed checkout flow and SSO login from your iOS app. The SDK handles the complete checkout UI, payment authorization, and Bolt account login, so you can focus on your app experience.
Completing the integration requires three primary steps:
- Initialize the SDK with your publishable key.
- Configure a checkout session with an order token from your backend.
- Launch the checkout flow and handle the result.
Installation
Swift Package Manager
Add the Bolt SDK via Xcode:
- Go to File > Add Package Dependencies…
- Enter the repository URL:
https://github.com/BoltApp/bolt-ios-checkout-sdk - Select the version rule (e.g. “Up to Next Major”) and click Add Package.
Or add it directly to your Package.swift:
dependencies: [
.package(url: "https://github.com/BoltApp/bolt-ios-checkout-sdk", from: "<version>")
]
SDK Initialization
The SDK must be initialized exactly once during your application’s lifecycle. The best place to do this is in your AppDelegate or SwiftUI App entry point.
UIKit (AppDelegate)
import BoltInternal
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
BoltCheckout.initialize(
publishableKey: "YOUR_PUBLISHABLE_KEY",
environment: .production, // or .sandbox
merchantDivisionId: "YOUR_MERCHANT_DIVISION_ID"
)
return true
}
}
SwiftUI
import BoltInternal
import SwiftUI
@main
struct MyApp: App {
init() {
BoltCheckout.initialize(
publishableKey: "YOUR_PUBLISHABLE_KEY",
environment: .production,
merchantDivisionId: "YOUR_MERCHANT_DIVISION_ID"
)
}
var body: some Scene {
WindowGroup { ContentView() }
}
}
WARNING
BoltCheckout.initialize() will crash if called more than once. BoltCheckout.shared will crash if accessed before initialize() has been called.
Configuration Requirements
To use the SDK, ensure you have the following credentials properly configured:
| Credential | Where It Lives | Purpose |
|---|---|---|
| Publishable Key | Mobile app | Passed to BoltCheckout.initialize(). Safe to embed — it identifies your merchant account but cannot authorize actions. |
| Merchant API Key | Backend server only | Used to authenticate POST /v1/merchant/orders and other server-side Bolt API calls. Never embed in the mobile app. |
| Order Token | Generated per checkout | Returned by the Merchant Orders API. Passed into BoltCheckoutConfig before launching checkout. |
API Quick Reference
| Operation | Simplest Call |
|---|---|
| Initialize | BoltCheckout.initialize(publishableKey: "key", environment: .production, merchantDivisionId: "id") |
| Checkout (completion) | BoltCheckout.shared.startCheckout(config: config) { result in ... } |
| Checkout (delegate) | BoltCheckout.shared.startCheckout(config: config, delegate: self) |
| Checkout (VC) | present(BoltCheckoutViewController(config: config, delegate: self), animated: true) |
| Login (completion) | BoltCheckout.shared.startLogin { result in ... } |
| Login (delegate) | BoltCheckout.shared.startLogin(delegate: self) |
| Login (VC) | present(BoltLoginViewController(delegate: self), animated: true) |
| Login with PKCE | BoltCheckout.shared.startLogin(loginConfig: BoltLoginConfig(usePkce: true)) { ... } |
| Payment flow | BoltCheckout.shared.startPaymentFlow(delegate: self) |
| Authorize payment | BoltCheckout.shared.authorizePayment(userInfo: info, orderToken: token, delegate: self) |
| Logout | BoltCheckout.shared.logOut() |
Next Steps
- Checkout Flow — Generate order tokens and launch the managed checkout experience.
- SSO Login — Authenticate users with their Bolt account via OAuth 2.0 and PKCE.
- Custom Checkout — Build a custom checkout using the payment flow and authorization APIs.
- API Reference — Full reference for all delegates, result types, and callbacks.
Cross-Platform Parity
The iOS SDK API is designed to closely mirror the Android / Kotlin SDK:
| Concept | Android | iOS |
|---|---|---|
| Initialize | BoltCheckout.init(app, key, env) |
BoltCheckout.initialize(publishableKey: key, environment: env, merchantDivisionId: id) |
| Get instance | BoltCheckout.get() |
BoltCheckout.shared |
| Config object | BoltCheckoutConfig(orderToken, nativeCheckout, hints) |
BoltCheckoutConfig(orderToken:, nativeCheckout:, hints:) |
| Login config | BoltLoginConfig() |
BoltLoginConfig(usePkce:) |
| Start checkout | startCheckout(config, context, launcher) |
startCheckout(config: config, delegate: self) |
| Start login | startLogin(context, launcher, config) |
startLogin(loginConfig: config, delegate: self) |
| Checkout result | BoltCheckoutDelegate |
BoltSimpleCheckoutDelegate |
| Login result | BoltLoginDelegate |
BoltLoginDelegate |
| Payment result | BoltPaymentFlowDelegate |
BoltPaymentFlowDelegate |
| Auth result | BoltPaymentAuthorizationDelegate |
BoltPaymentAuthorizationDelegate |
| Native/WebView toggle | config.nativeCheckout |
config.nativeCheckout |
| Self-contained UI | BoltCheckoutActivity (via launcher) |
BoltCheckoutViewController |
| Logout | BoltCheckout.get().logout() |
BoltCheckout.shared.logOut() |