Last active
February 11, 2021 18:31
-
-
Save calvarez-ov/7da285054808737dbf4b27f90938ace0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { | |
super.onActivityResult(requestCode, resultCode, data) | |
if (resultCode != Activity.RESULT_CANCELED) { | |
if (data != null) { | |
stripe.onPaymentResult(requestCode, data, callback = | |
object : ApiResultCallback<PaymentIntentResult> { | |
override fun onError(e: Exception) { | |
// show error popup | |
} | |
override fun onSuccess(result: PaymentIntentResult) { | |
when (result.outcome) { | |
StripeIntentResult.Outcome.CANCELED -> { | |
// show cancel popup | |
} | |
StripeIntentResult.Outcome.TIMEDOUT, | |
StripeIntentResult.Outcome.UNKNOWN, | |
StripeIntentResult.Outcome.FAILED -> { | |
// show error popup | |
// THEN: | |
// Send the result.intent.id, result.outcome, result.intent.status to our analytics tracking | |
// We see FAILED with Succeeded values for those two inent ids | |
} | |
StripeIntentResult.Outcome.SUCCEEDED -> { | |
// show success popup | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment