preferred_upi_launcher

A Flutter plugin to discover installed UPI payment apps and launch them with pre-filled payment details — directly, without any payment gateway or intermediary.

Platforms: Android 5.0+ (API 21+) · iOS 12.0+


What it does

  • Discover which UPI apps (Google Pay, PhonePe, Paytm, etc.) are installed on the user's device
  • Launch a specific UPI app with the payee VPA, amount, and transaction reference already filled in
  • No PayU SDK, no Razorpay, no merchant account — money moves directly via the UPI network

Installation

# pubspec.yaml
dependencies:
  preferred_upi_launcher:
    git:
      url: https://github.com/your-username/preferred_upi_launcher.git
      ref: main
flutter pub get

Android setup

Nothing required. The plugin's manifest is automatically merged into your app via Gradle.

iOS setup

Add the following to your ios/Runner/Info.plist (inside the root <dict>):

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>gpay</string>
    <string>phonepe</string>
    <string>paytm</string>
    <string>upi</string>
    <string>amazonpay</string>
    <string>whatsapp</string>
    <string>cred</string>
    <string>mobikwik</string>
    <string>freecharge</string>
    <string>airtel</string>
</array>

Usage

import 'package:preferred_upi_launcher/preferred_upi_launcher.dart';

// 1. Get installed UPI apps
final apps = await PreferredUpiLauncher.getInstalledApps();

// 2. Define payment details
const config = UpiPaymentConfig(
  payeeVpa: 'yourname@bank',     // UPI VPA of the recipient
  payeeName: 'Your Name',
  amount: '555',                  // INR, as a string
  transactionRef: 'ORD_001',      // unique order/transaction ID
);

// 3. Launch a specific app (e.g. from a list the user tapped)
await PreferredUpiLauncher.launchApp(app: apps[0], config: config);

Error handling

import 'package:flutter/services.dart';

try {
  await PreferredUpiLauncher.launchApp(app: app, config: config);
} on PlatformException catch (e) {
  // e.code: APP_NOT_FOUND | INVALID_ARGUMENT | LAUNCH_ERROR | LAUNCH_FAILED
  print('Launch failed [${e.code}]: ${e.message}');
}

Supported UPI Apps

Android — 23 apps detected by package name (+ intent catch-all for unlisted apps): Google Pay · PhonePe · Paytm · BHIM · Amazon Pay · WhatsApp Pay · CRED · MobiKwik · FreeCharge · Axis Pay · Axis Mobile · HDFC PayZapp · iMobile Pay · YONO SBI · Kotak · Airtel Thanks · Samsung Pay · DBS digibank · IDFC First Bank · Jupiter · Fi Money · BOB World · WhatsApp Business

iOS — 10 apps detected by URL scheme: Google Pay · PhonePe · Paytm · BHIM · Amazon Pay · WhatsApp Pay · CRED · MobiKwik · FreeCharge · Airtel Thanks


Requirements

  • Physical device for testing (UPI apps are not available on emulators/simulators)
  • No payment status callback is provided — the plugin opens the UPI app but does not receive the result

Documentation

Full internals documentation (how Android discovery works, how iOS URL schemes work, all error codes) is in document.md.