Get (localized) payment source registration errors directly from Stripe Elements

假装没事ソ 提交于 2019-12-13 08:12:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!