Skip to main content
This guide walks you through integrating the Sezzle iOS SDK into your app. By the end, your app will display Sezzle promotional messaging on product pages and launch Sezzle checkout.

Prerequisites

  • iOS 15.0+ deployment target
  • Swift 5.9+
  • A Sezzle merchant account with your Public API Key
  • A backend server to capture payments after checkout
A working example app is included in the SDK repo at Example/SezzleCheckoutExample. It demonstrates all widget variants and both checkout modes.

1. Installation

  1. In Xcode, go to File > Add Package Dependencies
  2. Enter the repository URL:
  1. Select Up to Next Major Version from the latest release
  2. Add SezzleMerchantSDK to your target
Requirements: iOS 15.0+, Swift 5.9+

2. Configuration

Initialize the SDK once at app startup in your AppDelegate:
Never include your private API key in the app. The SDK only uses the public key. Use your private key server-side to capture payments.

3. Promotional Messaging

Add a SezzlePromotionalView to your product page to display installment pricing:
The widget automatically shows the correct message based on the price and updates when you call:
iOS Widgets

Promotional widgets at different price points

All Parameters

The widget auto-detects dark mode and switches styles via traitCollectionDidChange. If you want to force a specific style, pass .light or .dark explicitly.

Widget Configuration

All config parameters are optional — the widget works out of the box with sensible defaults: To customize, pass only the values you want to override:

Custom Promotional Text

If you need full control over the UI, use SezzlePromoDataHandler to get a styled NSAttributedString with the Sezzle logo inline:

4. Checkout

Build the Checkout Object

Customer Fields

Order Fields

Address Fields (SezzleAddress)

Start Checkout

Handle the Result

Conform to SezzleCheckoutDelegate:
After checkoutDidComplete, send result.orderUUID to your backend server. Your server should call POST /v2/order/{orderUUID}/capture using your private API key to capture the payment. See the Orders API for details.

5. WebView Mode

By default, checkout opens in ASWebAuthenticationSession (system browser). To keep the user inside your app, use WebView mode:
System Browser

Multi-user devices — clearing Sezzle session on logout

iOS’s WKWebsiteDataStore.default() is a single app-wide persistent store inherited by every WebView with the default configuration. Cookies set during one user’s .webView checkout (auth tokens, session identifiers) persist across users on the same device — so if your app supports multiple users (e.g. a logout/login flow on a shared device), the next user’s first BNPL attempt can resume the previous user’s Sezzle session and surface their state (credit-limit decline, etc.) to the wrong customer. Starting in 1.2.2, call SezzleSDK.shared.clearWebViewData() from your logout flow to clear Sezzle’s cookies and Web storage before the next user signs in:
The clear is scoped to Sezzle’s own domains — your other cookies and Web storage are not touched. Safe to call repeatedly; safe to call when no Sezzle checkout has ever run. The operation is asynchronous; the optional completion handler fires on the main actor. .systemBrowser mode shares cookies with Safari via ASWebAuthenticationSession and is unaffected — if your users need to clear those, they should clear them in Safari itself.

6. Dark Mode

The SDK automatically adapts to the device’s appearance setting. The promotional widget, installment modal, and checkout modal all support dark mode.
Light Mode
If you need to force a specific style (e.g., your app doesn’t follow the system setting):

7. Error Handling

All errors are delivered via SezzleCheckoutDelegate.checkoutDidFail(error:):

8. Server-Driven Integration

For larger merchants who prefer a fully server-driven integration — no public key on-device, with the backend owning session creation, capture, and refunds — use the alternative startCheckout overload introduced in 1.2.0.

How it works

Your backend creates the checkout session via POST /v2/session with merchant-chosen callback URLs, then hands order.checkout_url plus those URLs to the app. The SDK opens the URL, intercepts navigation to your callback URLs, and reports back via SezzleCheckoutDelegate.checkoutDidComplete(result:) with the full callback URL — so you can encode your own state in the query string and recover it on completion.

Step 1 — Backend creates the session

Pick any callback URLs you want — a custom scheme like yourapp-sezzle://... or HTTPS deep links. You can encode state in the query string (e.g. yourapp-sezzle://done?orderRef=12345) and recover it from the SDK callback. Persist order.uuid server-side; the app only needs order.checkout_url plus the two callback URLs.
Don’t put PII, auth tokens, or anything sensitive in the callback URL query string. The callback URL is rendered in the browser and may be logged. Use opaque references (a random orderRef mapped server-side) — never the customer’s email, phone, payment data, or session tokens.Custom URL schemes are also not exclusive — another app installed on the device can register the same scheme and intercept the callback. For maximum security in production, use Universal Links (verified HTTPS deep links) with .webView mode — they’re tied to a domain you control, so other apps can’t claim them.

Step 2 — App presents checkout

SezzleSDK.shared.configure(publicKey:) is not required for this flow — there’s nothing for the SDK to authenticate.

Step 3 — Read the result

Notes

  • ASWebAuthenticationSession requires a custom URL scheme for the callback (callbackURLScheme: parameter). HTTPS callbacks aren’t accepted by the auth session API. For HTTPS-based deep links (e.g. backed by Universal Links), use .webView mode — it intercepts navigation directly via WKNavigationDelegate and works with any scheme.
  • Match your URLs. Whatever your backend passed as complete_url.href / cancel_url.href, pass the same URLs to startCheckout. The SDK matches on scheme + host + path; query params on the inbound URL are read by you.
  • order.uuid lives on your server. It’s not in the checkout_url and isn’t echoed back — your backend already has it from the session-creation response.

9. Testing

Use the sandbox environment for testing:
Use the test data to complete test checkouts in sandbox.
Switch to .production and your live public key before releasing to the App Store.