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

# 中止交易

`abortTransaction` 方法可在交易被记录到数据库之前取消正在进行的交易，即在收到 doTransaction 响应之前（= 在消费者刷卡/插卡之前，或在交易超时发生之前）。这可确保尚未完成但正在进行中的交易能够被安全终止，而不会影响商户的记录。

当用户发起交易但在完成前取消，或在处理过程中检测到需要停止交易的问题时，此方法非常有用。

## 要求

> [!NOTE]
>
> JSON-RPC 2.0
>
> TweezerComm 中的所有方法都遵循 JSON-RPC 2.0 结构。有关请求的结构和发送方式的更多详细信息，请参阅[“集成”部分](/docs/integrate-pos-device/tweezercomm/tweezercomm-get-started.md)。

在请求中，`method` 字段需要设置为 `abortTransaction`，如下方示例请求所示：

```json theme={null}
{
    "jsonrpc":"2.0",
    "method":"abortTransaction",
    "id":"123454352",
    "params": [
            "engine",{
                "vuid": "cb740169-7758-4f55-b685-b90652b9aba6"
                    }
        ]
}
```

### 请求参数

下表描述了此方法的请求参数。

| 姓名 | 类型 | 描述 |
| - | - | - |
| `vuid` | string | 供应商（客户）唯一交易标识符。 |

## 回复

成功的请求将返回以下响应：

```json theme={null}
{
    "jsonrpc": "2.0",
    "id": "123454352",
    "result": {
        "statusCode": 0,
        "statusMessage": "ok"
    }
}
```

### 响应参数

下表描述了该方法的响应参数。

| 姓名 | 类型 | 描述 |
| - | - | - |
| `statusCode` | 整数 | 操作状态（0 = 成功） |
| `statusMessage` | string | 操作消息 |


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