订单
取消订单
一个操作即可取消任何订单。最初 15 秒内取消是即时的,并全额退款。之后,在服务支持的情况下它变成一个请求。发送 order 得到一个对象,或发送 orders 得到每个订单一个条目的数组。
POST
https://notpanel.com/api/v3action=cancel- 需要 API key
- 请求过于频繁
- 请求体:
application/x-www-form-urlencoded
参数
始终发送
keystring必需- 你的 API key。
actionstring必需cancel必须是字面字符串 “cancel”。
发送 order 或 orders。
orderinteger以下之一- 一个订单号。
ordersstring (CSV)以下之一- 最多 100 个以逗号分隔的订单号。取消按订单 ID 计数:每个账户每分钟 30 个。
curl -X POST https://notpanel.com/api/v3 \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "key=YOUR_API_KEY&action=cancel&orders=1,2,3"const res = await fetch("https://notpanel.com/api/v3", {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: new URLSearchParams({
key: "YOUR_API_KEY",
action: "cancel",
orders: "1,2,3",
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://notpanel.com/api/v3",
data={
"key": "YOUR_API_KEY",
"action": "cancel",
"orders": "1,2,3",
},
)
print(res.json())<?php
$body = http_build_query([
'key' => 'YOUR_API_KEY',
'action' => 'cancel',
'orders' => '1,2,3',
]);
$response = file_get_contents('https://notpanel.com/api/v3', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => "Content-Type: application/x-www-form-urlencoded\r\n",
'content' => $body,
'ignore_errors' => true,
],
]));
print_r(json_decode($response, true));
将 YOUR_API_KEY 替换为 API 页面中的密钥。
[
{
"order": 1,
"cancel": 1,
"state": "canceled",
"refund": "1.20"
},
{
"order": 2,
"cancel": 1,
"state": "requested"
},
{
"order": 3,
"cancel": {
"error": "Cancel is not available for this order",
"error_code": "CANCEL_NOT_AVAILABLE",
"retryable": false
}
}
]错误
- 400
{"error":"Maximum 100 IDs per request","error_code":"TOO_MANY_IDS","retryable":false}orders 中的订单号超过 100 个。
- 429
{"error":"Rate limit exceeded","error_code":"API_RATE_LIMITED","retryable":true,"retry_after":12}一分钟内的订单 ID 超过 30 个。请等待 Retry-After。
一个条目可能表示什么
条目按你发送的顺序返回。一个订单的问题绝不会影响其他订单。
答复
canceled- 带
refund的state: "canceled"。订单被立即取消并全额退款:它在最初 15 秒内,或尚未发送。 requestedstate: "requested"。取消请求已记录并发送。在服务作出决定之前订单继续进行,任何退款都会自动完成。asked_again- 再次出现
state: "requested"。你在上次答复后的 10 分钟内再次询问,因此返回已保存的答复,不会再次询问。10 分钟之后,请求会被重新发送。 CANCEL_REFUSED- 服务拒绝了。
retry_after和details.time说明你何时可以再次询问。 CANCEL_NOT_AVAILABLE- 此订单无法取消,例如因为该服务不支持取消请求。
ORDER_FINISHED- 订单已经结束。
ORDER_NOT_FOUND- 你的账户中没有这个订单。
即时取消
下单后的最初 15 秒内,无论是什么服务,每个订单都可以全额退款取消。处于等待状态且从未发送的订单,也可以随时即时取消。退款是条目的一部分。
key=YOUR_API_KEY&action=cancel&order=1234574{
"order": 1234574,
"status": "Canceled",
"status_key": "cancelled",
"cancel": 1,
"state": "canceled",
"refund": "1.20",
"refund_pending": 0
}取消请求
免费窗口结束后,取消是一个请求。它仅适用于列表中 cancel 为 true 的服务,且仅限订单处理中或进行中。尚未交付的部分会自动退款,status 会显示 can_cancel 和 cancel_state。
key=YOUR_API_KEY&action=cancel&order=1234576{
"error": "The order could not be canceled. You can ask again after 2026-10-03T10:10:00.000Z.",
"error_code": "CANCEL_REFUSED",
"retryable": true,
"details": {
"time": "2026-10-03T10:10:00.000Z"
},
"retry_after": 540
}取消错误
使用 order 时,这些就是完整的响应,并带有各自的 HTTP 状态。使用 orders 时,它们出现在数组条目内部,只有 TOO_MANY_IDS 会使整个请求失败。
- 404
ORDER_NOT_FOUND
Order not found你的账户下没有此编号的订单。 请先修正请求。
- 409
ORDER_FINISHED
Order is already {status}订单已经结束。 请先修正请求。
- 409
CANCEL_NOT_AVAILABLE
Cancel is not available for this order此订单无法取消。 请先修正请求。
- 409
CANCEL_REFUSED
The order could not be canceled. You can ask again after {time}.取消请求被拒绝。你可以在 details.time 给出的时间之后再次询问。 重试可能有帮助。
- 400
TOO_MANY_IDS
Maximum 100 IDs per request某个列表包含的 ID 超过一次请求所能承载的数量。 请先修正请求。