#
Finance
#
cc
// usage
{{cc()}}
{{cc({type: 'Mastercard'})}}
Generate a random credit card number. This card number will pass the Luhn algorithm so it looks like a legit card.
{{cc()}};
=> '6304038511073827'
Optionally specify a particular type of card to return:
{{cc({type: 'Mastercard'})}};
=> '5171206237468496'
The type can be specified by the long name, or by the short name:
{{cc({type: 'mc'})}};
=> '5103820202214116'
The
#
cc_type
// usage
{{cc_type()}}
{{cc_type({raw: true})}}
Return a random credit card type.
{{cc_type()}};
=> 'Visa'
Default returns just the name. To return the entire object (consisting of name, short name, numeric prefix, and length), specify so with the raw flag.
{{cc_type({raw: true})}};
=> {name: 'Discover Card', short_name: 'discover', prefix: '6011', length: 16}
The available types are (name - short_name):
- American Express - amex
- Bankcard - bankcard
- China UnionPay - chinaunion
- Diners Club Carte Blanche - dccarte
- Diners Club enRoute - dcenroute
- Diners Club International - dcintl
- Diners Club United States & Canada - dcusc
- Discover Card - discover
- InstaPayment - instapay
- JCB - jcb
- Laser - laser
- Maestro - maestro
- Mastercard - mc
- Solo - solo
- Switch - switch
- Visa - visa
- Visa Electron - electron
#
currency
// usage
{{currency()}}
Generate a random currency.
{{currency()}};
=> { code: "TVD", name: "Tuvalu Dollar" }
#
currency_pair
// usage
{{currency_pair()}}
Generate a currency pair. Handy for simulating currency conversions. Guaranteed to return a unique pair (and not the same currency twice).
{{currency_pair()}};
=> [{ code: "ALL", name: "Albania Lek" }, { code: "ZWD", name: "Zimbabwe Dollar" }]
#
dollar
// usage
{{dollar()}}
{{dollar({max: 250})}}
Return a random dollar amount.
{{dollar()}};
=> "$2560.27"
{{dollar()}};
=> "$750.99"
By default returns dollar amount no larger than 10000. Optionally specify the max to make it larger (or smaller).
{{dollar({max: 20})}};
=> "$15.23"
{{dollar({max: 10000000})}}
=> "$5051205.49"
#
euro
// usage
{{euro()}}
{{euro({max: 250})}}
Return a random euro amount. Formatting depends on the current locale (samples are displayed with european formatting)
{{euro()}};
=> "2.560,27€"
{{euro()}};
=> "750.99€"
By default returns euro amount no larger than 10000. Optionally specify the max to make it larger (or smaller).
{{euro({max: 20})}};
=> "15,23€"
{{euro({max: 10000000})}}
=> "5.051.205,49€"
#
exp
// usage
{{exp()}}
{{exp({raw: true})}}
Generate a random credit card expiration.
{{exp()}};
=> '10/2020'
Optionally specify that a raw object be returned rather than a string
{{exp({raw: true})}};
=> {month: '11', year: '2017'}
#
exp_month
// usage
{{exp_month()}}
{{exp_month({future: true})}}
Generate a random credit card expiration month.
{{exp_month()}};
=> '01'
Optionally specify that it must be a later month than the current month.
{{exp_month({future: true})}};
=> '10'
So if called in June, this would return a random month from July - Dec. If called in October, would return November or December.
This because many credit card sandboxes require an expiration date later than the current date so it's necessary when generating an expiration with the current year to generate a month later than the current month.
#
exp_year
// usage
{{exp_year()}}
Generate a random credit card expiration year.
{{exp_year()}};
=> '2018'
Returns a random year between today and 10 years in the future.