-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add Credit Card: Improve Stripe error handling #35315
Conversation
If there is a stripe error, often the error code or message will not be useful to the user. A secondary issue is that if the setup intent is created, used, and an error happens, the setup intent must be re-created to submit the form again. This change handles stripe errors with special logic, displaying a generic message and causing the setup intent to be recreated.
This exports a new function as part of `useStripeConfiguration`, and includes it as a prop added by `withStripe`. If called, it will force the stripe configuration to be reloaded. The main purpose of this is to re-create a setup intent that has already been used.
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~1027 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~476 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
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.
Tested as described. 👍 Great improvement!
If there is a stripe error, often the error code or message will not be useful to the user. A secondary issue is that if the setup intent is created, used, and an error happens, the setup intent must be re-created to submit the form again (or the user will receive a cryptic error about the setup intent already being used).
This change handles stripe errors with special logic, displaying a generic message and causing the setup intent to be recreated.
Testing instructions
invalid_expiry_year_past
.