首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Stripe google支付Android -意外的开发者错误,请稍后再试。

Stripe google支付Android -意外的开发者错误,请稍后再试。
EN

Stack Overflow用户
提问于 2022-01-11 16:36:15
回答 1查看 878关注 0票数 -2

我面临着谷歌支付的问题。问题是,我完全遵循文档,并得到一个模糊的错误。我有这个onGooglePayResult,我的Result.Failed总是有错误-“java.lang.RuntimeException: Google支付失败了错误10”和错误代码2。我可以自由地问你所有的问题。

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

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

代码语言:javascript
复制
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}")
        }
    }
}
EN

回答 1

Stack Overflow用户

发布于 2022-01-20 15:55:43

我解决了这个问题,是我的错。我忘记从stripe开发人员门户添加可发布的键。

我使用这个函数来设置Google pay。只需替换TEST_PUBLISHABLE_KEY与您的键在条纹帐户(网站)。

代码语言:javascript
复制
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
        )
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70670265

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档