【问题标题】:Stripe google pay Android - Unexpected developer error, please try again laterStripe google pay Android - 开发人员意外错误,请稍后再试
【发布时间】:2022-01-11 16:36:15
【问题描述】:

我遇到了 google pay with stripe 的问题。问题是我完全 遵循文档并得到一个模糊的错误。我有这个 onGooglePayResult 并且我总是有 Result.Failed 并出现错误 - “java.lang.RuntimeException: Google Pay failed with error 10”和错误代码 2.随时问我可以回答你的所有问题。

主要错误是 java.lang.RuntimeException:Google Pay 失败,错误 10:。这是在 GooglePayPaymentMethodLauncher.Result.Failed 中出现的。我真的不明白为什么会这样,我已经检查了两次条纹文档,谷歌支付设置和所有内容,但找不到。 我的意思是如何找出真正的错误消息是什么,我试图找到与此相关的任何内容,但不幸的是根本没有类似的内容。

Logcat - error = java.lang.RuntimeException: Google Pay 失败,错误 10:+ 错误代码 = 2

private fun onGooglePayResult(
    result: GooglePayPaymentMethodLauncher.Result
) {
    when (result) {
        is GooglePayPaymentMethodLauncher.Result.Completed -> {
            // Payment details successfully captured.
            // Send the paymentMethodId to your server to finalize payment.
            val paymentMethodId = result.paymentMethod.id
            presenter.payPlanWithGooglePay(deviceIdentifier, paymentMethodId)
        }
        GooglePayPaymentMethodLauncher.Result.Canceled -> {
            // User cancelled the operation
            Timber.d("Cancel")
        }
        is GooglePayPaymentMethodLauncher.Result.Failed -> {
            // Operation failed; inspect `result.error` for the exception
            Timber.d("error = ${result.error} + error code = ${result.errorCode}")
        }
    }
}

【问题讨论】:

标签: java kotlin stripe-payments google-pay


【解决方案1】:

我已经解决了这个问题,是我的错。我忘记从条带开发者门户添加 PUBLISHABLE 键。

我使用此功能设置 Google Pay。只需将 TEST_PUBLISHABLE_KEY 替换为您在条带帐户(网站)中的密钥即可。

private fun setUpGooglePay(): GooglePayPaymentMethodLauncher {
        PaymentConfiguration.init(this, TEST_PUBLISHABLE_KEY)
        return GooglePayPaymentMethodLauncher(
            activity = this,
            config = GooglePayPaymentMethodLauncher.Config(
                environment = GooglePayEnvironment.Test,
                merchantCountryCode = Constants.GooglePay.Manx.COUNTRY_CODE,
                merchantName = UIUtils.getString(R.string.app_name)
            ),
            readyCallback = ::onGooglePayReady,
            resultCallback = ::onGooglePayResult
        )
    }

【讨论】:

  • 如果这是您解决问题的方法,请将其标记为已接受的答案以帮助其他人了解它
猜你喜欢
  • 2022-06-22
  • 1970-01-01
  • 2016-02-11
  • 1970-01-01
  • 2019-11-30
  • 1970-01-01
  • 2017-05-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多