Skip to content
On this page

Finance

Module to generate finance related entries.

account

Generates a random account number.

Available since v2.0.1

Parameters

NameTypeDefaultDescription
length?number8

The length of the account number.

Returns: string

ts
faker.finance.account(length?: number = 8): string
faker.finance.account() // => "55786858"
faker.finance.account() // 92842238
faker.finance.account(5) // 32564

accountName

Generates a random account name.

Available since v2.0.1

Returns: string

ts
faker.finance.accountName(): string
faker.finance.accountName() // => "Home Loan Account"
faker.finance.accountName() // 'Personal Loan Account'

amount

Generates a random amount between the given bounds (inclusive).

Available since v2.0.1

Parameters

NameTypeDefaultDescription
minnumber0

The lower bound for the amount.

maxnumber1000

The upper bound for the amount.

decnumber2

The number of decimal places for the amount.

symbolstring''

The symbol used to prefix the amount.

autoFormat?boolean

If true this method will use Number.toLocaleString(). Otherwise it will use Number.toFixed().

Returns: string

ts
faker.finance.amount(min: number = 0, max: number = 1000, dec: number = 2, symbol: string = '', autoFormat?: boolean): string
faker.finance.amount() // => "548.81"
faker.finance.amount() // '617.87'
faker.finance.amount(5, 10) // '5.53'
faker.finance.amount(5, 10, 0) // '8'
faker.finance.amount(5, 10, 2, '$') // '$5.85'
faker.finance.amount(5, 10, 5, '', true) // '9,75067'

bic

Generates a random SWIFT/BIC code based on the ISO-9362 format.

Available since v4.0.0

Parameters

NameTypeDefaultDescription
options{ ... }{}

Options object.

options.includeBranchCode?boolean

Whether to include a three-digit branch code at the end of the generated code. Defaults to a random boolean value.

Returns: string

ts
faker.finance.bic(options: {
  includeBranchCode: boolean
} = {}): string
faker.finance.bic() // => "PSVPTDJUXXX"
faker.finance.bic() // 'WYAUPGX1'
faker.finance.bic({ includeBranchCode: true }) // 'KCAUPGR1432'
faker.finance.bic({ includeBranchCode: false }) // 'XDAFQGT7'

bitcoinAddress

Generates a random Bitcoin address.

Available since v3.1.0

Returns: string

ts
faker.finance.bitcoinAddress(): string
faker.finance.bitcoinAddress() // => "3HQARxRqCDoriT4XgotMPwtyoVQ5k6D2nQ"
faker.finance.bitcoinAddress() // '3ySdvCkTLVy7gKD4j6JfSaf5d'

creditCardCVV

Generates a random credit card CVV.

Available since v5.0.0

Returns: string

ts
faker.finance.creditCardCVV(): string
faker.finance.creditCardCVV() // => "557"
faker.finance.creditCardCVV() // '506'

creditCardIssuer

Returns a random credit card issuer.

Available since v6.3.0

Returns: string

ts
faker.finance.creditCardIssuer(): string
faker.finance.creditCardIssuer() // => "maestro"
faker.finance.creditCardIssuer() // 'discover'

creditCardNumber

Generates a random credit card number.

Available since v5.0.0

Parameters

NameTypeDefaultDescription
issuerstring''

The name of the issuer (case insensitive) or the format used to generate one.

Returns: string

ts
faker.finance.creditCardNumber(issuer: string = ''): string
faker.finance.creditCardNumber() // => "5020868584663428099"
faker.finance.creditCardNumber() // '4427163488662'
faker.finance.creditCardNumber('visa') // '4882664999007'
faker.finance.creditCardNumber('63[7-9]#-####-####-###L') // '6375-3265-4676-6646'

currencyCode

Returns a random currency code. (The short text/abbreviation for the currency (e.g. US Dollar -> USD))

Available since v2.0.1

Returns: string

ts
faker.finance.currencyCode(): string
faker.finance.currencyCode() // => "MUR"
faker.finance.currencyCode() // 'USD'

currencyName

Returns a random currency name.

Available since v2.0.1

Returns: string

ts
faker.finance.currencyName(): string
faker.finance.currencyName() // => "Mauritius Rupee"
faker.finance.currencyName() // 'US Dollar'

currencySymbol

Returns a random currency symbol.

Available since v2.0.1

Returns: string

ts
faker.finance.currencySymbol(): string
faker.finance.currencySymbol() // => "₨"
faker.finance.currencySymbol() // '$'

ethereumAddress

Generates a random Ethereum address.

Available since v5.0.0

Returns: string

ts
faker.finance.ethereumAddress(): string
faker.finance.ethereumAddress() // => "0xcdfcdcbc9de896d1f58abbbac8ec171e08cfb3dd"
faker.finance.ethereumAddress() // '0xf03dfeecbafc5147241cc4c4ca20b3c9dfd04c4a'

iban

Generates a random iban.

Available since v4.0.0

Parameters

NameTypeDefaultDescription
formattedbooleanfalse

Return a formatted version of the generated IBAN.

countryCode?string

The country code from which you want to generate an IBAN, if none is provided a random country will be used.

Returns: string

ts
faker.finance.iban(formatted: boolean = false, countryCode?: string): string
faker.finance.iban() // => "LI4476584648937N59B00"
faker.finance.iban() // 'TR736918640040966092800056'
faker.finance.iban(true) // 'FR20 8008 2330 8984 74S3 Z620 224'
faker.finance.iban(true, 'DE') // 'DE84 1022 7075 0900 1170 01'

litecoinAddress

Generates a random Litecoin address.

Available since v5.0.0

Returns: string

ts
faker.finance.litecoinAddress(): string
faker.finance.litecoinAddress() // => "MHQARxRqCDoriT4XgotMPwtyoVQ5k6"
faker.finance.litecoinAddress() // 'MoQaSTGWBRXkWfyxKbNKuPrAWGELzcW'

mask

Generates a random masked number.

Available since v2.0.1

Parameters

NameTypeDefaultDescription
length?number4

The length of the unmasked number.

parens?booleantrue

Whether to use surrounding parenthesis.

ellipsis?booleantrue

Whether to prefix the numbers with an ellipsis.

Returns: string

ts
faker.finance.mask(length?: number = 4, parens?: boolean = true, ellipsis?: boolean = true): string
faker.finance.mask() // => "(...5578)"
faker.finance.mask() // '(...9711)'
faker.finance.mask(3) // '(...342)'
faker.finance.mask(3, false) // '...236'
faker.finance.mask(3, false, false) // '298'

pin

Generates a random PIN number.

Available since v6.2.0

Parameters

NameTypeDefaultDescription
lengthnumber4

The length of the PIN to generate.

Returns: string

ts
faker.finance.pin(length: number = 4): string
faker.finance.pin() // => "5578"
faker.finance.pin() // '5067'
faker.finance.pin(6) // '213789'

routingNumber

Generates a random routing number.

Available since v5.0.0

Returns: string

ts
faker.finance.routingNumber(): string
faker.finance.routingNumber() // => "557868588"
faker.finance.routingNumber() // '522814402'

transactionDescription

Generates a random transaction description.

Available since v5.1.0

Returns: string

ts
faker.finance.transactionDescription(): string
faker.finance.transactionDescription() // => "payment transaction at Rau - Sporer using card...
faker.finance.transactionDescription()
// 'invoice transaction at Kilback - Durgan using card ending with ***(...4316) for UAH 783.82 in account ***16168663'

transactionType

Returns a random transaction type.

Available since v2.0.1

Returns: string

ts
faker.finance.transactionType(): string
faker.finance.transactionType() // => "payment"
faker.finance.transactionType() // 'payment'

Released under the MIT License.