createAuthentication method

Future<AuthenticationResult> createAuthentication(
  1. String tokenId, {
  2. required int amount,
  3. String? currency,
})

Creates a 3DS authentication for a multiple-use token

@param tokenId The id of a multiple-use token @param amount The amount you will eventually charge. This value is used to display to the user in the 3DS authentication view. @param currency Currency when requesting for 3DS authentication

Implementation

Future<AuthenticationResult> createAuthentication(
  String tokenId, {
  required int amount,
  String? currency,
}) async {
  var params = <String, dynamic>{
    'publishedKey': publishedKey,
    'tokenId': tokenId,
    'amount': amount,
  };

  if (currency != null) {
    params['currency'] = currency;
  }

  try {
    var result = await _channel.invokeMethod('createAuthentication', params);
    return AuthenticationResult(authentication: Authentication.from(result));
  } on PlatformException catch (e) {
    return AuthenticationResult(
      errorCode: e.code,
      errorMessage: e.message ?? '',
    );
  }
}