moonrisesystems
asked on
Credit card data, what datatype / length.
Morning experts, I want to update our old database fields we are using for credit cards. Right now they are all varchar, but I wanted to find out what I should use for lengths and datatype for the following:
Card type (visa mastercard etc)
Card number
Experation date
Card type (visa mastercard etc)
Card number
Experation date
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This site is good to explain the different card types, their lengths and check digits.
http://www.beachnet.com/~hstiles/cardtype.html
You may want to be careful about storing the CVV. Its purpose, wehn used, is to prove that the person making the transaction is in physical posession of the card. Its not on the magnetic stripe and not printed on receipts. This will mean reduced loss if somehow your system is comprimised. It can also reduce chargebacks if you require this number to be entered each time. This increases customer confidence etc. But those are marketing/business issues. Just thought I'd throw them in.
http://www.beachnet.com/~hstiles/cardtype.html
You may want to be careful about storing the CVV. Its purpose, wehn used, is to prove that the person making the transaction is in physical posession of the card. Its not on the magnetic stripe and not printed on receipts. This will mean reduced loss if somehow your system is comprimised. It can also reduce chargebacks if you require this number to be entered each time. This increases customer confidence etc. But those are marketing/business issues. Just thought I'd throw them in.
If you store the year and month as a varchar, I would recommend formatting it YYMM (good for another 96 years at least) or YYYYMM so you can do easier queries if necessary. Depends on what you plan to do with the data of course (even just for validating the expiration has not been passed would be easier if it were in this format).
Card number should still be a varchar. You save very little space with a char and can accommodate any card type.
Expiration date should be a date. Use the last date of the month/year (some cards actually have a complete date). If you do not do that and go with a char or varchar you will cause yourself a lot of trouble with date math.
Those are my recommendations. I have worked with credit cards though it has not been my focus. Others may have better experience.
Aaron