Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] onPaymentResult is not called after stripe.confirm() is called #4960

Closed
rchouhan-dackinc opened this issue May 5, 2022 · 5 comments
Closed
Labels

Comments

@rchouhan-dackinc
Copy link

rchouhan-dackinc commented May 5, 2022

Summary

onActivityResult is being called but sometimes onPaymentResult is called with resultCode = -1 but callback is not triggered

Code to reproduce

private fun confirmPayment(
       clientSecret: String,
        paymentMethodId: String
        ) {

        stripe?.confirmPayment(
            this,
            ConfirmPaymentIntentParams.createWithPaymentMethodId(
                paymentMethodId,
                clientSecret
            )
          )
        }
  stripe?.onPaymentResult(
                requestCode,
                data,
                object : ApiResultCallback<PaymentIntentResult> {
                    override fun onError(e: Exception) {
                       e.printStackTrace()
                        Log.e("DashboardActivity",e.localizedMessage)
                    }

                    override fun onSuccess(result: PaymentIntentResult) {
                        val paymentIntent = result.intent
                        when (paymentIntent.status) {
                            StripeIntent.Status.Succeeded -> {
                                Log.e("DashboardActivity", "Payment Success")
                            }
                            StripeIntent.Status.RequiresPaymentMethod -> {
                                Log.e(
                                    "DashboardActivity",
                                    "Payment Failed " + paymentIntent.lastPaymentError?.message
                                )
                            }
                            else -> {
                                Log.e(
                                    "DashboardActivity",
                                    "Payment status unknown " + paymentIntent.status
                                )

                            }
                        }
                    }


                }
            )
            

Android version

Android 11

Installation method

Gradle Dependecy

Dependency Versions

 implementation 'com.stripe:stripe-android:20.2.1'

kotlin:
stripe-android: 20.2.1
Android Gradle Plugin: 7.1.3
Gradle:

SDK classes

Video

Other information

@michelleb-stripe
Copy link
Contributor

@rchouhan-dackinc I recommend using either the PaymentSheet (also know as Payment Element) integration or the PaymentLauncher.

@rchouhan-dackinc
Copy link
Author

rchouhan-dackinc commented May 6, 2022

I tried with payment launcher as well. I just wants to confirm payment on client end. So, i think PaymentSheet is suitable as per use-case.

@michelleb-stripe
Copy link
Contributor

@rchouhan-dackinc We found an issue with one of our dependencies and have made a PR to fix it. This might impact that callback from being called. Please try 20.0.0.

@michelleb-stripe
Copy link
Contributor

@rchouhan-dackinc We have also made an update and a fix in version 20.2.2

@brnunes-stripe
Copy link
Contributor

Hi @rchouhan-dackinc I'll assume this is fixed, please reopen if you're still seeing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants