Checkout3DSService
@objc
public final class Checkout3DSService : NSObject
The main class of the SDK that performs payment authentication and returns a list of warnings collected by the SDK concerning security.
-
Initializes a Checkout3DSService object.
Declaration
Swift
@objc public convenience init(environment: Environment = .production, locale: Foundation.Locale = .autoupdatingCurrent, uiCustomization: UICustomization = DefaultUICustomization(), appURL: URL? = nil)
Parameters
environment
(optional) The Checkout.com environment that the SDK will connect to. If no value is provided, the default is production. See Environment for more information.
locale
(optional) The customer’s locale and preferred language, used to localise the user interface. If no value is set, the device locale is used. (E.g. “en_GB”)
uiCustomization
The customizations for the challenge user interface. See UICustomization for more information.
-
Method to start the the authentication, passing the values you received in the Sessions API response into
authenticationParameters
.Note
Ensure there is a key window available (aUIWindow
whereUIWindow.isKeyWindow
istrue
). This is usually the case, except for particular circumstances such as whenviewDidLoad
is called for the firstUIViewController
on app launch, before a key window has been assigned.Declaration
Swift
public func authenticate(authenticationParameters: AuthenticationParameters, completionHandler: @escaping (_ error: AuthenticationError?) -> Void)
Parameters
authenticationParameters
The authentication parameters, including
sessionId
,sessionSecret
, andscheme
.completionHandler
Closure called on completion with the following value:
error
If authentication fails, an
AuthenticationError
indicating the reason for failure, otherwisenil
. -
A method your app can optionally call to bring the challenge UI to the foreground. That’s useful when the user is returning from their banking app (when they call your appURL) as part of an out-of-band challenge. The method will return true if an active authentication session is found, or will otherwise return false. Note : The maximum allowed URL length is 211 characters.
Declaration
Swift
@objc public static func handleAppURL(url: URL) -> Bool
Parameters
url
The deep link URL provided to the app by an app that handles out-of-band authentication.
-
Method to check for warnings of any potential security warnings or of rejected configuration requests. Use when initializing the SDK, or any time afterwards.
Note
this method blocks the calling thread. It is recommended to call this on a background thread and not the main thread.Declaration
Swift
public func getWarnings() -> Set<Warning>
Return Value
a collection of any warnings gathered by the 3DS SDK.
-
Frees up resources that are used by
Checkout3DSService
.Declaration
Swift
@objc public func cleanup()