In stripe payment their is method call confirmPayment where we input with paymentMethodCreateParams and clientSecret. The result of the confirmPayment is triggered in onActivityResult. But onActivityResult is deprecate in android. How to get the Stripe PaymentResult?. Is their any alternative for this problem
private var stripe : Stripe? = null
fun confirmPayment() {
stripe = Stripe(context = this, publishableKey = publishableKey)
val paymentMethodCreateParams = PaymentMethodCreateParams.create(myDebitCard)
val confirmPaymentIntent=ConfirmPaymentIntentParams.createWithPaymentMethodCreateParams(
paymentMethodCreateParams = paymentMethodCreateParams,
clientSecret = clientSecret
)
stripe?.confirmPayment(this, confirmPaymentIntent) // this means activity or fragment
}
The result of the confirm payment is triggered in
// Deprecate Now
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
stripe?.onPaymentResult(
requestCode = requestCode,
data = data,
callback = object : ApiResultCallback<PaymentIntentResult> {
override fun onError(e: Exception) {
// Handle Error case
}
override fun onSuccess(result: PaymentIntentResult) {
// Handle Success case
}
}
)
}