0
votes

I am using Stripe as a payment gateway for our customers. There's possible to use a jQuery plugin for a real-time validation of information that customers put into the check out form (this plugin validates format of the credit card, CVC number and expiration - in terms of checking if the set up validity is not in the past).

The problem is that when a user send the checkout form with, for example, incorrect CVC number or incorrect expiration date, then I get an error on the back-end.

Stripe::CardError (Your card was declined.)

Is there any way to run this credit card verification through AJAX? For example, if the set up credit card has some information incorrectly set up, the checkout form would not be sent.

Thank you

1
Don't think it will be helpful... making ajax will be same as submitting the form. You can't validate card without submitting details. You can validate format of expiry, cvv, card number etc on your server end, before sending it to stripeRAJ

1 Answers

0
votes
  1. Card Number format check: Here (How do you detect Credit card type based on number?) you can do some verification; and also, you can do mod 10 check to card number.

  2. CVC/CVV2 veification: you cannot do this. Only issuer bank can verify this information. What you can do is validate the length of CVC code user provided. For example, Visa card's CVV2 code has 3 digits, shorter or longer are definitely invalid.

  3. Expiration Date check: again only issuer bank will know this. but at least, it should not be in the past - in most time.