#hillct - Elements
1 messages · Page 1 of 1 (latest)
Hello! Stripe Elements does basic validation checks on card numbers (like length and Luhn checks). It sounds like, in the scenario you describe, the card issuer is saying the card number is invalid not because the number itself isn't a valid card number, but because that card number is no longer working (maybe it was canceled, for example).
Yes, in this contrived test, I used one of the published test mode card numbers, in live mode
Oh, my colleague just informed me that random numbers in the appropriate quantity yield the same behavior
ie, no surfaced error, cut card issuer returns error. Is there a 'proper' and forward-compatible way for us to push he error response to the isInvalid emement of the cartElement? or should we just set the isInvalid classes ourselves in the proper places? or should we use an entirely error display to surface this response to the user?
hat should read, ie: no user-surfaced error, just he card issueer reurn error object from SetupIntent
You can set styles/classes to indicate the value is invalid. You can also clear the values and ask them to enter a different card number: https://stripe.com/docs/js/element/other_methods/clear
In cases where the card issuer says the card is invalid clearing the value and explicitly asking them to use a different card might be the best option.