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

Support for ActivityResultContract #2640

Closed
twobeeronebread opened this issue Jul 10, 2020 · 12 comments
Closed

Support for ActivityResultContract #2640

twobeeronebread opened this issue Jul 10, 2020 · 12 comments
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally

Comments

@twobeeronebread
Copy link

Summary

With onActivityResult being deprecated and it being suggested to use registerForActivityResult I am hoping that the sdk can add support for this. A simple example can be found here: https://developer.android.com/training/basics/intents/result#custom

Code to reproduce

This is particular important when calling handleNextActionForPayment or any of the other methods that will require to use onActivityResult

Possible solution

An easy solution could be to expose the intent somehow via the handleNextActonPayment, or have a seperate method that returns the ActivityResultContract that then can be used to start the activity instead of how it currently works.

I am happy to add some more details if required or even attempt to fix this with some guidance and what the stripe engineers would like to see as a good approach.

@mshafrir-stripe
Copy link
Collaborator

@twobeeronebread thanks for filing and for your helpful suggestions. This is definitely something on our radar and something we've begun discussing internally. We'll keep you posted here on any updates.

@csabol-stripe csabol-stripe added the triaged Issue has been reviewed by Stripe and is being tracked internally label Jul 13, 2020
@twobeeronebread
Copy link
Author

Sounds good, i was looking into the stripe source code to add support but it did seem like a few refactoring are needed to properly expose the intent.

Thanks for getting back so quick!

@mshafrir-stripe
Copy link
Collaborator

@twobeeronebread btw we'll hold off on supporting this until the API is in release.

@twobeeronebread
Copy link
Author

That makes sense. I forgot that we are using the alpha version of androidx.activity:activity

@mshafrir-stripe
Copy link
Collaborator

@twobeeronebread thanks for filing. This is on our roadmap and we'll update this ticket when we have an update. Closing for now.

@awfasano
Copy link

awfasano commented Aug 5, 2021

Do you have an updates related to this issue?

@UmairKhalid786
Copy link

Any update on this issue team?

@Flo354
Copy link

Flo354 commented Sep 28, 2021

Maybe if more persons are asking for this, it will come to an end.
So... Any update on this?

Thank you,

@michelleb-stripe
Copy link
Contributor

@Flo354 @UmairKhalid786 @awfasano @twobeeronebread

Take a look at our new PaymentLauncher described here and see if this addresses your need. This interface will take a callback and internally we will use the registerForActivityResult. Also note there is a compose interface PaymentLauncher.createForCompose

cc: @ccen-stripe

@Flo354
Copy link

Flo354 commented Sep 28, 2021

Thank you.

Why does it returns a PaymentResult and not a PaymentIntentResult
I need to get back the id of my PaymentIntent

@ccen-stripe
Copy link
Contributor

Hi @Flo354 , the PaymentLauncher API is designed to just return the state of the confirmation, if you need the PaymentIntent object, please use the retrievePaymentIntent API

@Flo354
Copy link

Flo354 commented Sep 29, 2021

Hmmm, I will stay on the deprecated method, too much changes, too much things to do in addition, just for a warning.

The register of the activity result must be done before the activity is actually started, but I get the stripe account id after, when I create the payment intent server side (because I am processing payments on behalf of standard connected accounts).
After, I have to launch, this. When I have PaymentResult success, I must do retrievePaymentIntent. It will never end.

Thank you for your response, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triaged Issue has been reviewed by Stripe and is being tracked internally
Projects
None yet
Development

No branches or pull requests

8 participants