Skip to main content

Helpers & Constants

The SDK ships with bank constants, enums and utility functions so you can look up information quickly without calling the API.


Bank Constants​

Look up the BIN, short name and full name of the banks supported by Tingee.

import {
BankNameEnum, BankBinEnum, BankAccountTypeEnum,
getBankCode, getBankShortName, getBankBin, Banks
} from '@tingee/sdk-node';

// Look up by BIN
getBankCode('970436') // BankNameEnum.VCB
getBankShortName('970436') // 'Vietcombank'

// Look up by name
getBankBin(BankNameEnum.VIETCOMBANK) // '970436'

// List all banks
Banks.forEach(b => console.log(`${b.shortName}: ${b.bin}`));

Enums​

BankNameEnum​

Bank short codes, used in bank-related APIs.

ValueBank
OCBOrient Commercial Joint Stock Bank
BIDVJoint Stock Commercial Bank for Investment and Development of Vietnam
MBBMilitary Commercial Joint Stock Bank
ACBAsia Commercial Joint Stock Bank
VPBVietnam Prosperity Joint Stock Commercial Bank
PGBProsperity and Growth Commercial Joint Stock Bank
VIBVietnam International Commercial Joint Stock Bank
STBSaigon Thuong Tin Commercial Joint Stock Bank
CTGVietnam Joint Stock Commercial Bank for Industry and Trade
VCBJoint Stock Commercial Bank for Foreign Trade of Vietnam
AGRIBANKVietnam Bank for Agriculture and Rural Development
SHINHANShinhan Bank Vietnam Limited
COBCo-operative Bank of Vietnam

BankBinEnum​

The BIN (Bank Identification Number) of each bank.

ValueBIN
OCB970448
BIDV970418
MBB970422
ACB970416
VPB970432
PGB970430
VIB970441
STB970403
CTG970415
VCB970436
AGRIBANK970405
SHINHAN970424
COB970446

BankAccountTypeEnum​

Account type used when creating a virtual account.

ValueDescription
personal-accountPersonal account
business-accountBusiness account
business-household-accountHousehold business account

Response Helpers​

import { isSuccessResponse, isErrorResponse } from '@tingee/sdk-node';

// Check for a successful response (code === '00')
if (isSuccessResponse(result)) { /* ... */ }

// Check for an error response (code !== '00')
if (isErrorResponse(result)) { /* ... */ }

Signature Helpers​

The SDK also exports the signature functions in case you need them separately (rarely needed, since the SDK handles signing for you):

import { generateSignature, formatTimestamp } from '@tingee/sdk-node';

const timestamp = formatTimestamp(new Date());
const signature = generateSignature('your-secret-key', timestamp, body);