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

# 拒绝回调

`DeclineCallback` API 调用用于通知您 Spark 交易流程中发生的失败。它通常在 `/TriggerTransaction` 成功返回 `Approved`（已批准）结果之后触发，但此后流程在支付授权之前因某种原因失败。

此回调函数对于集成商至关重要，它可以帮助检测并妥善处理会话无法继续的情况，例如：

* 消费者未出示支付卡，终端超时。
* 消费者在 Nayax 设备上取消了交易。
* 刷卡过程中设备发生故障。
* 其他会中断流程的终端端错误。

在这种情况下，不会授予任何支付授权，交易流程将被终止。如有需要，集成方可以选择重新尝试调用 `/TriggerTransaction` 方法。

## 要求

Spark 会向 `https://<YOUR_DOMAIN>/DeclineCallback` 端点发送 POST 请求：

```json theme={null}
{
  "MachineId": 71234996,
  "HwSerial": "0434334921100366",
  "SparkTransactionId": "12c7cec2-c690-4425-9a1f-db0db60e2d8c",
  "Status": {
    "Verdict": "Declined",
    "ErrorCode": 44,
    "ErrorDescription": "Timeout on POS Device"
  }
}
```

### 请求参数

下表描述了该请求的参数：

| 字段 | 类型 | 必需的 | 描述 |
| - | - | - | - |
| `MachineId` | 整数 | 是的 | 自动售货机或终端的 ID |
| `HwSerial` | String | 是的 | 硬件终端的序列号 |
| `SparkTransactionId` | String | 是的 | 失败的 Spark 事务的唯一标识符 |
| `Status` | Object | 是的 | 一个表明拒绝细节的对象 |
| `Status.Verdict` | String | 是的 | 始终为 "Declined" |
| `Status.ErrorCode` | 整数 | 是的 | 拒绝原因代码： `44`：POS 设备超时 `45`：在 POS 设备上被取消 `38`：交易回调失败 |
| `Status.ErrorDescription` | String | 是的 | 拒绝原因描述 |

## 响应

这是来自 Nayax 的回调，不需要响应体。简单的 200 OK 服务器确认就足够了。


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