4
votes

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();
});
1
I think that Stripe handles the error by itself. It doesn't say you about CVC error because there's no need: error is presented to user instead and you'll receive the token when user enter proper CVC code.Eugene Morozov

1 Answers

4
votes

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.