Easy Labs
Treasury

Treasury quickstart

From zero to your first payout in 5 minutes.

This walks the smallest end-to-end happy path: create a recipient with a bank account attached, then send them a payout. Server-side, in Node.

1. Get an API key

In the Easy Dashboard, open Settings → API keys and create a sandbox key (sk_sandbox_…). Copy it immediately — secret keys are shown only once.

2. Install the SDK

npm install @easylabs/node

3. Create a recipient + send a payout

import { createClient } from "@easylabs/node";

const client = await createClient({ apiKey: process.env.EASY_API_KEY! });

// 3a. Create the recipient with their bank account in one call.
const { data: recipient } = await client.createRecipient({
  name: "Ada Lovelace",
  email: "ada@example.com",
  type: "person",
  payment_methods: [
    {
      method_type: "ach",
      account_type: "checking",
      routing_number: "021000021",     // Chase test routing
      account_number: "000123456789",  // tokenized server-side
    },
  ],
});

// 3b. List your funding accounts and pick one to debit.
const { data: funding } = await client.listBankAccounts();
const sourceAccount = funding[0];

// 3c. Initiate the payout. Amounts are USD cents.
const { data: payout } = await client.createPayout({
  recipient_id: recipient.id,
  source_account_id: sourceAccount.id,
  amount: 5_000,            // $50.00
  method: "ach",
  memo: "Invoice #1024",
});

// 3d. Confirm. (Pass `security_code` if your security rules require 2FA.)
await client.confirmPayout({ transaction_id: payout.id });

4. Verify

Open Treasury → Transactions in the dashboard — your payout will be in processing. Or fetch it programmatically:

const { data } = await client.getTransaction(payout.id);
console.log(data.status); // "processing" → "completed"

When the underlying settlement is funded, a settlement.created webhook fires. See Webhooks to wire that up.

5. Next steps

  • Send a payout — full reference for the send flow, including reversibility, rail trade-offs, and error handling.
  • Invite a recipient — let recipients enter their own banking through Plaid Link instead of collecting account numbers.
  • Generate a payout link — share a link with someone who isn't a recipient yet.
  • API reference — all Treasury endpoints.

On this page