我面临着谷歌支付的问题。问题是,我完全遵循文档,并得到一个模糊的错误。我有这个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
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}")
}
}
}发布于 2022-01-20 15:55:43
我解决了这个问题,是我的错。我忘记从stripe开发人员门户添加可发布的键。
我使用这个函数来设置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
)
}https://stackoverflow.com/questions/70670265
复制相似问题