首页 > 解决方案 > UPI 深层链接请求失败

问题描述

我编写了这段代码,用于通过安装在用户手机上的 UPI 应用程序接受付款。一切似乎都很好,直到用户尝试以奇怪的方式付款失败。

Google Pay -> “您已超过银行设置的最大交易金额”。
还有 Google Pay ->“糟糕,出了点问题”。
Phonepe ->“无法启动交易。请重试..”

我确实尝试在互联网上搜索,但找不到任何东西。

private fun payWithUPI() {
        val uri: Uri = Uri.Builder()
            .scheme("upi")
            .authority("pay")
            .appendQueryParameter("pa", "my_vpa")
            .appendQueryParameter("pn", "name")
            .appendQueryParameter("mc", "merchant_id")
            .appendQueryParameter("tr", "123456789")
            .appendQueryParameter("am", "5.00")
            .appendQueryParameter("cu", "INR")
            .build()

        val upiPayIntent = Intent(Intent.ACTION_VIEW)
        upiPayIntent.data = uri
        val chooser = Intent.createChooser(upiPayIntent, "Pay with")
        if(null != chooser.resolveActivity(getPackageManager())) {
            startActivityForResult(chooser, UPI_PAYMENT);
        } else {
            Toast.makeText(
                this,
                "No UPI app found, please install one to continue",
                Toast.LENGTH_SHORT
            ).show()
        }
    }

PS:我已在 bhim sbi 注册为商家并使用该 vpa。

标签: androidkotlinupi

解决方案


推荐阅读