With this simple TypeScript tool you can generate valid credit card numbers with fake details for testing purposes
npm install jermainee/credit-card-generator
Import the CreditCardGenerator and CreditCardVendor enum
import CreditCardGenerator, { CreditCardVendor } from 'credit-card-generator';
Generating a single credit card number:
const creditCardNumber = creditCardGenerator.generateSingle(CreditCardVendor.VISA);
Generating multiple credit card numbers:
const creditCardNumbers = creditCardGenerator.generateMultiple(CreditCardVendor.MasterCard, 3);
Generating a credit card number using your own preset (see ICreditCardPreset):
const creditCardNumber = creditCardGenerator.generateWithPreset(preset);
- VISA
- MasterCard
- Amex
- Diners
- Discover
- EnRoute
- JCB
- Voyager