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

# 请求账户转账批准

`requestAccountTransfer`

提交账户间转账的经理审批请求。获批后，Fluz 将使用与 `createTransfer` 相同的语义执行转账。

当用户或应用在在 Fluz 账户之间划转资金前需要经理签署时使用此操作。对于同一账户下的消费账户之间的转账，请改用 `requestInternalTransfer`。

## Scopes

| Action | Scope                      |
| ------ | -------------------------- |
| 创建请求   | `REQUEST_ACCOUNT_TRANSFER` |
| 列出请求   | `LIST_APPROVALS`           |
| 批准或拒绝  | `MANAGE_APPROVALS`         |

## Webhook Identifiers

| Field          | Value    |
| -------------- | -------- |
| `approvalType` | `PAYOUT` |
| `approvalCode` | `500402` |

Webhook 事件：`APPROVAL_CREATE`、`APPROVAL_APPROVE`、`APPROVAL_DECLINE`，以及在执行失败时的 `APPROVAL_HANDLER_ERROR`。

> 内部转账与账户转账共享相同的 `approvalType` 和 `approvalCode`。请使用原始请求的 mutation，或在集成中检查审批负载以区分它们。

## Create a Request

输入与[转账到其他 Fluz 钱包](/features/transfer-to-another-fluz-wallet)一致。发起方由身份验证决定；目标与资金来源遵循与 `createTransfer` 相同的规则。

### RequestAccountTransferInput

| Field                 | Type                | Required | Description                               |
| --------------------- | ------------------- | -------- | ----------------------------------------- |
| `idempotencyKey`      | UUID                | Yes      | 用于防止批准时重复转账的唯一键                           |
| `amount`              | Float               | Yes      | 转账金额。必须大于零                                |
| `destination`         | TransferDestination | Depends  | 收款账户。对 Basic Auth 必填；对 Bearer 可选（默认为你的应用） |
| `bankCardId`          | UUID                | No       | 使用已绑定银行卡出资。仅适用于 Bearer 令牌                 |
| `bankAccountId`       | UUID                | No       | 通过 ACH 出资。仅适用于 Bearer 令牌                  |
| `paypalVaultId`       | UUID                | No       | 通过 PayPal 出资。仅适用于 Bearer 令牌               |
| `memo`                | String              | No       | 交易备注                                      |
| `transactionCategory` | String              | No       | 类别标签；首次使用时自动创建                            |
| `attachmentId`        | String              | No       | 先前上传的交易附件 ID                              |

### TransferDestination

| Field                 | Type   | Description      |
| --------------------- | ------ | ---------------- |
| `accountId`           | UUID   | 收款方 Fluz 账户 ID   |
| `externalReferenceId` | String | 你方系统中的收款方外部引用 ID |
| `userCashBalanceId`   | UUID   | 收款账户上的可选目标消费账户   |

提供 `accountId` 或 `externalReferenceId` 其中之一，不要同时提供。

### Authentication Notes

| Method       | Sender | Notes                  |
| ------------ | ------ | ---------------------- |
| Bearer token | 已认证用户  | 允许使用资金来源；目标可选（默认为你的应用） |
| Basic Auth   | 你的应用   | 目标必填；不允许使用资金来源         |

### Sample Mutation — User to Application

```graphql theme={null}
mutation {
  requestAccountTransfer(
    input: {
      idempotencyKey: "550e8400-e29b-41d4-a716-446655440000"
      amount: 100.00
    }
  ) {
    success
    messageId
    error {
      code
      message
    }
  }
}
```

### Sample Mutation — Application to User

```graphql theme={null}
mutation {
  requestAccountTransfer(
    input: {
      idempotencyKey: "550e8400-e29b-41d4-a716-446655440001"
      amount: 50.00
      destination: {
        accountId: "c3d4e5f6-a7b8-9012-cdef-345678901234"
      }
    }
  ) {
    success
    messageId
    error {
      code
      message
    }
  }
}
```

### Sample Response

```json theme={null}
{
  "data": {
    "requestAccountTransfer": {
      "success": true,
      "messageId": "1234567890"
    }
  }
}
```

`idempotencyKey` 会被保留，并在批准后执行转账时使用。

## Approve a Request

使用 `approvalId` 调用 `approveApprovalRequest`。需要 `MANAGE_APPROVALS`。

```graphql theme={null}
mutation {
  approveApprovalRequest(approvalId: "07df5653-43a8-4532-9881-3ab5857bbe12") {
    success
    approvalId
    action
  }
}
```

批准后，Fluz 将执行账户转账。

## Decline a Request

使用 `approvalId` 调用 `declineApprovalRequest`。需要 `MANAGE_APPROVALS`。

```graphql theme={null}
mutation {
  declineApprovalRequest(approvalId: "07df5653-43a8-4532-9881-3ab5857bbe12") {
    success
    approvalId
    action
  }
}
```

当请求被拒绝时，不会执行任何转账。
