自定义条带结帐的错误处理 [英] Error handling for custom stripe checkout

查看:34
本文介绍了自定义条带结帐的错误处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理自定义条带集成(网关).如果我使用信用卡/借记卡付款,我会从这个 url 获得带有令牌 ID 的成功 json 响应 https://api.stripe.com/v1/tokens.但是对于无效的 cvc,我没有收到任何错误响应.我从这个 url https://api 检查网络.stripe.com/v1/tokens 我收到错误响应.但在程序中我不知道从哪里得到这个响应.请帮助我,我被困在这里.

I am working on custom stripe integration(gateway).If i do payment using credit/debit card i am getting successfull json response with token id from this url https://api.stripe.com/v1/tokens. but for invalid cvc i am not getting any error response.i checked in network from this url https://api.stripe.com/v1/tokens i am getting error response. but in program i dont know where to get this response. pls help me i am stuck here.

这是我的代码

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();
});

推荐答案

Checkout 验证卡信息与开证行.如果信息无效,则会在弹出表单中直接向客户显示错误并且不创建令牌,即使用自定义集成,不会调用 token 回调函数.

Checkout validates the card information with the issuing bank. If the information is invalid, then the error is displayed directly to the customer in the popup form and no token is created, i.e. with a custom integration, the token callback function is not called.

这篇关于自定义条带结帐的错误处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆