How to integrate BHIM app payment gateway in an Android App?

Sam picture Sam · Nov 10, 2017 · Viewed 15.8k times · Source

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)

Answer

Malav Shah picture Malav Shah · Dec 30, 2017

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