MastercardTAFHelper
public class MastercardTAFHelper
The MastercardTAFHelper class is used to bind the Mastercard provisioned token ID to the device and authenticate transactions.
Version
Version 3.0Since
Since 3.0-
createBinding(forTokenID:correlationID: idvSessionHandler: deviceAuthenticationHandler: completionHandler: ) This API binds the Mastercard token to the device.
Declaration
Swift
public func createBinding(forTokenID tokenID: String, correlationID: String, idvSessionHandler: @escaping (IDVSession) -> Void, deviceAuthenticationHandler: @escaping (DeviceAuthentication) -> Void, completionHandler: @escaping (IDVSession?, TMGError?) -> Void)Parameters
forTokenIDA Mastercard token ID. This is a mandatory input that is retrieved during the tokenization process.
correlationIDA mandatory input session ID that is generated by the app.
idvSessionHandlerA completion handler for app to take action for Token Binding process. A
IDVSessionwill be returned as a parametter. This is a mandatory input.deviceAuthenticationHandlerA completion handler for app to take action for device authentication where a
DeviceAuthenticationparameter is returned. This is a mandatory input.completionHandlerA completion handler to notify to app that Token Binding is success or failed with error. This is a mandatory input.
- On success: A
nilvalue for bothTMGErrorandIDVSessionwill be returned. - On app action required: An optional
IDVSessionand aTMGErrorwill be returned. - On failure: A
TMGErrorindicating the error encountered.- Possible errors:
deviceEnvironmentUnsafe(code:)invalidIdvMethodinvalidConfigParamsinvalidRequiredParamsinvalidOTPMessageserverErrorIdvNotAvailableinternalError(additionalMessage:)serverError(httpStatusCode:additionalMessage:)serverErrorCryptoErrorserverErrorInvalidTokenStateserverErrorNoSessionFoundserverErrorWrongOTPserverErrorExpiredOTPserverErrorRetryLimitExceededserverErrorTooManyRequestserverIsNotAccessible
- Possible errors:
- On success: A
-
Gets the binding status.
Throws
TMGError: When an error occurs during the get binding status process.
Declaration
Swift
public func bindingState(forTokenID tokenID: String) throws -> BindingStateParameters
forTokenIDThe Mastercard provisioned token ID for which the binding state is queried. This is a mandatory input.
Return Value
BindingState: If the binding is performed successfully,BindingState.boundis returned, otherwiseBindingState.unboundis returned.
-
Authenticates the transaction for
tokenID.Declaration
Swift
public func authenticateTransaction(forTokenID tokenID: String, context: TransactionContext, deviceAuthenticationHandler: @escaping (DeviceAuthentication) -> Void, completionHandler: @escaping (String?, TMGError?) -> Void)Parameters
forTokenIDA Mastercard token ID. This is a mandatory input that is retrieved during the tokenization process.
contextThe context of the transaction, containing critical details about the transaction such as merchant information, amount, and currency. This parameter cannot be null.
deviceAuthenticationHandlerA completion handler for app to take action for device authentication where a
DeviceAuthenticationparameter is returned. This is a mandatory input.completionHandlerA completion handler to notify the app on whether the transaction is authenticated successfully. This is a mandatory input.
-
The list of Identity and Verification method types in
IDVType.Version
Version 3.0See moreSince
Since 3.0Declaration
Swift
public enum IDVType : String, Codable -
IDVMethoddefines the Mastercard IDV methods that are available to the end user.Version
Version 3.0See moreSince
Since 3.0Declaration
Swift
public struct IDVMethod : Codable -
The
BindingStateenum defines the current state of thetokenId.Version
Version 3.0See moreSince
Since 3.0Declaration
Swift
public enum BindingState : String -
TransactionContextdefines the context of a transaction, encompassing details such as the merchant name, transaction amount, and currency code.Version
Version 3.0See moreSince
Since 3.0Declaration
Swift
public struct TransactionContext
MastercardTAFHelper Class Reference