iOS Secure Fields
Collect card data inside a native iOS application without your code ever touching raw card values. The SDK renders secure UIKit input fields, validates the data, tokenizes it against the Purse gateway, and returns an opaque vault_form_token to your app.
How it works
Your backend uses the vault_form_token to create a payment via the Payment API — raw card data never passes through your servers or application code. This is the native iOS counterpart of the web SecureFields flow; the server-side payment steps are identical.
Key characteristics
| Aspect | Detail |
|---|---|
| Card data isolation | Card field classes are internal to the SDK module. The text and attributedText getters on card fields return nil — no cast can extract a PAN, CVV, or expiry date. |
| What your app receives | Field validity, focus state, PAN digit count, detected brand, BIN prefix, last four digits, and the vault_form_token. |
| UI framework | UIKit views (panContainer, cvvView, expDateView, holderNameView), wrappable in SwiftUI via UIViewRepresentable |
| Environments | Sandbox and production, selected via the VaultEnvironment enum at init — the SDK resolves the vault URL internally |
| Distribution | Signed XCFramework via Swift Package Manager |
Requirements
| Requirement | Value |
|---|---|
| Minimum iOS version | iOS 15+ |
| Swift | 5.9+ |
| Xcode | 15+ |
| Dependency manager | Swift Package Manager (CocoaPods and Carthage are not supported) |
When to use this SDK
| Scenario | Recommendation |
|---|---|
| Building a native iOS checkout | ✅ iOS Secure Fields |
| Building a web checkout with the same server-side control | Web SecureFields (Advanced Flow) |
| Building a hybrid or fully web checkout | Consider Drop-in Checkout or Headless Checkout |
| CVV-only re-auth for a stored card | ✅ iOS Secure Fields — omit the other fields and pass saveToken at submit |
| Fully outsourcing the checkout UI | Consider Hosted Page |
PCI DSS scope
The SDK architecture is designed to support SAQ A-EP eligibility: card data is captured and tokenized by the SDK without your application code accessing the raw values. Formal scope determination requires assessment by a qualified security assessor (QSA). See Security and compliance for merchant obligations.