Skip to main content
This method is for testing only and will not work in production.

Method Signatures

Simulate Offramp Transfer

align.transfers.simulateOfframpTransfer(
  customerId: string,
  data: SimulateOfframpTransferRequest
): Promise<SimulateTransferResponse>

Simulate Onramp Transfer

align.transfers.simulateOnrampTransfer(
  customerId: string,
  data: SimulateOnrampTransferRequest
): Promise<SimulateTransferResponse>

Parameters

customerId
string
required
The unique customer identifier
transfer_id
string
required
The transfer ID to simulate
action
string
required
Simulation action: complete_transfer

Examples

Simulate Offramp Completion

import Align from "@tolbel/align";

const align = new Align({
  apiKey: process.env.ALIGN_API_KEY!,
  environment: "sandbox",
});

// Complete an offramp transfer
await align.transfers.simulateOfframpTransfer(customerId, {
  transfer_id: "tr_123e4567-e89b-12d3-a456-426614174000",
  action: "complete_transfer",
});

console.log("Transfer completion simulated");

Simulate Onramp Completion

await align.transfers.simulateOnrampTransfer(customerId, {
  transfer_id: "tr_456...",
  action: "complete_transfer",
});

Complete Test Workflow

async function testOfframpFlow(customerId: string) {
  // 1. Create quote
  const quote = await align.transfers.createOfframpQuote(customerId, {
    source_amount: "100.00",
    source_token: "usdc",
    source_network: "polygon",
    destination_currency: "usd",
    destination_payment_rails: "ach",
  });

  // 2. Create transfer
  const transfer = await align.transfers.createOfframpTransfer(
    customerId,
    quote.quote_id,
    {
      destination_external_account_id: "ext_123",
      transfer_purpose: "personal_expenses",
    }
  );

  // 3. Simulate completion
  await align.transfers.simulateOfframpTransfer(customerId, {
    transfer_id: transfer.id,
    action: "complete_transfer",
  });

  // 4. Verify
  const completed = await align.transfers.getOfframpTransfer(
    customerId,
    transfer.id
  );
  console.log(`Transfer ${completed.status}`);
}