Risk iOS SDK
Last updated: October 7, 2026
Version 6.0.1
The checkout-risk-sdk-iOS supports the Fraud Detection solution by capturing advanced fraud signals that are leveraged in Checkout.com's machine learning model for risk scores.
Information
To enable access to the Risk SDK, contact your account manager or request support.
For more information, see Integrate with Risk SDK.
Generate a public API key from your Dashboard.
The minimum requirements to use the iOS SDK are:
- iOS 12.0 or later as a deployment target
- Xcode 12.4 or later
- Swift 5.3 or later
We recommend using Swift Package Manager to add our SDK due to its ease of use, but we also support integration via the CocoaPods dependency manager.
Add our GitHub repository's URL (https://github.com/checkout/checkout-risk-sdk-ios) as a package dependency in your app.
For detailed steps, follow the guide on Apple's documentation.
Initialize the package by passing the:
- Public API key
- MSSD, which you can find in API endpoints
- Environment
1let yourConfig = RiskConfig(publicKey: "pk_xxx", mssd: "xxxxxxxx", environment: RiskEnvironment.sandbox)23// Initialize early-on in your app4self.riskSDK = Risk.init(config: yourConfig)
Use the configure method to complete your setup after initialization. When the method is called, preliminary checks are made to Checkout. com's internal APIs. These APIs retrieve other configurations required for collecting device data.
If the checks fail or the merchant is disabled, an error is returned and logged. You can also see more information on your Xcode console while in development mode.
If the checks are successful, the method returns an instance of Risk. You can then call the publishData method on the instance to publish the data.
1import RiskSDK23// Example usage of package4let yourConfig = RiskConfig(publicKey: "pk_xxx", mssd: "xxxxxxxx", environment: RiskEnvironment.sandbox)56// Initialize in your app7self.riskSDK = Risk.init(config: yourConfig)89// Complete your setup and publish data10self.riskSDK.configure { configurationResult in1112switch configurationResult {13case .failure(let errorResponse):14print(errorResponse.localizedDescription)15case .success():16self.riskSDK.publishData { result in1718switch result {19case .success(let response):20print(response.deviceSessionId)21case .failure(let errorResponse):22print(errorResponse.localizedDescription)23}24}25}2627}
1public func configure(completion: @escaping (Result<Void, RiskError.Configuration>) -> Void) {2...3}45public func publishData(cardToken: String? = nil, completion: @escaping (Result<PublishRiskData, RiskError>) -> Void) {6...7}8public struct RiskConfig {9let publicKey: String10let mssd: String11let environment: RiskEnvironment12let framesMode: Bool1314public init(publicKey: String, mssd: String, environment: RiskEnvironment, framesMode: Bool = false) {15self.publicKey = publicKey16self.mssd = mssd17self.environment = environment18self.framesMode = framesMode19}20}2122public enum RiskEnvironment {23case qa24case sandbox25case production26}2728public struct PublishRiskData {29public let deviceSessionId: String30}3132public enum RiskError: LocalizedError, Equatable {33case configuration(Configuration)34case publish(Publish)35}3637public enum RiskError {38case configuration(Configuration)39case publish(Publish)40}4142public extension RiskError {43enum Configuration: LocalizedError {44case integrationDisabled45case couldNotRetrieveConfiguration4647public var errorDescription: String? {48switch self {49case .integrationDisabled:50return "Integration disabled"5152case .couldNotRetrieveConfiguration:53return "Error retrieving configuration"54}55}56}5758enum Publish: LocalizedError {59case couldNotPublishRiskData60case couldNotPersisRiskData61case fingerprintServiceIsNotConfigured6263public var errorDescription: String? {64switch self {65case .couldNotPublishRiskData:66return "Error publishing risk data"6768case .couldNotPersisRiskData:69return "Error persisting risk data"7071case .fingerprintServiceIsNotConfigured:72return "Fingerprint service is not configured. Please call configure() method first."73}74}75}76}