API 参考

查询结算状态#

根据链上交易哈希查询结算状态。适用于 exact(syncSettle=false)异步轮询场景和 aggr_deferred 压缩上链后的状态追踪。

请求地址: GET /api/v6/pay/x402/settle/status

请求参数#

参数类型必传描述
txHashString链上交易哈希(Query 参数)

响应参数#

参数类型描述
successBoolean查询是否成功(false 当 txHash 不存在时)
errorReasonString机器可读的失败原因(失败时返回)
errorMessageString人类可读的失败说明(失败时返回)
payerString付款方钱包地址
transactionString链上交易哈希
networkStringCAIP-2 链标识
statusString当前结算状态

status 取值#

status含义
pending处理中,未到终态
success链上交易成功
failed链上交易失败

请求示例#

Bash
curl --location --request GET 'https://web3.okx.com/api/v6/pay/x402/settle/status?txHash=0x4f46ed8eac92ddbccfb56a88ff827db3616c7beb191adabbeeded901340bd7d5' \
--header 'OK-ACCESS-KEY: 37c541a1-****-****-****-10fe7a038418' \
--header 'OK-ACCESS-SIGN: leaV********3uw=' \
--header 'OK-ACCESS-PASSPHRASE: 1****6' \
--header 'OK-ACCESS-TIMESTAMP: 2023-10-18T12:21:41.274Z'

响应示例 -- 查询成功#

Json
{
  "code": "0",
  "msg": "success",
  "data": {
    "success": true,
    "errorReason": null,
    "errorMessage": null,
    "payer": "0xcb30ed083ad246b126a3aa1f414b44346e83e67d",
    "transaction": "0x4f46ed8eac92ddbccfb56a88ff827db3616c7beb191adabbeeded901340bd7d5",
    "network": "eip155:196",
    "status": "success"
  }
}

响应示例 -- 交易未找到#

Json
{
  "code": "0",
  "msg": "success",
  "data": {
    "success": false,
    "errorReason": "not_found",
    "errorMessage": "Transaction not found for txHash: 0xabc123...",
    "payer": null,
    "transaction": null,
    "network": null,
    "status": null
  }
}