Overview

The Bank Check model extracts and structures information from US bank checks, including payee/payer information, amounts, and MICR (Magnetic Ink Character Recognition) data. The model is specifically designed to handle standard US bank check formats.

Model Details

  • Model ID: BANK_CHECK
  • Supported Locales: en-US
  • Version: GA
  • Release Date: November 30, 2024

Schema Structure

Root Level Fields

FieldTypeDescription
PayerNamestringName of the payer (drawer)
PayerAddressstringAddress of the payer (drawer)
PayTostringName of the payee
CheckDatestring (ISO date)Date the check was written
NumberAmountnumberAmount of the check in numeric form
WordAmountstringAmount of the check in written form
BankNamestringName of the bank
Memostring?Short note describing the payment
MICRMICRMICR line information

MICR Fields

The MICR object contains:

FieldTypeDescription
RoutingNumberstringRouting number of the bank
AccountNumberstringAccount number
CheckNumberstringCheck number

Example Usage

import { bankCheckResponseSchema, strictBankCheckSchema } from '@your-package/models';

// Example check data
const checkData = {
  PayerName: "Jane Doe",
  PayerAddress: "123 Main St, Redmond, WA 98052",
  PayTo: "John Smith",
  CheckDate: "2024-01-01",
  NumberAmount: 150.00,
  WordAmount: "One Hundred Fifty and 00/100",
  BankName: "Contoso Bank",
  Memo: "April Rent Payment",
  MICR: {
    RoutingNumber: "123456789",
    AccountNumber: "1001001234",
    CheckNumber: "0740"
  }
};

// Validate using the standard schema
const validated = bankCheckResponseSchema.parse({ result: checkData });

// Validate using the strict schema
const strictValidated = strictBankCheckSchema.parse({ result: checkData });

Validation Functions

validateBankCheck

Validates the entire check structure against the schema:

const validateBankCheck = (data: unknown): BankCheck

validateAmounts

Validates that numeric and written amounts match:

const validateAmounts = (check: BankCheck): boolean

Returns true if the difference between numberAmount and wordAmount is less than 0.01.

validateMICR

Validates the MICR line format:

const validateMICR = (micr: MICR): boolean

Verifies that:

  • Routing number is exactly 9 digits
  • Special MICR symbols (⑆, ⑈) are properly handled

Date Handling

The model accepts dates in two formats:

  • ISO 8601 datetime strings
  • YYYY-MM-DD format strings

All dates are automatically converted to ISO format during validation.

Type Definitions

You can import the following TypeScript types:

import type {
  BankCheck,
  MICR,
  BankCheckDocument
} from '@your-package/models';

Field Validation Rules

  • All monetary amounts must be non-negative numbers
  • Required fields include: payerName, payerAddress, payTo, checkDate, numberAmount, wordAmount, bankName, and micr
  • The memo field is optional
  • PayerSignatures defaults to an empty array if not specified
  • Numeric amount and written amount must match (within 0.01 difference)
  • MICR routing number must be exactly 9 digits
  • MICR special characters (⑆, ⑈) are preserved but ignored during validation

Best Practices

  1. Always validate both amounts:
if (!validateAmounts(check)) {
  // Handle amount mismatch
}
  1. Validate MICR data:
if (!validateMICR(check.micr)) {
  // Handle invalid MICR format
}
  1. Store MICR data as strings to preserve leading zeros and special characters

  2. Handle date conversions properly:

const checkData = {
  ...otherData,
  checkDate: "2024-01-01" // Will be converted to ISO format
};
  1. Remember that signature verification is not part of the model’s capabilities - signatures are stored as strings for reference only