gpt4 book ai didi

android - InvalidRequestException 无效的客户端密码 - Stripe payment sdk

转载 作者:行者123 更新时间:2023-12-04 23:58:00 25 4
gpt4 key购买 nike

我正在尝试接受付款,但在 sdk 的回调中收到此错误。

代码:

val params = cardInputWidget.paymentMethodCreateParams
if (params != null) {
val confirmParams =
ConfirmPaymentIntentParams.createWithPaymentMethodCreateParams(params, clientSecret)
stripe = Stripe(
applicationContext,
PaymentConfiguration.getInstance(applicationContext).publishableKey)

stripe.confirmPayment(this, confirmParams)
}


override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)

stripe.onPaymentResult(requestCode, data, object : ApiResultCallback<PaymentIntentResult> {
override fun onSuccess(result: PaymentIntentResult) {
val paymentIntent = result.intent
val status = paymentIntent.status
if (status == StripeIntent.Status.Succeeded) {
val gson = GsonBuilder().setPrettyPrinting().create()
showToast("Payment succeeded " + gson.toJson(paymentIntent))
} else {
showToast("Payment Error: "+paymentIntent.lastPaymentError?.message ?: "")
}
}

override fun onError(e: Exception) {
showToast("Payment failed "+e.message)
}
})
}

onError 总是被调用!

这是sdk的内部代码: quest

最佳答案

您正在使用 confirmPayment 方法而不是 confirmSetupIntent 方法。一个用于用客户密码确认支付 Intent ,另一个用于用客户密码确认设置 Intent 。查看 stripe 文档以保存和重用付款方式:https://stripe.com/docs/payments/save-and-reuse

关于android - InvalidRequestException 无效的客户端密码 - Stripe payment sdk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62099871/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com