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. A completed result describes the client experience; retrieve the owner-scoped Order from the merchant backend before fulfillment.

Throws PlatformException when the native plugin is unavailable or the sheet was not initialized.

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);
}