Getting error "You have exceeded the maximum transaction amount set by your bank" when calling Google Pay intent from my android app

AkashK picture AkashK · Jul 17, 2020 · Viewed 12.9k times · Source

I am facing this weird problem with my Google pay integration in android app. When I am sending an amount more than 2000(INR) I am getting the error "You have exceeded the maximum transaction amount set by your bank" even though I have not transacted any amount. And when I try to send amount directly from Google pay it works. It is also working for the amounts below 2000(INR) but not for more than that.

Here is code

  val uri: Uri = Uri.Builder()
        .scheme("upi")
        .authority("pay")
        .appendQueryParameter("pa", MY_UPI_ID)
        .appendQueryParameter("pn", MY_USER_NAME)
        //.appendQueryParameter("mc", "1234")
        //.appendQueryParameter("tr", "123456789")
        .appendQueryParameter("tn", "test transaction note")
        .appendQueryParameter("am", "2500.00")
        .appendQueryParameter("cu", "INR")
        //.appendQueryParameter("url", "https://test.merchant.website")
        .build()
    
    
    val intent = Intent(Intent.ACTION_VIEW)
    intent.data = uri
    intent.setPackage(GOOGLE_PAY_PACKAGE_NAME)
    startActivityForResult(intent, PAY_REQUEST_CODE)

I have read a lot of blogs, docs but didn't found any solution. Any help or suggestions?

Answer

Kamal Bunkar picture Kamal Bunkar · Nov 7, 2020
Uri uri = Uri.parse("upi://pay").buildUpon()
     .appendQueryParameter("pa", upiId)  // google pay business id
     .appendQueryParameter("pn", name)
     .appendQueryParameter("mc", "")            /// 1st param - use it (it was commented on my earlier tutorial)
     //.appendQueryParameter("tid", "02125412")
     .appendQueryParameter("tr", "25584584")   /// 2nd param - use it (it was commented on my earlier tutorial)
     .appendQueryParameter("tn", note)
     .appendQueryParameter("am", amount)
     .appendQueryParameter("cu", "INR")
     //.appendQueryParameter("refUrl", "blueapp")
     .build();

there are two modification you need to do.

  1. use Google pay business App ID only
  2. use "mc" and "tr" param in intent call.

"mc" - merchant code(it can be blank). "tr" - transaction refer id(it can be any random number). Working Reference Post here