startTransaction method

Future<String> startTransaction()

Implementation

Future<String> startTransaction() async {
  try {
    if (Platform.isAndroid) {
      final String response =
          await _channel.invokeMethod('startTransaction', {
        'receiverUpiId': receiverUpiId,
        'receiverName': receiverName,
        'transactionRefId': transactionRefId,
        'transactionNote': transactionNote,
        'amount': amount.toString(),
        'currency': currency,
        'merchantId': merchantId,
      });
      return response;
    } else if (Platform.isIOS) {
      final result = await _channel.invokeMethod(
        'launch',
        {
          'uri': transactiondetailstostring(
            payeeAddress: receiverUpiId,
            payeeName: receiverName,
            transactionNote: transactionNote,
            transactionRef: transactionRefId,
            amount: amount,
            currency: currency,
            merchantId: merchantId,
            appname: appname,
          ),
        },
      );
      return result == true
          ? "Successfully Launched App!"
          : "Something went wrong!";
    } else {
      throw PlatformException(
        code: 'ERROR',
        message: 'Platform not supported!',
      );
    }
  } catch (error) {
    throw Exception(error);
  }
}