Я пытаюсь принять платеж, но получаю эту ошибку при обратном вызове 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: