presentPaymentSheet method

Future<PaymentSheetResult> presentPaymentSheet()

Opens the native payment sheet and returns its terminal result.

Recoverable payment-attempt failures are handled inside the sheet and do not complete this future.

Implementation

Future<PaymentSheetResult> presentPaymentSheet() async {
  final value = await _channel.invokeMapMethod<Object?, Object?>(
    'presentPaymentSheet',
  );
  if (value == null) {
    throw const FormatException('Native payment sheet returned no result');
  }
  return PaymentSheetResult.fromJson(value);
}