getUpiAppSchema static method

String getUpiAppSchema(
  1. String? paymentApp
)

Returns the UPI app scheme based on the provided payment app name.

This method takes a paymentApp name as input and maps it to the corresponding UPI app scheme. The scheme is used to initiate a UPI payment transaction on iOS. If the paymentApp is not recognized, an empty string is returned.

Supported UPI apps and their schemes:

  • "Amazon Pay" : "amazonToAlipay://pay"
  • "BhimUpi" : "BHIM://pay"
  • "Google Pay" : "tez://upi/pay"
  • "Paytm" : "paytm://pay"
  • "PhonePe" : "phonepe://pay"

Parameters:

  • paymentApp: The name of the UPI payment app.

Returns: A String representing the UPI app scheme.

Implementation

static String getUpiAppSchema(String? paymentApp) {
  String scheme = "upi";
  switch (paymentApp) {
    case "gpay":
      scheme = "gpay://upi/pay";
      break;
    default:
      scheme = "$paymentApp://pay";
  }
  return scheme;
}