Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@calvarez-ov
Last active February 11, 2021 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calvarez-ov/7da285054808737dbf4b27f90938ace0 to your computer and use it in GitHub Desktop.
Save calvarez-ov/7da285054808737dbf4b27f90938ace0 to your computer and use it in GitHub Desktop.
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