Quick diagnosis
| Symptom | Likely Cause | Solution |
|---|---|---|
| Error screen with retry button | Invalid or expired client token | Generate a fresh clientToken from your server for each session |
| No payment methods shown | Dashboard misconfiguration or unsupported currency/country | Verify Dashboard settings and currencyCode/countryCode in client session |
getPaymentMethodScope() returns nil | Checkout not yet in .ready state | Observe state stream and access scopes only after .ready |
| State observation stops unexpectedly | SwiftUI .task cancelled on view disappear | Keep PrimerCheckout in a stable view (e.g., .sheet) that isn’t recreated |
| Theme or settings not applied | PrimerCheckoutTheme/PrimerSettings created inside view body | Define as constants outside the view body |
| Delegate callbacks never fire (UIKit) | PrimerCheckoutPresenterDelegate not set or deallocated | Set delegate on .shared before calling presentCheckout and retain the delegate |
| Apple Pay button not visible | Simulator, no cards in Wallet, or merchant ID mismatch | Test on a real device with cards in Wallet; verify Apple Developer & Dashboard config |
Web redirect stays in .polling | User cancelled in external browser or app not installed | Handle .failure state; check paymentMethodType for app-specific requirements (e.g., Vipps) |
| BLIK/MBWay form fields not appearing | getPaymentMethodScope called before .ready state | Observe checkoutScope.state and access scopes only after .ready |
| QR code image not displaying | qrCodeImageData is nil before .displaying status | Check state.status == .displaying before using qrCodeImageData |
| Build error on iOS 14 | Minimum deployment target not met | Set deployment target to iOS 15.0+ |
Configuration and initialization
Error screen after initialization
Cause: Invalid, expired, or malformed client token. The SDK shows an error screen with a retry button — not a blank screen. Solution: Generate a freshclientToken from your server for each checkout session. Client tokens are single-use and expire.
If you see
invalid-client-token in the error, your token has expired or was already consumed. Generate a new one from your server.Payment methods not showing
Cause: Multiple possible causes:- No payment methods configured in the Primer Dashboard for the given currency/country
- The SDK only renders payment methods it supports (card, Apple Pay, PayPal, Klarna, ACH, etc.) — unsupported types are silently filtered out
- Client session missing required
currencyCodeorcountryCodefields
"Filtering out unregistered payment method: TYPE". Verify your Dashboard configuration matches the currency and country in your client session.
SwiftUI integration
Payment method scope returns nil
Cause:getPaymentMethodScope() returns nil before the checkout reaches .ready state because scopes aren’t configured yet.
Solution: Observe the state stream and access scopes only after .ready:
State observation stops unexpectedly
Cause: SwiftUI’s.task modifier cancels the Task when the view disappears. If PrimerCheckout is inside a NavigationLink destination, each push/pop recreates it and cancels the scope Task.
Solution: Keep PrimerCheckout in a stable container that isn’t destroyed by navigation:
Theme or settings not applied
Cause: CreatingPrimerCheckoutTheme() or PrimerSettings() inside the SwiftUI body property. SwiftUI re-evaluates body frequently, creating new objects each time.
Solution: Define configuration as constants outside the view body:
UIKit integration
Delegate callbacks never fire
Cause:PrimerCheckoutPresenterDelegate not set on PrimerCheckoutPresenter.shared before calling presentCheckout, or the delegate object was deallocated.
Solution: Set the delegate before presenting and implement all required methods:
Checkout not presented
Cause: CallingpresentCheckout while already presenting — the call is silently ignored with no visible feedback.
Solution: Check PrimerCheckoutPresenter.isPresenting before calling:
Card form
Form shows invalid despite all visible fields being filled
Cause: The form validation considers all configured fields, including billing address fields that may not be visible on screen. Backend configuration controls which billing fields are required. Solution: ObservefieldErrors to identify which specific fields are failing validation:
Apple Pay
Apple Pay not available
Cause: Multiple possible causes:- Running on the iOS Simulator (Apple Pay requires a real device)
- No payment cards added to the user’s Wallet
- Apple Pay not configured in the Primer Dashboard
- Merchant identifier mismatch between Apple Developer portal and Primer Dashboard
DefaultApplePayScope is returned from getPaymentMethodScope() — if nil, Apple Pay is not available for the current session.
Installation
SPM package not found
Cause: Build fails with “No such module ‘PrimerSDK’”. Solution: Re-add the SPM package:- In Xcode, go to File > Add Package Dependencies
- Enter the Primer SDK repository URL
- Select the correct version and add to your target
CocoaPods installation fails
Cause:pod install fails or doesn’t include the Primer SDK.
Solution: Verify your Podfile and reinstall:
Minimum deployment target
Cause: Crash or build error on iOS 14 or earlier. Solution: The Primer Checkout iOS SDK requires iOS 15.0 or later. Update your deployment target:Validation vs payment errors
Understanding the difference helps with proper error handling:| Error Type | When It Occurs | How It’s Handled |
|---|---|---|
| Validation errors | During input (invalid format, missing fields) | Handled automatically by input components; prevents form submission |
| Payment failures | After form submission (declined card, network issues) | Requires explicit handling with error container or custom code |
Debugging tips
Log all state changes
Inspect available payment methods
Check scope availability
After the checkout reaches.ready state, check which payment method scopes are available:
Log card form validation errors
Extract diagnostics for support
Getting help
When contacting Primer support, include:- The
diagnosticsIdfrom any error callbacks - Your iOS version, Xcode version, and SDK version
- Steps to reproduce the issue
See also
Events guide
Event handling patterns
Build a custom card form
Card form tutorial
Best practices
SwiftUI performance tips