faker.providers.credit_card
¶
- class faker.providers.credit_card.Provider(generator: Any)¶
Bases:
BaseProvider
Implement default credit card provider for Faker.
For all methods that take
card_type
as an argument, a random card type will be used if the supplied value isNone
. The list of valid card types includes'amex'
,'diners'
,'discover'
,'jcb'
,'jcb15'
,'jcb16'
,'maestro'
,'mastercard'
,'visa'
,'visa13'
,'visa16'
, and'visa19'
.Sources:
- credit_card_expire(start: date | datetime | timedelta | str | int = 'now', end: date | datetime | timedelta | str | int = '+10y', date_format: str = '%m/%y') str ¶
Generate a credit card expiry date.
This method uses
date_time_between()
under the hood to generate the expiry date, so thestart
andend
arguments work in the same way here as it would in that method. For the actual formatting of the expiry date,strftime()
is used anddate_format
is simply passed to that method.- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.credit_card_expire() ... '09/32' '10/31' '06/28' '10/26' '05/29'
- credit_card_full(card_type: CardType | None = None) str ¶
Generate a set of credit card details.
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.credit_card_full() ... 'Discover\nKatherine Fisher\n6587647593824218 06/30\nCVC: 489\n' 'VISA 16 digit\nKyle Blair\n4781565938778403 04/32\nCVC: 801\n' 'JCB 16 digit\nMary Page\n3597535139332876 02/25\nCVC: 587\n' 'Mastercard\nKevin Carter\n5485839894719651 12/29\nCVV: 423\n' 'VISA 16 digit\nAntonio Zavala\n4711220186848335 03/33\nCVC: 969\n'
- credit_card_number(card_type: CardType | None = None) str ¶
Generate a valid credit card number.
- Examples:
>>> Faker.seed(0) >>> for _ in range(5): ... fake.credit_card_number() ... '6504876475938248' '4948924115781567' '348778408016097' '30535139332877' '5358714841858395'