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

Parse 'customerSheetClientSecret' for Android and iOS #1744

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tjclawson-stripe
Copy link

Summary

Add logic to parse customerSessionClientSecret

Motivation

Support Customer Session for React Native
MOBILESDK-2432
MOBILESDK-2431

Testing

  • I tested this manually
  • I added automated tests

Documentation

Select one:

  • I have added relevant documentation for my changes.
  • This PR does not result in any developer-facing changes.

@tjclawson-stripe tjclawson-stripe marked this pull request as draft October 2, 2024 21:54
@tjclawson-stripe tjclawson-stripe marked this pull request as ready for review October 3, 2024 18:12
Copy link
Collaborator

@charliecruzan-stripe charliecruzan-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good, one nit about error handling and also could you add the type declaration for the new field to https://github.com/stripe/stripe-react-native/blob/master/src/types/PaymentSheet.ts#L13-L70 ?

Comment on lines 196 to 200
if (customerId.isNotEmpty() && customerSessionClientSecret.isNotEmpty()) PaymentSheet.CustomerConfiguration.createWithCustomerSession(
id = customerId,
clientSecret = customerSessionClientSecret
)
else if (customerId.isNotEmpty() && customerEphemeralKeySecret.isNotEmpty()) PaymentSheet.CustomerConfiguration(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to add error handling if they provide both customerSessionClientSecret and customerEphemeralKeySecret?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated 👍

@tjclawson-stripe
Copy link
Author

looking good, one nit about error handling and also could you add the type declaration for the new field to https://github.com/stripe/stripe-react-native/blob/master/src/types/PaymentSheet.ts#L13-L70 ?

Added the types to PaymentSheet.ts, but it doesn't seem to actually throw an error if both values are set. It's throwing an exception if both are set so it's fine, but is there a way for typescript to actually throw an error?

@charliecruzan-stripe
Copy link
Collaborator

Added the types to PaymentSheet.ts, but it doesn't seem to actually throw an error if both values are set. It's throwing an exception if both are set so it's fine, but is there a way for typescript to actually throw an error?

No TS won't throw an error (depending on your typescript config, compilation may fail) it'll just complain in the IDE, but that's good enough since we're also throwing an error in the native layer anyways

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants