Skip to content
Documentation Menu

Using the Package

Search & Lookup

Finmarks exposes a ranked full-text search and two identifier-based resolvers — for IFSC codes and UPI handles. These are the functions that make Finmarks useful in a real payment UI, not just a static logo pack.

search

Matches against id, name, short name, legal name, tags, UPI handles and IFSC prefixes. Case-insensitive. Returns [] for a blank query.

Results are ranked by match quality — exact id or name match first, then IFSC prefix, then prefix match, then word-boundary, then substring, then tag — with ties broken alphabetically so output is stable across calls.

function search(query: string, options?: SearchOptions): Entity[]
import { search } from '@finmarks/finmarks';

// Basic search — surfaces Paytm first (exact name match)
search('paytm');

// Limit results
search('bank', { limit: 5 });

// Restrict to a category
search('invest', { categories: 'wealthtech' });

// Multiple categories, active only
search('pay', { categories: ['upi-psp', 'wallet'], includeInactive: false });

SearchOptions

OptionTypeDefaultDescription
limitnumberMaximum number of results to return
categoriesCategory | Category[]Restrict search pool to these categories
includeInactivebooleantrueSet to false to exclude defunct/acquired entities

getByIfscPrefix

Resolves the first four characters of an IFSC code to the issuing bank. Accepts the full IFSC or just the 4-letter prefix. Case-insensitive.

function getByIfscPrefix(prefix: string): Entity | undefined
import { getByIfscPrefix } from '@finmarks/finmarks';

const ifsc = 'HDFC0000123';
getByIfscPrefix(ifsc.slice(0, 4));  // → HDFC Bank

// Works with the full IFSC too
getByIfscPrefix('UTIB0001234');        // → Axis Bank

Note: IFSC identifies the branch, not just the bank. getByIfscPrefixuses only the first 4 characters (the bank code) and ignores the branch suffix. It resolves to the entity that owns that bank code.

getByUpiHandle

Resolves a UPI handle suffix to the entity that issues it. Accepts a full VPA (someone@ybl), a handle with @ (@ybl), or a bare suffix (ybl).

function getByUpiHandle(handle: string): Entity | undefined
import { getByUpiHandle } from '@finmarks/finmarks';

// Full VPA from a payment confirmation
getByUpiHandle('kaval@ybl');    // → PhonePe

// @-prefixed handle
getByUpiHandle('@okaxis');      // → Google Pay

// Bare suffix
getByUpiHandle('paytm');        // → Paytm

Note: A UPI handle identifies the PSP, not the user's bank.@ybl means the VPA was issued through PhonePe's Yes Bank rails — the user's actual bank account may be with any bank.