Enterprise payment tokenization for iOS. Strengthen PCI compliance with Datacap's cross-platform tokenization solution. This production-ready app and SDK enable merchants and ISVs to integrate secure payment tokenization with support for both certification and production environments.
- Enterprise Security: PCI compliance ready for production use
- Processor Independence: Switch payment processors without retokenization
- P2PE Validated: Point-to-point encryption certified solutions
- Cross-Platform: Use tokens across all sales channels
- 35+ Years of Innovation: Datacap's proven payment technology
- Enhanced Dark Mode: Comprehensive overhaul with improved contrast and visibility
- Adaptive Logo: Logo now inverts to white in dark mode for better visibility
- Better Contrast: All UI elements optimized for both light and dark appearances
- Dynamic Shadows: Shadows adjust intensity based on appearance mode
- Improved Buttons: Brighter colors and subtle borders in dark mode
- Menu Pill Updates: Better icon visibility and adaptive backgrounds
- Settings Polish: Segmented control and form elements adapt to dark mode
- Professional Finish: Enterprise-ready with meticulous attention to accessibility
Datacap-MobileToken-iOS-2025/
├── DatacapTokenLibrary/ # Ready-to-use SDK for integrators
│ ├── Sources/ # DatacapTokenService.swift
│ └── README.md # Quick integration guide
├── DatacapMobileTokenDemo/ # Reference implementation
│ ├── DatacapMobileDemo/ # Demo app with UI examples
│ └── *.xcodeproj # Xcode project
├── INTEGRATION_GUIDE.md # Detailed integration instructions
├── LICENSE # MIT License
└── CLAUDE.md # Developer reference guide
graph TB
subgraph "iOS App Layer"
UI[User Interface]
UI --> |iPhone| IPHONE[Compact Layout]
UI --> |iPad| IPAD[Feature Cards Layout]
IPHONE --> DARK_I[Dark Mode]
IPHONE --> LIGHT_I[Light Mode]
IPAD --> DARK_P[Dark Mode]
IPAD --> LIGHT_P[Light Mode]
end
subgraph "SDK Layer"
TOKEN[DatacapTokenService]
TOKEN --> VALIDATE[Card Validation]
TOKEN --> FORMAT[Auto-Formatting]
TOKEN --> NETWORK[Network Layer]
end
subgraph "API Layer"
NETWORK --> |Cert Mode| CERT_API[token-cert.dcap.com]
NETWORK --> |Prod Mode| PROD_API[token.dcap.com]
CERT_API --> RESPONSE[Token Response]
PROD_API --> RESPONSE
end
subgraph "Security Layer"
RESPONSE --> SECURE[Secure Storage]
SECURE --> PCI[PCI Compliance]
SECURE --> ENCRYPT[TLS Encryption]
end
UI --> TOKEN
style UI fill:#2a2a2a,stroke:#fff,stroke-width:2px,color:#fff
style TOKEN fill:#941a25,stroke:#fff,stroke-width:2px,color:#fff
style CERT_API fill:#778799,stroke:#fff,stroke-width:2px,color:#fff
style PROD_API fill:#228b22,stroke:#fff,stroke-width:2px,color:#fff
style PCI fill:#54595f,stroke:#fff,stroke-width:2px,color:#fff
graph TB
subgraph YourApp["Your iOS App"]
APP[Your App] --> SDK[DatacapTokenService]
SDK --> |"Option 1"| UI[Built-in Card UI]
SDK --> |"Option 2"| CUSTOM[Your Custom UI]
end
subgraph DatacapAPI["Datacap API"]
SDK --> AUTH[Authorization Header]
AUTH --> |"POST"| OTU["/v1/otu Endpoint"]
OTU --> TOKEN[Secure Token]
end
subgraph Response["Response"]
TOKEN --> |"Success"| RESP["Token + Card Details"]
TOKEN --> |"Error"| ERR[Error Message]
end
style SDK fill:#941a25,stroke:#fff,stroke-width:2px,color:#fff
style OTU fill:#228b22,stroke:#fff,stroke-width:2px,color:#fff
style APP fill:#778799,stroke:#fff,stroke-width:2px,color:#fff
sequenceDiagram
participant App as iOS App
participant SDK as DatacapTokenService
participant API as Datacap API
participant Server as Your Server
App->>SDK: Initialize with API Key
App->>SDK: requestToken() or generateTokenDirect()
SDK->>SDK: Validate Card (Luhn)
SDK->>API: POST /v1/otu<br/>Auth: Token Key<br/>Body: Card Data
API-->>SDK: Token Response
SDK-->>App: DatacapToken object
App->>Server: Send token for payment processing
Server->>Server: Process payment with token
graph LR
subgraph KeyMgmt["API Key Management"]
CERT[Certification Key] --> CERTENV["Cert Environment<br/>token-cert.dcap.com"]
PROD[Production Key] --> PRODENV["Prod Environment<br/>token.dcap.com"]
end
subgraph Storage["Settings Storage"]
CERT -.-> CS[DatacapCertificationPublicKey]
PROD -.-> PS[DatacapProductionPublicKey]
MODE[Current Mode] --> ACTIVE[Active Environment]
end
style CERT fill:#778799,stroke:#fff,stroke-width:2px,color:#fff
style PROD fill:#941a25,stroke:#fff,stroke-width:2px,color:#fff
style CERTENV fill:#54595f,stroke:#fff,stroke-width:2px,color:#fff
style PRODENV fill:#228b22,stroke:#fff,stroke-width:2px,color:#fff
graph TB
subgraph "Floating Menu Pill"
MODE[Mode Toggle<br/>Cert/Prod]
SETTINGS[Settings<br/>Icon]
HELP[Help<br/>Icon]
end
subgraph "Main Screen"
CARD[Card Entry Form]
TOKEN[Generate Token]
RESULT[Token Display]
end
subgraph "Overlays"
SVIEW[Settings View]
HVIEW[Help View]
end
MODE --> CARD
SETTINGS --> SVIEW
HELP --> HVIEW
TOKEN --> RESULT
style MODE fill:#941a25,stroke:#fff,stroke-width:2px,color:#fff
style CARD fill:#2a2a2a,stroke:#444,stroke-width:1px,color:#fff
graph TB
subgraph "iPad Optimizations"
DETECT[Device Detection] --> LAYOUT[Dynamic Layout]
LAYOUT --> CONTAINER[800pt Container]
LAYOUT --> TYPOGRAPHY[48pt Titles]
LAYOUT --> CARDS[Feature Cards]
subgraph "Feature Cards"
SEC[Enterprise Security<br/>PCI DSS Level 1]
PROC[Instant Processing<br/>Sub-second Response]
ENV[Dual Environment<br/>Cert & Production]
end
CARDS --> SEC
CARDS --> PROC
CARDS --> ENV
end
style DETECT fill:#54595f,stroke:#fff,stroke-width:2px,color:#fff
style TYPOGRAPHY fill:#941a25,stroke:#fff,stroke-width:2px,color:#fff
style CARDS fill:#228b22,stroke:#fff,stroke-width:2px,color:#fff
graph LR
subgraph "Appearance Detection"
TRAIT[Trait Collection] --> DETECT{Light or Dark?}
DETECT -->|Light Mode| LIGHT[Light Colors]
DETECT -->|Dark Mode| DARK[Dark Colors]
end
subgraph "Dynamic Color System"
LIGHT --> BG_L[Light Background<br/>#f6f9fc]
LIGHT --> TEXT_L[Dark Text<br/>#231f20]
LIGHT --> FORM_L[White Forms]
DARK --> BG_D[Dark Background<br/>#1c1c1e]
DARK --> TEXT_D[Light Text<br/>#f0f0f2]
DARK --> FORM_D[Gray Forms<br/>#2c2c2e]
end
subgraph "UI Components"
FORM_L --> UI[Adaptive UI]
FORM_D --> UI
UI --> GLASS[Glass Morphism]
UI --> CONTRAST[High Contrast]
UI --> ACCESS[Accessibility]
end
style TRAIT fill:#778799,stroke:#fff,stroke-width:2px,color:#fff
style LIGHT fill:#f6f9fc,stroke:#333,stroke-width:2px,color:#333
style DARK fill:#1c1c1e,stroke:#fff,stroke-width:2px,color:#fff
style UI fill:#941a25,stroke:#fff,stroke-width:2px,color:#fff
cp DatacapTokenLibrary/Sources/DatacapTokenService.swift YourProject/
import UIKit
class PaymentViewController: UIViewController {
private var tokenService: DatacapTokenService!
override func viewDidLoad() {
super.viewDidLoad()
tokenService = DatacapTokenService(
publicKey: "YOUR_TOKEN_KEY",
isCertification: true // false for production
)
tokenService.delegate = self
}
}
// Option 1: Use built-in UI
@IBAction func payButtonTapped() {
tokenService.requestToken(from: self)
}
// Option 2: Use your own UI
let cardData = CardData(
cardNumber: "4111111111111111",
expirationMonth: "12",
expirationYear: "25",
cvv: "123"
)
Task {
do {
let token = try await tokenService.generateTokenDirect(for: cardData)
// Process payment with token
} catch {
// Handle error
}
}
extension PaymentViewController: DatacapTokenServiceDelegate {
func tokenRequestDidSucceed(_ token: DatacapToken) {
print("Token: \(token.token)")
print("Card: \(token.maskedCardNumber)")
print("Type: \(token.cardType)")
// Send token to your server
}
func tokenRequestDidFail(error: DatacapTokenError) {
// Handle error
}
func tokenRequestDidCancel() {
// User cancelled
}
}
- Real API Integration: Direct REST API calls to Datacap's OTU endpoints
- Dual Key Support: Separate keys for certification and production
- Two Integration Modes: Built-in UI or bring your own
- Card Validation: Luhn algorithm, BIN detection, format validation
- Zero Dependencies: Pure Swift, no external libraries
- Easy Integration: Single file to add to your project
- Modern UI: iOS 26 Liquid Glass design system
- Settings Management: Configure and test both environments
- Smart Card Entry: Auto-formatting, type detection
- Native Date Picker: Wheel-style expiration selection
- Live Validation: Real-time feedback as you type
- Token Display: Copy token with one tap
- Dark Mode: Full support for light and dark appearance
- iPad Optimized: Responsive layouts with feature cards
- Accessibility: High contrast and dynamic type support
- Certification:
https://token-cert.dcap.com/v1/otu
- Production:
https://token.dcap.com/v1/otu
POST /v1/otu
Authorization: {your-token-key}
Content-Type: application/json
{
"Account": "4111111111111111",
"ExpirationMonth": "12",
"ExpirationYear": "25",
"CVV": "123"
}
{
"Token": "DC4:AAAMbdJpMn6wZYlx84etCekz...",
"Brand": "Visa",
"ExpirationMonth": "12",
"ExpirationYear": "2025",
"Last4": "1111",
"Bin": "411111"
}
Use these in certification mode:
Card Type | Number | CVV | Exp |
---|---|---|---|
Visa | 4111111111111111 | 123 | Any future date |
Mastercard | 5555555555554444 | 123 | Any future date |
Amex | 378282246310005 | 1234 | Any future date |
Discover | 6011111111111117 | 123 | Any future date |
Diners | 36700102000000 | 123 | Any future date |
- PCI Compliant: No card data storage, tokenization only
- TLS Encryption: All API calls use HTTPS
- Input Validation: Luhn algorithm, BIN validation
- Secure Entry: Masked CVV input
- One-Time Tokens: Tokens are single-use only
# Clone repository
git clone https://github.com/datacapsystems/Datacap-MobileToken-iOS-2025.git
cd Datacap-MobileToken-iOS-2025
# Open in Xcode
open DatacapMobileTokenDemo/DatacapMobileTokenDemo.xcodeproj
# Build and run (⌘+R)
- Launch app
- Tap Settings (gear icon)
- Select Certification mode
- Enter your test API key
- Save configuration
- Tap "Generate Token"
- iOS 15.6+
- Xcode 16.0+
- Swift 5.0+
- Network connectivity
- Developer Portal: dsidevportal.com
- Support: datacapsystems.com/support
- GitHub Issues: Report bugs here
This project is licensed under the MIT License - see the LICENSE file for details.
Secure Payment Solutions Since 1983