stripe-android icon indicating copy to clipboard operation
stripe-android copied to clipboard

[Feature] Add an `ActivityResultContract` for `handleNextActionForPayment()` functions

Open romainpiel opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe.

There's currently no easy way to use handleNextActionForPayment() (or any other handleNextAction functions) in a compose screen. It would be great to have an ActivityResultContract which would start an activity and make the call to handleNextAction transparent. (similarly to GooglePayPaymentMethodLauncherContract).

Describe the solution you'd like

A HandleNextActionContract which starts a transparent activity and makes the calls to the appropriate handleNextAction function.

romainpiel avatar Jun 09 '22 14:06 romainpiel

@romainpiel Thanks for the request, our team will take a look.

jameswoo-stripe avatar Jun 09 '22 17:06 jameswoo-stripe

Hi @romainpiel 👋 I just came across this issue again. On the off-chance that this is still relevant, is PaymentLauncher a possible alternative to you?

It offers a handleNextActionForPaymentIntent(clientSecret) method and can easily be used in Compose:

fun MyComposeScreen() {
  val paymentLauncher = PaymentLauncher.rememberLauncher(publishableKey, stripeAccountId, callback)
  // …
  Button(onClick = { paymentLauncher.handleNextActionForPaymentIntent(clientSecret) }) {
    // …
  }
}

tillh-stripe avatar Mar 27 '23 17:03 tillh-stripe

Closing due to inactivity.

tillh-stripe avatar Jun 22 '23 21:06 tillh-stripe