Cancellation
The cancellation endpoints let you check the penalty for cancelling a booking and then perform the cancellation. Always call precancel first to show the guest the exact fee before committing to the cancellation.
The cancellation model
CancelDetails object
- Name
price_cancellation_penalty- Type
- number
- Description
The penalty charged for cancelling the booking.
0.00when the booking is still within its free cancellation window.
- Name
price_currency- Type
- string
- Description
Penalty currency code.
How penalties are calculated
The penalty is determined by the booking's cancellation policy:
- NonRefundable bookings — the penalty is always the full
price_chargeableamount. - Refundable bookings, before the deadline — cancelling on or before
cancellation_policy_dateincurs no penalty. - Refundable bookings, after the deadline — cancelling after
cancellation_policy_dateincurs the fullprice_chargeableamount. - Sandbox bookings — cancellation is always free.
For bookings paid via the account payment method, the difference between price_chargeable and the cancellation penalty is automatically credited back to your account balance when the booking is cancelled.
Cancelling an already-cancelled booking does not return an error. The response contains the penalty that applied at the time of the original cancellation, and no vendor call is made.
Precancel
Returns the penalty that would be charged if the booking were cancelled right now. This is a read-only quote — it does not modify the booking or contact the vendor.
Path parameters
- Name
booking_id- Type
- integer
- Description
The booking identifier from the booking response.
Error responses
500 Internal Server Error— Booking not found or error retrieving cancellation details
Request
curl https://api.tripedge.com/v1/book/precancel/12345 \
-H "Authorization: Bearer {token}"
Response (within free cancellation window)
{
"success": true,
"data": {
"price_cancellation_penalty": 0.00,
"price_currency": "USD"
},
"message": null
}
Response (past deadline or non-refundable)
{
"success": true,
"data": {
"price_cancellation_penalty": 750.00,
"price_currency": "USD"
},
"message": null
}
Cancel booking
Cancels the booking with the hotel vendor. On success, the booking status changes to cancelled and, for account payments, any refundable amount is credited back to your account balance.
The request has no body — the penalty is determined by the booking's cancellation policy at the time of the call.
Path parameters
- Name
booking_id- Type
- integer
- Description
The booking identifier from the booking response.
Error responses
500 Internal Server Error— Booking not found, vendor cancellation failed, or cancellation not supported for this vendor
A cancellation is only final when the response returns success: true.
If the request fails or times out, verify the booking status via
GET /v1/book?id=12345 before retrying.
Request
curl -X POST https://api.tripedge.com/v1/book/cancel/12345 \
-H "Authorization: Bearer {token}"
Response
{
"success": true,
"data": {
"price_cancellation_penalty": 0.00,
"price_currency": "USD"
},
"message": null
}
Error response
{
"success": false,
"message": "Error cancelling booking"
}