android - Google Pay UPI 集成在 android 中不起作用

标签 android android-intent transactions google-pay upi

GPay 集成在 2 天前完全正常,但现在它在 gpay 应用程序中显示相同的错误。要求 gpay 付款的 Intent 不起作用。
我在几天前成功完成了交易。但现在它不起作用。任何帮助,将不胜感激!提前致谢。
我的代码

 uriapp = new Uri.Builder()
            .scheme("upi")
            .authority("pay")
            .appendQueryParameter("pa", getString(R.string.vpa))
            .appendQueryParameter("pn", getString(R.string.payee))
            .appendQueryParameter("tr", orderId)
            .appendQueryParameter("tn", description)
            .appendQueryParameter("am", String.valueOf(amount))
            .appendQueryParameter("cu", "INR")
            .build();

 Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setData(uriapp);
        intent.setPackage(model.getPackageName());
        if (intent.resolveActivity(getPackageManager()) != null) {
            startActivityForResult(intent, GOOGLE_REQUEST_CODE);
        } else {
            Toast.makeText(this, "This payment mode is not available on your device.", Toast.LENGTH_LONG).show();
        }
我正在使用正确的 vpa 业务 ID。
GPay 错误:
this transaction may be risky. for your safety it cant be completed at this time

最佳答案

目前这个 fragment 正在测试应用程序中工作。让我知道它是否不适用于您的。

    private static final int TEZ_REQUEST_CODE = 123;

    private static final String GOOGLE_TEZ_PACKAGE_NAME = 
    "com.google.android.apps.nbu.paisa.user";

Uri uri =
    new Uri.Builder()
        .scheme("upi")
        .authority("pay")
        .appendQueryParameter("pa", "test@okbizaxis")
        .appendQueryParameter("pn", "Test")
        .appendQueryParameter("mc", "1234")
        .appendQueryParameter("tr", "1234")
        .appendQueryParameter("tn", "test")
        .appendQueryParameter("am", "10")
        .appendQueryParameter("cu", "INR")
        .appendQueryParameter("url", "")
        .build();
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(uri);
intent.setPackage(GOOGLE_TEZ_PACKAGE_NAME);
startActivityForResult(intent, TEZ_REQUEST_CODE);

关于android - Google Pay UPI 集成在 android 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66239372/

相关文章:

Android - 从广播接收器 onReceive() 获取上下文以发送到

android - 如何设计 Ice Cream Sandwich 标签之间的分隔线?

Android 图库 "share via"和 Intent.EXTRA_STREAM

java - 即使我在 manifest.xml 中正确引入了它,我也收到了类似 No Activity found to handle Intent 的错误

mysql - MySQL 中的竞争条件 - 防止多次插入

mysql - spring transaction 是否仅在进入服务方法中起作用?

java - android.os.Bundle 中 getInt(string key) 返回的整数是多少?

android - 如何使用数据库数据分发 Android 应用程序?

java - ArrayList<SensorEvent>.add(...) 开始覆盖值

Spring,休眠与谷歌应用引擎