> ## 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.

# 启用/禁用虚拟账户

Localpayment 允许您临时暂停或重新激活虚拟账户，让您可以灵活地管理账户状态，而无需永久删除。这对于临时冻结账户、解决纠纷或应对季节性业务波动非常有用。

## 开始之前

请确保您已备好：

* 有效的[API 凭证](https://docs.localpayment.com/zh/docs/api-keys-and-environments.md)（访问令牌）。
* 您要启用或禁用的虚拟帐户外部 ID。
* 了解虚拟账户的当前状态。

***

## 虚拟账户状态管理

您可以使用以下任一方法管理您的虚拟账户状态：

> [card] [启用虚拟帐户](#enable-virtual-account)
>
> 启用之前已停用的虚拟账户以恢复收款功能。

> [card] [禁用虚拟帐户](#disable-virtual-account)
>
> 暂时冻结虚拟账户以防止进一步付款，同时保留账户数据。

> [card] [查看账户状态](https://docs.localpayment.com/zh/docs/get-virtual-account-status.md)
>
> 在激活或停用虚拟账户之前，请先确认其当前状态。

***

## 虚拟账户状态参考

了解虚拟账户状态对于正确启用/禁用管理至关重要：

| 描述 | 可启用 | 可禁用 |
| - | - | - |
| INPROGRESS | ❌ | ❌ |
| COMPLETED | ❌ | ✅ |
| DELETED | ❌ | ❌ |
| DISABLED | ✅ | ❌ |

***

## 启用虚拟账户

重新激活之前已停用的虚拟账户以恢复收款功能。

使用外部 ID 向[更新虚拟账户状态](https://docs.localpayment.com/zh/reference/update-virtual-account-status.md)endpoint 发送 `PUT` 请求：

### 示例请求

以下是使用 `curl` 的示例：

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

### 关键请求参数

该请求需要几个关键对象：

| 参数 | 描述 | 必填 |
| - | - | - |
| `externalId` | 要启用的虚拟帐户的外部 ID（路径参数） | ✅ |

### 成功响应

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
  "currency": "MXN",
  "externalId": "e36ef929-c2d4-fcf0-b30c-99dc51798f4b",
  "internalId": "c09095fb-6a0e-47af-9f43-3d9452b0f290",
  "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": "200",
    "description": "COMPLETED",
    "detail": "Virtual account has been created"
  },
  "errors": []
}
```

### 关键响应字段

| 字段 | 描述 | 用例 |
| :- | :- | :- |
| `internalId` | Localpayment 虚拟账户的唯一标识符。 | 支持和系统参考 |
| `externalId` | 您的虚拟账户原始参考编号。 | 内部核对和跟踪 |
| `status.code` | 虚拟账户的当前状态码。 | 确定帐户可用性和后续操作 |

***

## 禁用虚拟账户

暂时冻结虚拟账户以防止进一步付款，同时保留账户数据和历史记录。

使用外部 ID 向[更新虚拟账户状态](https://docs.localpayment.com/zh/reference/update-virtual-account-status.md)endpoint 发送 `PUT` 请求：

> [!WARNING]
>
> **重要的**
>
> 在秘鲁，当虚拟账户被停用时，它会在您的银行应用程序中显示为不存在。

### 示例请求

以下是使用 `curl` 的示例：

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

### 关键请求参数

该请求需要几个关键对象：

| 参数 | 描述 | 必填 |
| - | - | - |
| `externalId` | 要禁用的虚拟帐户的外部 ID（路径参数） | ✅ |

### 成功响应

```json theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
{
  "currency": "MXN",
  "externalId": "f059a032-9253-4607-9b8e-2948ed18d595",
  "internalId": "c09095fb-6a4e-17cf-9343-9d9452b0f290",
  "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": "300",
    "description": "DISABLED",
    "detail": "Virtual account disabled"
  },
  "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/delete-virtual-account.md)
>
> 永久停用虚拟账户。此操作将阻止所有未来向该账户的付款，但会保留其完整的交易记录。此操作不可逆。适用于不再需要的账户；如需恢复使用，请创建新账户。


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