payViaPaygateV2 function

Future<NewTransactionResponse> payViaPaygateV2(
  1. String token,
  2. double amount,
  3. String identifier, {
  4. String? description,
  5. String? callbackUrl,
  6. String? phoneNumber,
  7. PaygateProvider? provider,
  8. Color? color,
})

Implementation

Future<NewTransactionResponse> payViaPaygateV2(
  String token,
  double amount,
  String identifier, {
  String? description,
  String? callbackUrl,
  String? phoneNumber,
  PaygateProvider? provider,
  Color? color,
}) async {
  try {
    final url = _ParamsNewTransactionV2(
      token,
      amount,
      identifier,
      description: description,
      callbackUrl: callbackUrl,
      phoneNumber: phoneNumber,
      provider: provider,
    ).paygateLink;

    if (await canLaunchUrl(url)) {
      await launchUrl(url, mode: LaunchMode.inAppBrowserView);
    }

    return NewTransactionResponse(
      null,
      status: NewTransactionResponseStatus.success,
      identifier: identifier,
    );
  } catch (e) {
    return NewTransactionResponse(
      null,
      status: NewTransactionResponseStatus.cantLaunchPage,
      identifier: identifier,
    );
  }
}