OS X uses Keychain to store encrypted passwords under a single master password (by default, your login password).
You can use
/Applications/Utilities/Keychain Access.app to manage entries.
One kind of entry is the secure note: a piece of encrypted text.
I find it pretty handy to store my credit card details in a secure note. If I need to provide it when ordering something, I can copy-and-paste it right out of the note. You could store them in a plain text file, but then they wouldn’t be password-protected and encrypted.
A related hint is to scratch the CVV code off of your card, after learning it by heart or storing it in your keychain – that way, if your card is lost or stolen, others can in many cases no longer use it for Internet transactions.