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

# 删除虚拟账户

使用 API endpoint 永久禁用不再需要的虚拟帐户。

`DELETE` 操作会**永久停用**虚拟账户，使其无法再接收任何未来的付款。与该账户相关的历史记录和交易数据将保留在我们的系统中，用于合规、报告和对账目的。

**重要提示**：此操作不可逆。已停用的账户无法重新激活。如果您需要重新启用同一收款人的收款功能，则必须[创建一个新的虚拟账户](https://docs.localpayment.com/zh/docs/create-a-virtual-account.md)。

使用此 endpoint 清理运营工作流程中不再活跃的帐户。

## 可用性

以下国家/地区可通过 API 删除虚拟账户：

| 国家/地区 | 删除 |
| - | - |
| **[阿根廷](https://docs.localpayment.com/zh/docs/argentina.md)** | ✔ |
| **[巴西](https://docs.localpayment.com/zh/docs/brazil.md)** | ✔ |
| **[智利](https://docs.localpayment.com/zh/docs/chile.md)** | ✔ |
| **[哥伦比亚](https://docs.localpayment.com/zh/docs/colombia.md)** | ✔ |
| **[墨西哥（SPEI 和 TEF）](https://docs.localpayment.com/zh/docs/mexico.md)** | ✔ |
| **[秘鲁](https://docs.localpayment.com/zh/docs/peru.md)** | — |

***

## 开始之前

请确保您已备好：

* 有效的 [API 凭证](https://docs.localpayment.com/zh/docs/api-keys-and-environments.md)（访问令牌）。
* 您要删除的虚拟帐户外部 ID。

***

## 虚拟账户删除

目前，虚拟账户删除仅可通过 API 接口实现。此方法可用于自动化清理流程和账户管理。

删除虚拟账户前，请确保其符合以下条件：

| 状态 | 可以删除 | 备注 |
| - | - | - |
| `COMPLETED` | ✅ | 活跃账户可以被删除 |
| `DISABLED` | ✅ | 已停用的帐户可以被删除 |
| `INPROGRESS` | ❌ | 等待账户创建完成 |
| 有待处理的交易 | ❌ | 首先解决所有待处理的交易。 |
| 有未清算资金 | ❌ | 等待资金到账结算 |

### 示例请求

使用外部 ID 向[删除虚拟账户](https://docs.localpayment.com/zh/reference/delete-virtual-account.md)endpoint 发送 `DELETE` 请求：

```bash curl theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
curl --request DELETE \
     --url https://api.stage.localpayment.com/api/virtual-account/{externalId} \
 		 --header 'Authorization: Bearer <your_access_token>' \
     --header 'accept: application/json'
```

### 关键请求参数

该请求需要几个关键参数：

| 对象 | 描述 | 必需的 |
| - | - | - |
| `externalId` | 要删除的虚拟帐户的外部 ID（路径参数） | ✅ |

查看请求中所有可用的[参数](https://docs.localpayment.com/zh/reference/delete-virtual-account.md)。

### 成功响应

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
  "currency": "MXN",
  "externalId": "f059a032-9253-4607-9b8e-2948ed18d595",
  "internalId": "d710312c-8c3f-4b65-8e62-7f83eeba321a",
  "accountNumber": "{{accountNumber}}",
  "beneficiary": {
    "type": "INDIVIDUAL",
    "name": "John",
    "document": {
      "type": "RFC",
      "id": "EXTF900101NI1"
    },
    "bank": {
      "branch": {},
      "account": {
        "number": "646011319800023123",
        "aliases": [],
        "owner": {
          "document": {}
        }
      }
    },
    "fullName": "John Doe",
    "lastName": "Doe"
  },
  "status": {
    "code": "100",
    "description": "INPROGRESS",
    "detail": "Virtual account in progress"
  },
  "errors": []
}
```

### 关键响应字段

| 字段 | 描述 | 用例 |
| - | - | - |
| `internalId` | Localpayment 已删除虚拟账户的唯一标识符。 | 交易跟踪和支持 |
| `externalId` | 您的虚拟账户原始参考编号。 | 内部对账 |
| `status.code` | 当前交易状态代码 | 状态监控 |

***

## 后续步骤

删除虚拟账户后，您可能需要：

> [card] [查看账户状态](https://docs.localpayment.com/zh/docs/get-virtual-account-status.md)
>
> 删除前请先确认虚拟账户状态。

> [card] [创建新的虚拟账户](https://docs.localpayment.com/zh/docs/create-a-virtual-account.md)
>
> 根据持续的业务需求创建新的虚拟账户。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.