Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery validation method for CVV number

Tags:

jquery

I am using authorize.net {aim} for my payment gateway.

But my client needs to validate the cvv [Card Verification Value] using jquery. How can this be done?

Thanks in advance...

like image 421
Kavya B R Avatar asked May 22 '13 11:05

Kavya B R


People also ask

What is remote JQuery validation?

According to the jQuery validate documentation for remote: The response is evaluated as JSON and must be true for valid elements, and can be any false, undefined or null for invalid elements, using the default message; or a string, eg. "That name is already taken, try peter123 instead" to display as the error message.

What is JQuery form validation?

Validation in JQuery: Using JQuery, a form is validated on the client-side before it is submitted to the server, hence saves the time and reduce the load on the server. Form Validation means to validate or check whether all the values are filled correctly or not.

Can a CVV be 000?

The 000 code could be an acceptable CVV number, and it could be a Credit Card or Debit Card that is branded with the CVV number in form 000. There is no reason why three zeros shouldn't accompany CVV codes.

How is Cvv verified?

The VISA CVV service verify callable service calculates the CVV by the same method, compares it to the CVV supplied by the application (which reads the credit card's magnetic stripe) in the CVV_value, and issues a return code that indicates whether the card is authentic.


1 Answers

Try this function,

     function validate_cvv(cvv){

         var myRe = /^[0-9]{3,4}$/;
         var myArray = myRe.exec(cvv);
         if(cvv!=myArray)
          {
            alert("Invalid cvv number"); //invalid cvv number
            return false;
         }else{
             return true;  //valid cvv number
            }

         }
like image 78
Shijin TR Avatar answered Sep 21 '22 15:09

Shijin TR