【发布时间】:2017-10-09 06:26:52
【问题描述】:
我正在处理自定义条带集成(网关)。如果我使用信用卡/借记卡付款,我会从这个 url https://api.stripe.com/v1/tokens 获得带有令牌 ID 的成功 json 响应。但是对于无效的 cvc,我没有收到任何错误响应。我从这个 url https://api.stripe.com/v1/tokens 签入网络我收到错误响应。但在程序中我不知道从哪里得到这个响应。请帮助我,我被困在这里。
这是我的代码
var handler = StripeCheckout.configure({
key: 'pk_test_mXJ6f6GEBqPLjz3GfgDjZ8ig',
image: 'https://stripe.com/img/documentation/checkout/marketplace.png',
locale: 'auto',
token: function(token) {
// You can access the token ID with `token.id`.
// Get the token ID to your server-side code for use.
}
});
document.getElementById('customButton').addEventListener('click', function(e) {
// Open Checkout with further options:
handler.open({
name: 'Demo Site',
description: '2 widgets',
amount: 2000
});
e.preventDefault();
});
// Close Checkout on page navigation:
window.addEventListener('popstate', function() {
handler.close();
});
【问题讨论】:
-
我认为 Stripe 会自行处理错误。它没有告诉您有关 CVC 错误,因为没有必要:错误会显示给用户,当用户输入正确的 CVC 代码时,您将收到令牌。
标签: javascript stripe-payments