payWithApp static method

Future<UpiResponse?> payWithApp({
  1. required UpiPayment payment,
  2. required UpiApp app,
})

Pay directly with a specific UPI app (no picker shown)

Use this when you already know which app the user wants.

Implementation

static Future<UpiResponse?> payWithApp({
  required UpiPayment payment,
  required UpiApp app,
}) async {
  if (!UpiValidator.isValidVpa(payment.payeeVpa)) {
    throw UpiException('Invalid UPI VPA: "${payment.payeeVpa}"');
  }

  final upiUrl = UpiUrlBuilder.build(payment);
  return _platform.launchUpiApp(
    upiUrl: upiUrl,
    packageName: app.packageName,
  );
}