Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Credit card data, what datatype / length.

Posted on 2004-09-14
4
508 Views
Last Modified: 2013-11-18
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


0
Comment
Question by:moonrisesystems
  • 2
4 Comments
 
LVL 10

Expert Comment

by:AaronAbend
ID: 12055280
for a card type I would use a char(1) and select letters that can be used to quickly identify the card (M for mastercard for example). easier than an int and virtually no difference in performance. Make sure it is NOT NULL. Use some other character for "unknown" if you must

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
0
 
LVL 8

Accepted Solution

by:
MartinCMS earned 125 total points
ID: 12055417
I have worked with database with credit cards info for more then 5 yrs.... thru many data type conversion before we have a stable set of data.  Here are my recommendations:

Card Type:   Varchar(20)     spell out the word Visa not just the V,M,A,etc.,
Card Number:   Varchar(20)
Card Expire:  Varchar(5)  mm/yy

you might want to consider the CVC or Card Code to.  This is the verification code from the back of the card.  Most Merchants required this number now.

CVC:  Varchar(5)

Good Luck!




0
 
LVL 7

Expert Comment

by:ChrisFretwell
ID: 12056786
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.
0
 
LVL 10

Expert Comment

by:AaronAbend
ID: 12057429
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).
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Are you using email marketing software? If not, you're missing out on effortless marketing and the reaching of desired conversion rates through email marketing software.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question