How to integrate BHIM app payment gateway in an Android App?
Solution 1
You can try DeepLinking UPI supported application. This way you can make a payment via any UPI supported application (BHIM, Phonepe, Paytm and all bank UPI apps)
Code for deeplinking is as follow:
Uri uri = Uri.parse("upi://pay?pa=8866616231@upi&pn=Aayushi%20Shah&tn=Test%20for%20Deeplinking&am=1&cu=INR&url=https://mystar.co"); // missing 'http://' will cause crashed
Log.d(TAG, "onClick: uri: "+uri);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivityForResult(intent,1);
Almost all UPI application are successfully able to make the payment. The problem with this is, not all application are returning whether the transaction was a success or not.
I am finding a solution where i can force to open Only BHIM and not any other app, as BHIM is giving proper response back.
If you want to see the full implementation: https://github.com/ShahMalavS/UPI-DeepLinked
Solution 2
You need to implement UPI SDK in your application. Some UPI enabled banks are allowed to act PSP(Payment service Provider) like Yes Bank, RBL, ICICI Bank, Axis Bank.
You have to partner with that bank and they will provide you SDK. Once you get SDK, it is easy like plug n play.
You can also readout about upi from
https://digidhan.mygov.in/pages/pdf/sbi/NPCI%20Unified%20Payment%20Interface.pdf
Solution 3
You can try DeepLinking UPI to start BHIM from your app.
Code for deeplinking is as follow:
Uri uri = Uri.parse("upi://pay?pa=payee_address&pn=payee_name&tn=transaction_name&am=1&cu=INR&url=url");//url with http or https
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
//Now magic starts here
intent.setClassName("in.org.npci.upiapp","in.org.npci.upiapp.HomeActivity");
startActivityForResult(intent,1);
You can open any specific application using its packageName and ClassName.
Now you can collect payment using only BHIM. You can get proper response using BHIM.
Sam
Updated on June 05, 2022Comments
-
Sam about 2 years
How to integrate BHIM app payment gateway in an android app, through upi id?
I have no idea about payment gateway,I have not implemented payment gateway before.
Please help me how to integrate payment gateway in an android app?(I want to integrate payment through BHIM app) -
Sam over 6 yearsthanks lalit..but how will i become partner with any bank ..can you provide me any link
-
Lalit Jadav over 6 yearsYou need to contact with bank, either personal or through email
-
Sam over 6 yearsAfter getting UPI SDK how to implement it in my android application ..can you provide me code
-
Lalit Jadav over 6 yearsSDK will provide you guide also
-
Hemil about 5 yearsWhat do I do if I don't have any website?
-
ked over 4 yearsabove link has changed to mygov.in/digidhan/pages/pdf/sbi/…
-
Malav Shah over 3 yearsUpdate as on 29/10/2020. This particular thing has stopped working. i will try to solve this issue