android - 从我的 Android 应用调用 Google Pay Intent 时出现错误 "You have exceeded the maximum transaction amount set by your bank"

标签 android android-studio kotlin google-pay

我在 android 应用程序中集成 Google pay 时遇到了这个奇怪的问题。当我发送超过 2000 (INR) 的金额时,即使我没有交易任何金额,我也会收到错误消息“您已超过银行设置的最大交易金额”。当我尝试直接从 Google 支付金额时,它可以工作。它也适用于低于 2000 (INR) 的金额,但不会超过此金额。
这是代码 iiiiii

  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)
我已经阅读了很多博客、文档,但没有找到任何解决方案。有什么帮助或建议吗?

最佳答案

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();
您需要进行两项修改。
  • 仅使用 Google 支付业务应用 ID
  • 在 Intent 调用中使用“mc”和“tr”参数。

  • “mc” - 商户代码(可以为空)。
    “tr” - 交易引用 id(可以是任何随机数)。
    工作 Reference Post here

    关于android - 从我的 Android 应用调用 Google Pay Intent 时出现错误 "You have exceeded the maximum transaction amount set by your bank",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62953449/

    相关文章:

    android - ffmpeg 使用单个图像和音频文件,但输出视频不可搜索(即使提前搜索也只能从 0 :00, 恢复)

    Android MediaCodec HEVC 支持的分辨率

    android - 不支持本地 .aar 文件

    android - Gradle 项目同步失败。 Unresolved 依赖关系

    java - Kotlin val 赋值

    android - CircleCI 上的 Espresso 测试失败

    java - 根据当前背景更改按钮背景

    java - 如何处理倾向于一个apk的多个android项目

    android - Room 中的主键应该是 Int 还是 Long?

    android - 在 Android View 中检测后退按钮按下