成功地将 Stripe 集成到我的在线商店后,我完全无法获得有关是否/如何配置 Stripe 以德语而不是英语返回错误消息的信息。
所以我的问题是:
使用客户端 API 时有没有办法获得本地化的错误消息”https://js.stripe.com/v2
"?
更新2014-05-03
我在 Twitter 和他们的一位员工上问了同样的问题(我猜)告诉我这是目前not可能的 https://twitter.com/jayeb333/status/462355456023752704并在他们的待办事项清单上。
供进一步参考:
虽然您无法在条带错误上使用人工消息直接显示在本地化页面上,但您可以利用response.error.code
提供您自己的翻译。
var errorMessages = {
incorrect_number: "The card number is incorrect.",
invalid_number: "The card number is not a valid credit card number.",
invalid_expiry_month: "The card's expiration month is invalid.",
invalid_expiry_year: "The card's expiration year is invalid.",
invalid_cvc: "The card's security code is invalid.",
expired_card: "The card has expired.",
incorrect_cvc: "The card's security code is incorrect.",
incorrect_zip: "The card's zip code failed validation.",
card_declined: "The card was declined.",
missing: "There is no card on a customer that is being charged.",
processing_error: "An error occurred while processing the card.",
rate_limit: "An error occurred due to requests hitting the API too quickly. Please let us know if you're consistently running into this error."
};
function stripeHandler( status, response ){
if ( response.error && response.error.type == 'card_error' ){
$( '.errors' ).text( errorMessages[ response.error.code ] );
}
else {
// do other stuff (and handle api/request errors)
}
}
代码列表记录在这里 https://stripe.com/docs/error-codes(当前,右栏,“代码”部分)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)