This article is from the Credit cards and Consumer Credit FAQ, by firstname.lastname@example.org (Steve Adams) with numerous contributions by others.
This is a complicated question. There are two possible sources of
an answer: Federal and state law, and the policies of the
Law: There is no Federal law on the subject. According to Bankcard
Holders of America, the laws of CA, DE, GA, MD, MN, NJ, NV, and NY
prohibit recording personal information in connection with
credit-card transactions. Note the word "recording": strictly
interpreted, this means they can ask you to show a driver's license
but can't write anything down from it.
Policy: According to letters from
Director of Public Affairs and
Visa USA Inc. MasterCard International
P.O. Box 8999 888 Seventh Avenue
San Francisco, CA 94128-8999 New York, NY 10106
merchants are not allowed to refuse a sale made by Visa or
MasterCard solely because the customer refuses to provide additional
personal information. According to Bankcard Holders of America, the
same is true when you use your American Express card, but not when
you use Discover.
If merchants have "sufficient" reason to suspect you are not the
authorized card holder, they may ask for further ID. This exception
rarely comes up in real life, and even if it does they must not
write the information on the Amex, Visa, or MC charge slip.
There is a Legal Research FAQ published by Mark Eckenwiler, email id
email@example.com. It can be found in misc.legal.