Overview
The Credit Card model extracts and structures information from credit cards, handling various card types, validation rules, and security considerations. The model includes comprehensive utilities for card number formatting, validation, and secure display.Model Details
- Model ID:
CREDIT_CARD - Version: GA
- Release Date: November 30, 2024
Payment Networks
The model supports these major payment networks:VISAMASTERCARDAMERICAN EXPRESSDISCOVEROTHER
Schema Structure
Root Level Fields
| Field | Type | Description |
|---|---|---|
CardNumber | string? | A unique identifier for the card (Luhn validated) |
IssuingBank | string? | The name of the bank that issued the card |
PaymentNetwork | string? | The payment network that processes transactions |
CardHolderName | string? | The name of the person who owns the card |
CardHolderCompanyName | string? | The company name associated with the card |
ValidDate | string? | Valid from date (MM/YY format) |
ExpirationDate | string? | Expiration date (MM/YY format) |
CardVerificationValue | string? | Card verification value (CVV) |
CustomerServicePhoneNumbers | string[] | Array of customer service numbers |
Utility Functions
The model provides comprehensive utility functions:maskCardNumber
Securely masks the card number:isExpired
Checks if the card is expired:formatCardNumber
Formats card number with spaces:getCardType
Determines payment network from card number:formatPhoneNumber
Formats phone numbers consistently:Example Usage
Date Handling
The model handles dates in MM/YY format:- Valid format example: “01/29”
- Months must be 01-12
- Years are assumed to be 20XX
- Expiration is calculated using end of month
Type Definitions
You can import the following TypeScript types:Validation Rules
Basic Validation
- All fields are optional by default
- CustomerServicePhoneNumbers defaults to an empty array if not specified
Strict Validation
The following fields are required in strict mode:- CardNumber
- CardHolderName
- IssuingBank
- PaymentNetwork
- ExpirationDate