问题
I'm trying to localize error messages occurring during the registration of payment sources and am looking for an easy way out: Is it possible to let stripe do the complete validation of a card directly via the stripe.js api and get a localized error message as a result before I send the token to my server (and then to stripe)? Some errors are caught by the card element, e.g. an incorrect checksum (CC No. 4242424242424241
) and returned localized by the js library, giving me hope that I have just missed the right configuration option.
Background: One of our customers triggered a "Your card has insufficient funds." error during card registration (we only issue a charge at a later time) and we weren't able to show a helpful error message because we didn't have a localization for this error and I can't find a complete list of possible error (codes).
回答1:
I answered this your other question as well, but this gem might be useful for you here: https://github.com/ekosz/stripe-i18n
You can also find the API errors here: https://stripe.com/docs/api#errors
来源:https://stackoverflow.com/questions/45441172/get-localized-payment-source-registration-errors-directly-from-stripe-elements