Skip to main content

3DS Mobile SDK Methods

Create Session​

This method collects information from the browser on the background and sends it to the Basis Theory API, which then returns a newly created 3DS section.

Usage​

let threeDSService = // Initialize threeDSService

let session = try await threeDSService.createSession(tokenId: textFieldContent)

Parameters​

The createSession method takes an object as parameter w/ the following attributes:

AttributeRequiredTypeDescription
pantruestringThe Basis Theory token id for the card token to be used

Return​

The method returns a CreateThreeDsSessionResponse object with the following attributes:

AttributeTypeDescription
idstringThe created session id
cardBrandstringThe brand for the used card (i.e. Visa)
additionalCardBrandsarrayArray of all brands the card was identified as (if co-badged).

Start Challenge​

This method initiates the 3DS challenge process, if it was deemed necessary during the 3DS authentication.

Usage​

let threeDSService = // Initialize threeDSService
let session = // Create 3DS Session

try await self.threeDSService.startChallenge(
sessionId: sessionId, viewController: self,
onCompleted: { result in
// process successful challenge result
},
onFailure: { result in
// process failed challenge result
})

Parameters​

The startChallenge method takes in the following attributes:

AttributeTypeDescription
sessionIdstringThe 3DS session ID provided by createSession
viewControllerActivityViewController
onCompletedFunctionCallback to handle 3DS challenge completion.
onFailureFunctionCallback to handle 3DS challenge failure

Both callback functions take a ChallengeResponse object with the following properties:

public struct ChallengeResponse {
public let id: String
public let status: String // "successful" | "attempted" | "failed" | "unavailable" | "rejected"
public let details: String? // additional details depending on the status
}