startVerification method

  1. @override
Future<String> startVerification({
  1. required String id,
  2. required String key,
  3. String? brandLogoUrl,
  4. IdentityStyle? style,
})
override

Implementation

@override
Future<String> startVerification({
  //* The verificationSessionId from your server endpoint
  required String id,
  //* The ephemeralKeySecret from your server endpoint
  required String key,
  //* Configure a square brand logo. Recommended image size is [32 x 32 points].
  String? brandLogoUrl,
  //* Optional styling configuration for the verification UI
  IdentityStyle? style,
}) async {
  try {
    final result =
        await methodChannel.invokeMethod<String>('startVerification', {
      'id': id,
      'key': key,
      'brandLogoUrl': brandLogoUrl,
      if (style != null) 'style': style.toMap(),
    });
    if (result == null) {
      throw StripeIdentityException(
        'NULL_RESULT',
        'The platform returned a null result',
      );
    }
    return result;
  } on PlatformException catch (e) {
    // Convert PlatformException to StripeIdentityException for consistent error handling
    throw StripeIdentityException(
      e.code,
      e.message ?? 'An unknown error occurred',
    );
  }
}