# .NET and More > ASP.NET And ASP.NET Core >  validate credit card

## Sakana

Hi,

I would like to ask does anyone here know how to validate credit numbers? 

reply: asap

Thank you

----------


## Fishcake

not done much on it myself but i remember it having something to do with running a mod 10 algorithm over it and ensuring the result is 0.

Actually searching for "mod 10 credit card validation" on google turns up a fair few results.

----------


## Sakana

Did anyone here have sample validate credit card codes for me to reference? Thank You

----------


## SkiNLaB

> _Originally posted by Fishcake_ 
> *not done much on it myself but i remember it having something to do with running a mod 10 algorithm over it and ensuring the result is 0.
> 
> Actually searching for "mod 10 credit card validation" on google turns up a fair few results.*


ur avatar is most disturbing. seek professional help.

----------


## Wokawidget

Try doing a search in the General VB questions section.
The code will be the same and this question is has been asked many times.

Woof

PS I think you both need ya heads sorted  :Wink:

----------


## plenderj

Use you can use the Luhn algorithm to validate the format of a credit card number, but you'll need a merchant account with your bank or a c/c machine to actually process the number.... either that, or go through a 3rd party like www.regnow.com

----------


## Scand

A luhn check example:
http://programmers-corner.com/viewSource.php/35

To protect you from fraud you can check the credit card user's IP and it's credit card number, so you'll see where the IP is from and where the credit card was issued. 

Check this service out if you have fraud problems:
http://www.maxmind.com/app/ccv

----------


## rjpruh9

If doubling any of the numbers produces a sum greater than nine, subtract nine from the sum to get a single digit. Take the sum of all the digits, and if that sum is divisible by ten, then the card's number is valid.

How to Validate Credit Cards in 8 Simple Steps
Swipe the card. ...
Obtain transaction authorization approval. ...
Compare the account numbers. ...
Check the card's expiration date. ...
Check the Electronic Warning Bulletin or International Warning Notices. ...
Check the four-digit number in the signature panel of the card.

Thanks

----------


## Shaggy Hiker

This thread was last posted to back in 2004, but that's still an interesting variation on 'casting out nines', which doesn't see the light of day much anymore.

----------


## rjpruh9

If doubling any of the numbers produces a sum greater than nine, subtract nine from the sum to get a single digit. Take the sum of all the digits, and if that sum is divisible by ten, then the card's number is valid.

How to Validate Credit Card details checker in 8 Simple Steps
Swipe the card. ...
Obtain transaction authorization approval. ...
Compare the account numbers. ...
Check the card's expiration date. ...
Check the Electronic Warning Bulletin or International Warning Notices. ...
Check the four-digit number in the signature panel of the card.

----------

