-
Notifications
You must be signed in to change notification settings - Fork 695
Integration for react-native sdk #11764
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
Integration for react-native sdk #11764
Conversation
cbbf7df to
74b375c
Compare
74b375c to
34f5f7f
Compare
CHANGELOG.md
Outdated
|
|
||
| ## XX.XX.XX - 20XX-XX-XX | ||
| * [Added] Added support for `onBehalfOf` to CustomerSheet.IntentConfiguration. This parameter makes CustomerSheet use a connected account to determine the payment method that users see and whether CardBrandChoice is enabled. For more information, see the [SetupIntent docs](https://docs.stripe.com/api/setup_intents/object#setup_intent_object-on_behalf_of). | ||
| * [Added] Internal APIs for react-native sdk integration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is all internal, we shouldn't list it in the changelog.
| implementation libs.kotlin.coroutines | ||
| implementation libs.kotlin.coroutinesAndroid | ||
| implementation libs.kotlin.serialization | ||
| implementation libs.androidx.activity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you run ruby scripts/update_transitive_dependencies.rb to make align our dependencies baseline with this change.
| message = "This API should only be used internally by the react-native sdk." | ||
| ) | ||
| @Retention(AnnotationRetention.BINARY) | ||
| annotation class ReactNativeSdkInternal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should mark all the new public APIs with @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
You can check this locally via ./gradlew apiCheck.
|
@janicduplessis looks like the only remaining failures are lint errors. Could you run Otherwise LGTM. |
|
@jaynewstrom-stripe Should be all good now! There are some workflow that still need approval to run, could you look into it? |
|
Looks like everything is good to me, I'll click merge! |
Summary
This implements a new internal builder for payment sheet to be used by the react-native sdk. This will allow removing many hacks and complexity from the react-native sdk related to activity lifecycle.
To do that we need to create
activityResultLauncherwithout relying on the activityregisterForActivityResult, since it requires it to be in CREATED state. To do that we can useactivity.activityResultRegistry.register, which is the same API compose uses internally. This requires use to manage the lifecycle of the result launcher manually.Option A
This is what is currently implemented in this PR as a proof of concept. Here we create the
activityResultLauncherinDefaultPaymentSheetLauncherand we use a new parametersignalto allow the react-native sdk to notify that theactivityResultLaunchermust be unregistered.Option B
Here we would pass
activityResultLauncheralongside the activity in the builder build method. This is an alternative option that moves a little bit more of the complexity to the react-native sdk, however it will require exposing the contract classes, since they are currently internal, and required to create theactivityResultLauncher.In both cases the apis are gated by a new opt in annotation
ReactNativeSdkInternal.Motivation
Simplify the integration in the react-native sdk.
Testing
Tested in the react-native sdk example.
Screenshots
N/A
Changelog
[Added] Internal APIs for react-native sdk integration.