azhar1038/UPI-Plugin-Flutter
Flutter Plugin to do UPI transaction using different apps like PhonePe, Google Pay, PayTM etc.
前往 github 下載This repository is now Archived.
UPI India (for Android only)
This plugin is used to integrate UPI Options in your Android app. You can use this plugin to initiate transaction to any UPI ID or to any Account number.
Check the Supported apps here.
For a complete example of how to use this plugin, look at the Example tab or in the Github repository.
IMPORTANT!
Some apps like Google Pay, PhonePe, Paytm are currently unable to process the transaction and showing “Maximum limit exceeded” or “Risk threshold exceeded” errors. Reason for this is not clear yet.
Help required
If you can help to extend this for iOS, feel free to check this issue.
If you can help to verify the compatibility of different UPI apps, feel free to check this issue.
Thanks in advance :)
![How example looks](https://user-images.githubusercontent.com/42082172/82893565-d3643480-9f6e-11ea-96a7-493181df6214.gif)
![Success Status](https://user-images.githubusercontent.com/42082172/94981672-b4dffc80-0551-11eb-821b-a3adb7f7a62f.jpg)
Classes to know
- UpiIndia - It is the main class containing two methods:
-
getAllUpiApps() - It takes:
bool allowNonVerifiedApps
: Should include apps whose working has not been verified yet or notList[UpiApp] includeOnly
: List of UpiApps which should be shown and hide the others.bool mandatoryTransactionId
: Should include those apps which doesn’t return Transaction ID or not
-
startTransaction() - It takes:
double amount
: Amount to transfer (in ₹)UpiApp app
: Which app to use to do the transactionString currency
: Currently only supports INRbool flexibleAmount
: Settrue
to allow user to fill the amountString merchantId
: Merchant code if presentString receiverId
: ID of the receiverString receiverName
: Name of receiverString transactionNote
: A note about the transactionString transactionRefId
: Reference Id of transactionString url
: For some extra information
-
UpiApp - It contains supported apps. It is also the model class for the apps returned by getAllUpiApps().
-
UpiResponse - You will use this to get response from the requested app.
-
UpiPaymentStatus - Use this to see if transaction was a success or not.
Custom Exception thrown by this Plugin (with self explanatory names)
-
UpiIndiaAppNotInstalledException
-
UpiIndiaUserCancelledException
-
UpiIndiaNullResponseException
-
UpiIndiaInvalidParametersException
-
UpiIndiaActivityMissingException
-
UpiIndiaAppsGetException
How to start transaction?
Step 1:
Import the Package:
import 'package:upi_india/upi_india.dart';
Step 2:
Create UpiIndia object.
UpiIndia _upiIndia = UpiIndia();
Step 3:
Get list of all apps in the device which can handle UPI Intent, as shown.
List<UpiApp>? apps;
@override
void initState() {
_upiIndia.getAllUpiApps(mandatoryTransactionId: false).then((value) {
setState(() {
apps = value;
});
}).catchError((e) {
apps = [];
});
super.initState();
}
OR
You can directly use the predefined apps, like:
UpiApp app = UpiApp.googlePay;
and assign it to the app parameter in Step 4
Step 4:
Create a method which will start the transaction on being called, as shown.
To initiate transaction to any UPI ID, directly pass the ID to receiverId
Future<UpiResponse> initiateTransaction(UpiApp app) async {
return _upiIndia.startTransaction(
app: app,
receiverUpiId: "9078600498@ybl",
receiverName: 'Md Azharuddin',
transactionRefId: 'TestingUpiIndiaPlugin',
transactionNote: 'Not actual. Just an example.',
amount: 1.00,
);
}
Step 5:
Call this method on any button click or through FutureBuilder and then you will get the Response!
How to handle Response?
Step 1:
After getting the snapshot from the Future, check if there is any error or not:
if (snapshot.hasError) {
switch (snapshot.error.runtimeType) {
case UpiIndiaAppNotInstalledException:
print("Requested app not installed on device");
break;
case UpiIndiaUserCancelledException:
print("You cancelled the transaction");
break;
case UpiIndiaNullResponseException:
print("Requested app didn't return any response");
break;
case UpiIndiaInvalidParametersException:
print("Requested app cannot handle the transaction");
break;
default:
print("An Unknown error has occurred");
break;
}
}
Step 2:
If snapshot.hasError is false, you can then get the response UpiResponse from snapshot.data and extract these parameters:
- Transaction ID
- Response Code
- Approval Reference Number
- Transaction Reference ID
- Status
Step 3:
Check the Status property. It has following values:
- UpiPaymentStatus.SUCCESS
- UpiPaymentStatus.SUBMITTED
- UpiPaymentStatus.FAILURE
If Status is SUCCESS, Congratulations! You have successfully used this plugin.
For a complete example of how to use this plugin, look at the Example tab or in the Github repository.
Supported Apps
Verified Apps - These Apps have been tested to work fine with this plugin (included by default):
- All Bank
- Amazon Pay
- Axis Pay
- Baroda Pay
- BHIM
- Cent UPI
- Cointab
- Corp UPI
- DCB UPI
- Fino BPay
- Freecharge
- Google Pay
- iMobile ICICI
- Indus Pay
- Khaali Jeb
- Maha UPI
- Mobikwik
- Oriental Pay
- Paytm
- Paywiz
- PhonePe
- PSB
- SBI Pay
- Yes Pay
Apps that don’t return Transaction ID in response (pass mandatoryTransactionId: false
to getAllUpiApps
to use them):
- MiPay (Both Play Store and GetApps version)
- HSBC Simply Pay
Non-Verified Apps - These apps haven’t been tested yet (pass allowNonVerifiedApps: true
to getAllUpiApps
to use them):
- True Caller
- BOI UPI
- CSB UPI
- CUB UPI
- digibank
- Equitas UPI
- Kotak
- PayZapp
- PNB
- RBL Pay
- realme PaySa
- United UPI Pay
- Vijaya UPI
Unsupported Apps
(These apps are not working as expected currently)
- Airtel Thanks
- AUPay
- Bandhan Bank UPI
- CANDI
- Indian Bank UPI
- Jet Pay
- KBL UPI
- KVB UPI
- LVB UPAAY
- Synd UPI
- UCO UPI
- Ultra Cash
Special Thanks to:
- Reetesh Ranjan for his contributions in making this plugin much better!
- Yashwardhan Pauranik for enhancing the example app!
Don’t forget to give Like and Stars!
![](/images/banner-woo.jpg)
與 azhar1038/UPI-Plugin-Flutter 相關優秀專案推薦下載
AppFlowy
47859
AppFlowy is an open-source alternative to Notion. You are in charge of your data and customizations. Built with Flutter and Rust.
localsend
33797
An open-source cross-platform alternative to AirDrop
spotube
23772
🎧 Open source Spotify client that doesn't require Premium nor uses Electron! Available for both desktop & mobile!
revanced-manager
15035
💊 Application to use ReVanced on Android
gsy_github_app_flutter
14559
Flutter 超完整的开源项目,功能丰富,适合学习和日常使用。GSYGithubApp系列的优势:我们目前已经拥有Flutter、Weex、ReactNative、kotlin 四个版本。 功能齐全,项目框架内技术涉及面广,完成度高,持续维护,配套文章,适合全面学习,对比参考。跨平台的开源Github客户端App,更好的体验,更丰富的功能,旨在更好的日常管理和维护个人Github,提供更好更方便的驾车体验Σ( ̄。 ̄ノ)ノ。同款Weex版本 : https://github.com/CarGuo/GSYGithubAppWeex 、同款React Native版本 : https://github.com/CarGuo/GSYGithubApp 、原生 kotlin 版本 https://github.com/CarGuo/GSYGithubAppKotlin
dio
12249
A powerful HTTP client for Dart and Flutter, which supports global settings, Interceptors, FormData, aborting and canceling a request, files uploading and downloading, requests timeout, custom adapters, etc.
gopeed
11832
A modern download manager that supports all platforms. Built with Golang and Flutter.
bloc
11441
A predictable state management library that helps implement the BLoC design pattern
getx
9899
Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
flame
8846
A Flutter based game engine.
flutter_deer
7595
🦌 Flutter 练习项目(包括集成测试、可访问性测试)。内含完整UI设计图,更贴近真实项目的练习。Flutter practice project (including integration testing and accessibility testing). Contains complete UI design drawings for a more realistic practice project.
fish-redux
7343
An assembled flutter application framework.
hiddify-next
7232
Multi-platform auto-proxy client, supporting Sing-box, X-ray, TUIC, Hysteria, Reality, Trojan, SSH etc. It’s an open-source, secure and ad-free.
ente
6686
Fully open source, End to End Encrypted alternative to Google Photos and Apple Photos
fl_chart
6451
FL Chart is a highly customizable Flutter chart library that supports Line Chart, Bar Chart, Pie Chart, Scatter Chart, and Radar Chart.
pixez-flutter
6360
一个支持免代理直连及查看动图的第三方Pixiv flutter客户端
Flutter-Responsive-Admin-Panel-or-Dashboard
6355
Responsive Admin Panel or Dashboard using Flutter
aidea
6021
AIdea 是一款支持 GPT 以及国产大语言模型通义千问、文心一言等,支持 Stable Diffusion 文生图、图生图、 SDXL1.0、超分辨率、图片上色的全能型 APP。
riverpod
5828
A reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.
pikapika
5463
美观易用且无广告的漫画和游戏客户端,同时支持MacOS,Windows,Android,iOS。