flutter_upi 0.0.2

  • README.md
  • Example
  • Installing
  • Versions
  • 78

FlutterUPI Plugin #

A flutter plugin to invoke UPI apps on the phone for Android and get the transaction information in response. This plugin supports only Android as of now.

Demo with the PayTM App

Getting Started #

Simply import the plugin

import 'package:flutter_upi/flutter_upi.dart';

And then use the initiateTransaction method as shown in the code below.

String response = await FlutterUpi.initiateTransaction(
    app: FlutterUpiApps.PayTM,
    pa: "receiver@upi",
    pn: "Receiver Name",
    tr: "UniqueTransactionId",
    tn: "This is a transaction Note",
    am: "5.01",
    mc: "YourMerchantId", // optional
    cu: "INR",
    url: "https://www.google.com",


The response is a String that contains all the relevant information. Here is how the String looks like.


Please note that some parameters in the response can be undefined when using different apps.

Parsing the Response #

You can write your own logic to parse the response string or you can use the FlutterUpiResponse class to create a Map out of it.

FlutterUpiResponse flutterUpiResponse = FlutterUpiResponse(response);
print(flutterUpiResponse.txnId); // prints transaction id
print(flutterUpiResponse.txnRef); //prints transaction ref 
print(flutterUpiResponse.Status); //prints transaction status
print(flutterUpiResponse.approvalRefNo); //prints approval reference number
print(flutterUpiResponse.responseCode); //prints the response code

Supported Apps and Platforms #

As of now the plugin only supports Android. Since I am not an iOS developer, I have only been able to write the code for Android. If you are interested, feel free to get in touch or create PR if you can do this for iOS as well.

The plugins supports three apps as of now which I have tested this plugin with. You can use the predefined constants in the FlutterUpiApps class and pass it to the app named argument in the initiateTransaction method.

FlutterUpiApps.BHIMUPI will launch the BHIM UPI App

FlutterUpiApps.GooglePay will launch the GooglePay App

FlutterUpiApps.PayTM will launch the PayTM App

FlutterUpiApps.PhonePe will launch the PhonePe App

FlutterUpiApps.MiPay will launch the MiPay App

FlutterUpiApps.AmazonPay will launch the AmazonPay App

FlutterUpiApps.TrueCallerUPI will launch the TrueCallerUPI App

FlutterUpiApps.MyAirtelUPI will launch the MyAirtelUPI App

Error Responses #

The response String can contain any of the following strings as well.

app_not_installed : Application not installed.

invalid_params : Request parameters are wrong.

user_canceled : User canceled the flow.

null_response : No data received.

You need to write your own code to handle these responses in your app. Check out the example folder for more implementation details.

Report any issues if you face any or drop me an email at samarthagarwal@live.com #

0.0.2 #

  • Added UPI Invocation with PhonePe, MyAirtelUPI, MiPay, TrueCallerUPI, AmazonPay Apps

0.0.1 #

  • Added UPI Invocation with PayTM, BHIMUPI and GooglePay Apps


flutter_upi_example #

Demonstrates how to use the flutter_upi plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_upi: ^0.0.2

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_upi/flutter_upi.dart';
Version Uploaded Documentation Archive
0.0.2 May 20, 2019 Go to the documentation of flutter_upi 0.0.2 Download flutter_upi 0.0.2 archive
0.0.1 May 13, 2019 Go to the documentation of flutter_upi 0.0.1 Download flutter_upi 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jun 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.2
  • pana: 0.12.18
  • Flutter: 1.5.4-hotfix.2


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

26 out of 26 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/flutter_upi.dart. (-1 points)

Analysis of lib/flutter_upi.dart reported 2 hints:

line 20 col 10: Name non-constant identifiers using lowerCamelCase.

line 21 col 10: Name non-constant identifiers using lowerCamelCase.

Maintenance issues and suggestions

Support latest dependencies. (-5 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies