'UPI deep linking from Ionic3 is not working on Android

I am using this:

options=
{ action:this.webIntent.ACTION_VIEW, url:"upi://pay?pa=xxx@upi&pn=Name&tid=TID4587445785&tr=Product Purchase&am=100&cu=INR&tn=Purchase&mc=< my mc code >" };

this.webIntent.startActivityForResult(options)

However, it's failing with these errors:

Google Pay Error limit exceed

paytm Error payee-mcc length invalid

Bhim Error Payee.code numeric of length 4

Could not figure out a solution. Any help is appreciated.



Solution 1:[1]

@rajib ,

Give Merchant code as only of 4 digit .. Thats the one that is causing issue

Solution 2:[2]

create your uri as below :

val paymentUri = Uri.Builder().apply {
        with(payment) {
            scheme("upi").authority("pay")
            appendQueryParameter("pa", vpa)
            appendQueryParameter("pn", name)
            appendQueryParameter("tid", txnId)
            appendQueryParameter("mc", merchantId)
            appendQueryParameter("tr", txnRefId)
            appendQueryParameter("tn", description)
            appendQueryParameter("am", amount)
            appendQueryParameter("cu", currency)
            appendQueryParameter("mcc", payeeMerchantCode)
        }
    }.build()

    // Set Data Intent
    val paymentIntent = Intent(Intent.ACTION_VIEW).apply {
        data = paymentUri

    }
val appChooser = Intent.createChooser(paymentIntent, "Pay using")
if (paymentIntent.resolveActivity(packageManager) != null) {
        startActivityForResult(appChooser, PAYMENT_REQUEST)
    } else {
        Toast.makeText(
            this,
            "No UPI app found! Please Install to Proceed!",
            Toast.LENGTH_SHORT).show()
        throwOnAppNotFound()
    }

Here mc or merchantId has to be 4 digit and payeeMerchantCode you will get when your account on these psps

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ashutosh Kumar
Solution 2 ROHIT LIEN