Android Gpay Payment Failed Kotlin

61 Views Asked by At

Activity :

            payUsingUpi(amount, "9841480080@okbizaxis", "9841480080@okbizaxis", note)

payUsingUpi :

    fun payUsingUpi(amount: String, upiId: String, name: String, note: String) {

    val uri = Uri.parse("upi://pay").buildUpon()
        .appendQueryParameter("pa", upiId)
        .appendQueryParameter("pn", name)
        .appendQueryParameter("mc", "BCR2DN4TZLJJZ42Z")
        .appendQueryParameter("tr", "asgdfuyas3153")
        .appendQueryParameter("tn", note)
        .appendQueryParameter("am", amount)
        .appendQueryParameter("cu", "INR")
        .build()

    val upiPayIntent = Intent(Intent.ACTION_VIEW)
    upiPayIntent.data = uri

    // will always show a dialog to user to choose an app
    val chooser = Intent.createChooser(upiPayIntent, "Pay with")

    // check if intent resolves
    if (null != chooser.resolveActivity(packageManager)) {
        startActivityForResult(chooser, UPI_PAYMENT)
    } else {
        Toast.makeText(this@UpiActivity, "No UPI app found, please install one to continue", Toast.LENGTH_SHORT).show()
    }

}

when i click on pay button after upi pin , i got error in gpay

Payment Failed : This transaction may be risky. For your safety, it can't be completed at this time

0

There are 0 best solutions below