> ## Documentation Index
> Fetch the complete documentation index at: https://docs.truv.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Direct Deposit Switch

> Switch customer direct deposits to your bank using the Deposit Switch demo

Switch a new customer's paycheck deposit to your bank by embedding Truv Bridge in your application. The customer connects their payroll provider, selects an allocation, and Truv handles the deposit switch automatically.

<Info>
  **Integration pattern:** [Bridge Widget](/developers/integration/bridge-widget/overview) (User + Bridge Token flow) | **Products:** DDS | **Demo:** [Direct Deposit Switch](/developers/demos/retail-banking/direct-deposit-switch)
</Info>

***

## Get started

<Steps>
  <Step title="Run the demo">
    Clone and run the [Direct Deposit Switch demo](/developers/demos/retail-banking/direct-deposit-switch) to see the full direct deposit switch flow working locally.

    ```bash theme={null}
    git clone https://github.com/truvhq/demo-apps.git
    cd demo-apps
    npm install && npm start
    ```

    Open `http://localhost:5173`, select **Retail Banking > Deposit Switch**, and walk through a switch using sandbox credentials (`goodlogin` / `goodpassword`).

    See [full setup instructions](/developers/quickstarts-overview#demo-apps) for ngrok and environment configuration.
  </Step>

  <Step title="Understand the API flow">
    The demo follows this sequence:

    1. **Create a user** — Your server calls [POST /v1/users/](/api-reference/users/users_create) to create a Truv user.
    2. **Create a bridge token** — Your server calls [POST /v1/users/{id}/tokens/](/api-reference/bridge-token/users_tokens) with `product_type: "deposit_switch"` and an `account` object containing your bank's account details and allocation preferences.
    3. **Initialize Bridge** — Your frontend opens [Truv Bridge](/developers/sdks/overview) with the `bridge_token`. The customer connects their payroll provider and confirms the deposit switch.
    4. **Receive webhooks** — Truv sends a `task-status-updated` [webhook](/api-reference/webhooks) with status `done` when the switch completes. Verify the signature using the `X-Webhook-Sign` header with HMAC-SHA256.
    5. **Retrieve the report** — Fetch the deposit switch confirmation with [GET /v1/users/{user_id}/deposit\_switch/report/](/api-reference/dds-reports/dds-report-retrieve).
  </Step>

  <Step title="Review the code">
    Each step maps to a specific file in the demo. Use these as reference when building your integration.

    | Step                  | Demo file                                                                                                      | API reference                                                           |
    | --------------------- | -------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
    | User creation         | [`server/routes/bridge.js`](https://github.com/truvhq/demo-apps/blob/main/server/routes/bridge.js)             | [POST /v1/users/](/api-reference/users/users_create)                    |
    | Bridge token creation | [`server/routes/bridge.js`](https://github.com/truvhq/demo-apps/blob/main/server/routes/bridge.js)             | [POST /v1/users/{id}/tokens/](/api-reference/bridge-token/users_tokens) |
    | Bridge initialization | [`src/demos/DepositSwitch.jsx`](https://github.com/truvhq/demo-apps/blob/main/src/demos/DepositSwitch.jsx)     | [Bridge SDK](/developers/sdks/overview)                                 |
    | Webhook handling      | [`server/webhooks.js`](https://github.com/truvhq/demo-apps/blob/main/server/webhooks.js)                       | [Webhooks](/api-reference/webhooks)                                     |
    | Report retrieval      | [`server/routes/user-reports.js`](https://github.com/truvhq/demo-apps/blob/main/server/routes/user-reports.js) | [DDS report](/api-reference/dds-reports/dds-report-retrieve)            |
  </Step>
</Steps>

***

## Configure account details

Pass your bank's account details in the `account` object when creating the bridge token. These fields tell Truv where to route the customer's paycheck.

| Field            | Required | Description                                                                  |
| ---------------- | -------- | ---------------------------------------------------------------------------- |
| `account_number` | Yes      | Your bank account number (4-20 digits)                                       |
| `routing_number` | Yes      | Your bank routing number (8-12 digits)                                       |
| `bank_name`      | Yes      | Your bank's display name                                                     |
| `account_type`   | Yes      | `checking` or `savings`                                                      |
| `deposit_type`   | No       | Allocation type: `entire`, `amount`, or `percent`                            |
| `deposit_value`  | No       | Amount or percentage (required when `deposit_type` is `amount` or `percent`) |

***

## Set allocation type

Control how much of the customer's paycheck routes to your bank. Choose one of three allocation types.

| Allocation    | `deposit_type` | `deposit_value`                 | Behavior                            |
| ------------- | -------------- | ------------------------------- | ----------------------------------- |
| Full paycheck | `entire`       | Not required                    | Routes the entire paycheck          |
| Fixed amount  | `amount`       | Dollar amount (e.g. `"500.00"`) | Routes a specific dollar amount     |
| Percentage    | `percent`      | Percentage (e.g. `"50"`)        | Routes a percentage of the paycheck |

### Full paycheck

```json theme={null}
{
  "account_number": "16002600",
  "routing_number": "123456789",
  "bank_name": "Your Bank",
  "account_type": "checking",
  "deposit_type": "entire"
}
```

### Fixed amount

```json theme={null}
{
  "account_number": "16002600",
  "routing_number": "123456789",
  "bank_name": "Your Bank",
  "account_type": "checking",
  "deposit_type": "amount",
  "deposit_value": "500.00"
}
```

### Percentage

```json theme={null}
{
  "account_number": "16002600",
  "routing_number": "123456789",
  "bank_name": "Your Bank",
  "account_type": "checking",
  "deposit_type": "percent",
  "deposit_value": "50"
}
```

***

## Next steps

<CardGroup cols={2}>
  <Card title="Bridge Widget Guide" icon="book-open" href="/developers/integration/bridge-widget/overview">
    Full implementation guide for the User + Bridge Token flow
  </Card>

  <Card title="Sandbox Testing" icon="flask" href="/developers/testing/test-credentials">
    Test deposit switching in sandbox
  </Card>

  <Card title="Webhooks" icon="bell" href="/api-reference/webhooks">
    Handle task-status-updated and other webhook events
  </Card>

  <Card title="DDS Report API" icon="file-lines" href="/api-reference/dds-reports/dds-report-retrieve">
    Retrieve deposit switch confirmation reports
  </Card>
</CardGroup>
