Sushil Jaiswar
Sushil Jaiswar

Reputation: 57

Credit Card number Validation algorithm

Is there any other algorithm apart from Luhn's algorithm which is used for validation of credit card number as Visa card numbers are not passing the criteria of Luhn's algorithm.

Upvotes: 2

Views: 1009

Answers (3)

Ian Gibs
Ian Gibs

Reputation: 11

Yes, sometimes the Luhn algorithm does not validate actual cards. This API implements checks against the Luhn algorithm in a more expanded way which should be able to handle all scenarios.

const options = {
  method: 'GET',
  headers: {Accept: 'application/json', 'X-Api-Key': '[APIkey]'}
};

fetch('https://api.epaytools.com/Tools/luhn?number=[CardNumber]&metaData=true', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

Upvotes: 0

Buh Buh
Buh Buh

Reputation: 7546

If you are using the Luhn Algorithm to calculate the final digit of the card (lets call this digit x); then I have heard that some banks are now issuing cards with a value of x +/- 5.

This effectively doubles the amount of valid card numbers. I have no idea as to whether this is true or not as I don't have access to that many card numbers, but maybe you could compare the numbers you have.

Upvotes: 0

usr-local-ΕΨΗΕΛΩΝ
usr-local-ΕΨΗΕΛΩΝ

Reputation: 26924

Credit cards are now online validated.

There is no more criterion to validate a credit card else than directly querying the VISA service, which also validates the card against currently available plafond.

In a few words, today it's all online.

Upvotes: 3

Related Questions