Skip to content

Parse 'customerSheetClientSecret' for Android and iOS #1744

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

Merged
merged 8 commits into from
Oct 10, 2024

Conversation

tjclawson-stripe
Copy link
Collaborator

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 force-pushed the tyler/customer-session-parse branch from 5f2131a to 361df5b Compare October 2, 2024 22:03
@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
Collaborator 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
Collaborator 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

tjclawson-stripe and others added 2 commits October 9, 2024 15:06
Co-authored-by: charliecruzan-stripe <[email protected]>
@tjclawson-stripe tjclawson-stripe merged commit baa353c into master Oct 10, 2024
4 of 6 checks passed
@tjclawson-stripe tjclawson-stripe deleted the tyler/customer-session-parse branch October 10, 2024 18:28
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