Skip to main content

Method Signature

align.virtualAccounts.get(
  customerId: string,
  virtualAccountId: string
): Promise<VirtualAccount>

Parameters

customerId
string
required
The unique customer identifier
virtualAccountId
string
required
The unique virtual account identifier

Returns

id
string
Unique identifier for the virtual account
status
string
Account status: active
destination_address
string
Wallet address where funds will be sent
deposit_instructions
object
Bank account details. Properties vary by account type.
Type-Safe Instruction Access: Since deposit_instructions is a discriminated union, we recommend using the SDK’s built-in type guards to safely narrow the type: - isUSAccountDetails(instr): For USD (ACH/Wire) accounts. - isIBANAccountDetails(instr): For EUR (SEPA) accounts. - isInternationalWireAccountDetails(instr): For USD (SWIFT) accounts.

Examples

import { isUSAccountDetails, isIBANAccountDetails } from "@tolbel/align";

const account = await align.virtualAccounts.get(customerId, "va_123");

// Use type-safe helper functions for narrowing
if (isUSAccountDetails(account.deposit_instructions)) {
  console.log(`US Account: ${account.deposit_instructions.us.account_number}`);
} else if (isIBANAccountDetails(account.deposit_instructions)) {
  console.log(`IBAN: ${account.deposit_instructions.iban.iban_number}`);
}