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

CardField handle validation errors #423

Closed
ghost opened this issue Jul 15, 2021 · 0 comments · Fixed by #629
Closed

CardField handle validation errors #423

ghost opened this issue Jul 15, 2021 · 0 comments · Fixed by #629
Labels
enhancement New feature or request P2 Address these issues last

Comments

@ghost
Copy link

ghost commented Jul 15, 2021

Is your feature request related to a problem? Please describe.
I'm using CardField and createToken method in my application. Everything is working perfectly fine.
But I want to do customizations with CardField, and I'm unable to do that.

CardField is handling all the validations which are really great, but I also want to display errors to users, that which specific fields have issues.
I was able to handle the error message for ExpiryDate, as shown in the below screenshots.

Screenshot 2021-07-15 at 2 40 03 PM

Screenshot 2021-07-15 at 2 40 10 PM

How I handled this
CardField has a method on onCardChange, in which I have access to expiryMonth and expiryYear. I can validate it, and show errors to the user. But I can't do it for the card number. Because when the card number is empty or is not valid, onCardChange gives null for last4 digits of the card. Same for CVC.

Describe the solution you'd like
CardField has a method on onCardChange, which gives cardDetails. Addition of some bool attributes like validCard, validExpiryDate, and validCVC, so I can show & hide errors at my end. Just like we have complete in cardDetails, which is false when any of the fields are invalid, and true when all the fields are valid.

Describe alternatives you've considered
N/A

Additional context
N/A

@ghost ghost changed the title CardField handle errors CardField handle validation errors Jul 15, 2021
@thorsten-stripe thorsten-stripe added enhancement New feature or request P2 Address these issues last labels Jul 16, 2021
atiernan added a commit to atiernan/stripe-react-native that referenced this issue Oct 7, 2021
atiernan added a commit to atiernan/stripe-react-native that referenced this issue Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P2 Address these issues last
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant