showPaymentSelector method

  1. @override
Future<Map<String, dynamic>> showPaymentSelector(
  1. PaymentConfiguration paymentConfiguration,
  2. List<PaymentItem> paymentItems
)
override

Shows the payment selector to complete the payment operation.

Shows the payment selector with the paymentItems and paymentConfiguration specified, returning the payment method selected as a result if the operation completes successfully, or throws a PlatformException if there's an error on the native end.

Implementation

@override
Future<Map<String, dynamic>> showPaymentSelector(
  PaymentConfiguration paymentConfiguration,
  List<PaymentItem> paymentItems,
) async {
  final paymentResult = await _channel.invokeMethod('showPaymentSelector', {
    'payment_profile': jsonEncode(await paymentConfiguration.parameterMap()),
    'payment_items': paymentItems.map((item) => item.toMap()).toList(),
  }) as String;

  return jsonDecode(paymentResult) as Map<String, dynamic>;
}