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.00 when 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_chargeable amount.
  • Refundable bookings, before the deadline — cancelling on or before cancellation_policy_date incurs no penalty.
  • Refundable bookings, after the deadline — cancelling after cancellation_policy_date incurs the full price_chargeable amount.
  • 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.


GET/v1/book/precancel/:booking_id

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

GET
/v1/book/precancel/12345
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
}

POST/v1/book/cancel/:booking_id

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

Request

POST
/v1/book/cancel/12345
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"
}

Was this page helpful?