faker.providers.credit_card
¶
-
class
faker.providers.credit_card.
Provider
(generator)¶ Bases:
faker.providers.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:
- https://en.wikipedia.org/wiki/Payment_card_number#Issuer_identification_number_.28IIN.29
- https://www.regular-expressions.info/creditcard.html
- https://creditcardjs.com/credit-card-type-detection
-
credit_card_expire
(start='now', end='+10y', date_format='%m/%y')¶ 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() ... '06/27' '02/28' '08/21' '05/25' '08/29'
-
credit_card_full
(card_type=None)¶ Generate a set of credit card details.
Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.credit_card_full() ... 'VISA 16 digit\nKatherine Fisher\n4876475938242192 03/25\nCVC: 892\n' 'VISA 13 digit\nJessica Nolan\n4781565938777 10/29\nCVC: 408\n' 'VISA 16 digit\nChristopher Larsen\n4097535139332879 06/22\nCVC: 158\n' 'JCB 16 digit\nTracy Turner\n3518583989471960 05/26\nCVC: 934\n' 'VISA 16 digit\nLori Johnson\n4471122018684831 08/24\nCVC: 969\n'
-
credit_card_number
(card_type=None)¶ Generate a valid credit card number.
Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.credit_card_number() ... '4604876475938242' '5248924115781561' '4387784080167' '180009753513939' '4871158714841859'
-
credit_card_provider
(card_type=None)¶ Generate a credit card provider name.
Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.credit_card_provider() ... 'VISA 16 digit' 'JCB 16 digit' 'American Express' 'VISA 13 digit' 'Discover'
-
credit_card_security_code
(card_type=None)¶ Generate a credit card security code.
Examples: >>> Faker.seed(0) >>> for _ in range(5): ... fake.credit_card_security_code() ... '604' '764' '593' '421' '489'