Cancel Order
POST /v1/orders/cancel
Cancels an order that is still in new status.
No automatic refund
Once an order is cancelled, any TRX received later for that order is not refunded automatically. Only cancel orders when you are certain the user has not already sent the deposit.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
order_id | string | yes | ULID returned by POST /v1/orders. |
Examples
bash
curl -X POST https://api.tronzap.com/v1/orders/cancel \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"order_id": "01HZX5N6Q9TY3K2P0VWB7HRD4M"
}'javascript
const response = await fetch('https://api.tronzap.com/v1/orders/cancel', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({ order_id: '01HZX5N6Q9TY3K2P0VWB7HRD4M' }),
})
const { result } = await response.json()
console.log(result.status) // "cancelled"php
$response = file_get_contents('https://api.tronzap.com/v1/orders/cancel', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => "Content-Type: application/json\r\nAccept: application/json",
'content' => json_encode(['order_id' => '01HZX5N6Q9TY3K2P0VWB7HRD4M']),
],
]));
$data = json_decode($response, true)['result'];python
import requests
resp = requests.post('https://api.tronzap.com/v1/orders/cancel', json={
'order_id': '01HZX5N6Q9TY3K2P0VWB7HRD4M',
})
print(resp.json()['result']['status']) # "cancelled"Response
json
{
"code": 0,
"request_id": "550e8400-e29b-41d4-a716-446655440000",
"result": {
"order_id": "01HZX5N6Q9TY3K2P0VWB7HRD4M",
"status": "cancelled",
"deposit_address": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7",
"amount": 2.69,
"currency": "TRX",
"expires_at": "2026-05-18T16:07:05+00:00",
"ttl": 0
}
}Error cases
| Situation | Result |
|---|---|
Order not in new status | Error — cannot cancel an order that is already paid, processing, or terminal. |
order_id not found | Error — see Error Codes. |
