Skip to main content

3DS Mobile SDK
Enterprise

3D Secure is an Enterprise feature. Contact support@basistheory.com to request access.

The Basis Theory 3DS Mobile SDK makes it easy to start a 3DS transaction in iOS and Android apps.

Get started with our guide or continue reading the reference docs.

Before You Begin

This SDK requires the use of an API Key associated with a Public Application.

To create one, login into our Portal and create a new "Public" Application with the 3ds:session:create permission.

Installation

SPM

To add the Basis Theory iOS package using Swift Package Manager, open XCode and click on File → Add Packages, search for "https://github.com/Basis-Theory/3ds-ios", and click on Copy Dependency.

Currently, we don't support CocoaPods, contact support@basistheory.com if needed.

Initialization

let customHeaders: [String: String] = [
"Authorization": "Bearer your_token_here",
"Trace-Id": "your_trace_id_here"
]

private var threeDSService: ThreeDSService!

override func viewDidLoad() {
...
threeDSService = try ThreeDSService.builder()
.withApiKey("<PUBLIC_API_KEY>")
.withAuthenticationEndpoint("Your 3DS authentication endpoint URL", customHeaders) // https://developers.basistheory.com/docs/guides/process/authenticate-with-3ds#authenticating-a-session
.withSandbox() // make sure withSandbox is removed in production environments
.build()

try await threeDSService.initialize { [weak self] warnings in
DispatchQueue.main.async {
if let warnings = warnings, !warnings.isEmpty {
// inspect warnings
} else {
// continue
}
}
}
...
}

Security Warnings

During initialization, the SDK runs key security checks that may generate warnings for your application. It's up to your app to decide how to handle these warnings. Even if ignored, the SDK will continue to function normally. Here are the possible warnings and their severity levels:

  • App running on an emulator (High)
  • Debugger attached (Medium)
  • Device is jailbroken (High)
  • Handling these warnings properly is important for maintaining strong security.
  • SDK integrity compromised (High)
  • Unsupported OS or version (High)

Initialization Parameters

ParameterPlatformTypeDescription
withApiKeyiOS, AndroidstringThe API Key used to identify the Application
withApplicationContextAndroidContextThe application context
withAuthenticationEndpoint*iOS, Androidstring, objectYour 3DS authentication endpoint and any additional headers you may need to send to your authentication endpoint
withLocaleiOS, AndroidstringProvides information about the default locality in the following format {language}-{country}
withSandboxiOS, AndroidstringRuns 3DS process against a sandbox/testing environment, it must be enabled for your tenant