简体   繁体   中英

Error handling for custom stripe checkout

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.

here is my code

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 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, ie with a custom integration, the token callback function is not called.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM