startPayment static method

Future<PaymentResultData> startPayment(
  1. {@required String countryCode,
  2. @required String currencyCode,
  3. List<PaymentNetwork> paymentNetworks = const [],
  4. @required String merchantIdentifier,
  5. bool isPending = false,
  6. @required List<PaymentItem> paymentItems}
)

Implementation

static Future<PaymentResultData> startPayment({
  @required String countryCode,
  @required String currencyCode,
  // @required List<PaymentNetwork> paymentNetworks,
  List<PaymentNetwork> paymentNetworks = const [],
  @required String merchantIdentifier,
  bool isPending = false,
  @required List<PaymentItem> paymentItems,
}) async {
  assert(countryCode != null);
  assert(currencyCode != null);
  assert(paymentItems != null);
  assert(merchantIdentifier != null);
  assert(paymentItems != null);

  final Map<String, Object> args = <String, dynamic>{
    'paymentNetworks':
        paymentNetworks.map((item) => item.toString().split('.')[1]).toList(),
    'countryCode': countryCode,
    'currencyCode': currencyCode,
    'paymentItems':
        paymentItems.map((PaymentItem item) => item._toMap()).toList(),
    'merchantIdentifier': merchantIdentifier,
  };
  if (Platform.isIOS) {
    final dynamic result = await _channel.invokeMethod('startPayment', args);
    return PaymentResultData(result);
  } else {
    throw Exception("Not supported operation system");
  }
}