To answer both questions, yes, you can increase the security for payment using Touch ID, here, as I implemented it using the Apple example here , I added the following SendPaymentIntentHandler.swift functions:
func authenticate(successAuth: @escaping () -> Void, failure: @escaping (NSError?) -> Void) {
let authenticationContext = LAContext()
var error:NSError?
guard authenticationContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &error) else {
failure(error)
return
}
authenticationContext.evaluatePolicy(
.deviceOwnerAuthenticationWithBiometrics,
localizedReason: "Unlock to send the money",
reply: { [unowned self] (success, error) -> Void in
if( success ) {
successAuth()
}else {
let message = self.errorMessageForLAErrorCode(errorCode: (error! as NSError).code)
print(message)
failure(error! as NSError)
}
})
}
func errorMessageForLAErrorCode( errorCode:Int ) -> String{
var message = ""
switch errorCode {
case LAError.appCancel.rawValue:
message = "Authentication was cancelled by application"
case LAError.authenticationFailed.rawValue:
message = "The user failed to provide valid credentials"
case LAError.invalidContext.rawValue:
message = "The context is invalid"
case LAError.passcodeNotSet.rawValue:
message = "Passcode is not set on the device"
case LAError.systemCancel.rawValue:
message = "Authentication was cancelled by the system"
case LAError.touchIDLockout.rawValue:
message = "Too many failed attempts."
case LAError.touchIDNotAvailable.rawValue:
message = "TouchID is not available on the device"
case LAError.userCancel.rawValue:
message = "The user did cancel"
case LAError.userFallback.rawValue:
message = "The user chose to use the fallback"
default:
message = "Did not find error code on LAError object"
}
return message
}
. Touch ID , , , .