Join our community at https://www.reddit.com/r/HotelByte/

HotelByte
HomepageWaitlist
HomepageWaitlist
Hotel Partners Roadmap
Submit issues
  1. Manage bookings
  • 1. Get started
    • Overview
    • Booking flow
    • Certification and Go Live
    • Frequently Asked Questions (FAQ)
  • 2. Guides
    • Quick start
    • Error handling
    • Rate limit
    • Certification cases
    • Test more scenarios
  • 3. API Reference
    • Authentication
      • Ticket
    • Content
      • Destinations
      • HotelStaticDetail
      • HotelsMetadata
    • Search
      • HotelList
      • HotelRates
    • Make bookings
      • CheckAvail
      • Book
    • Manage bookings
      • QueryOrders
        POST
      • Cancel
        POST
  • Schemas
    • Schemas
    • hotel.common.bff.Table
    • OrderHomeFunctionReq
    • TicketReq
    • TicketResp
    • DestinationInclude
    • DestinationExtra
    • Coordinates
    • CheckAvailReq
    • CheckAvailResp
    • HotelsMetadataListResp
    • HotelsMetadataReq
    • ComputedCancelPolicyItem
    • OrderHomeFunctionResp
    • OriginalRoomNaming
    • Rate
    • CancelResp
    • Tax
    • Holder
    • HotelOrder
    • OrderRoomRefundInfo
    • HotelListReq
    • HotelListResp
    • HotelListBasicInfo
    • BaseHeader
    • BookingHeader
    • ContentHeader
    • HotelMeta
    • DestinationType
    • Guest
    • DestinationsReq
    • DestinationsResp
    • OrderStatus
    • GuestPerRoom
    • RatePkgId
    • RoomRatePkg
    • HotelRatesReq
    • BookReq
    • HotelRatesResp
    • BookResp
    • CancelReq
    • QueryOrdersReq
    • HotelStaticDetailReq
    • QueryOrdersResp
    • HotelStaticDetailResp
  1. Manage bookings

Cancel

HotelByte OpenAPI - Test
https://api-test.hotelbyte.com
HotelByte OpenAPI - Test
https://api-test.hotelbyte.com
POST
https://api-test.hotelbyte.com
/api/trade/cancel
OpenapiTrade
Cancel a hotel booking order with enterprise-grade reliability and state management.
This endpoint handles hotel order cancellation with comprehensive state validation,
audit logging, and enterprise reliability mechanisms. It supports both full and
partial cancellation based on supplier policies and order state.
Critical Prerequisites:
Order ID: Must be provided to identify the target order
JWT Authentication: Bearer token required in Authorization header
Valid Order State: Order must be in a cancellable state
Cancellation Types:
Full Cancellation: Complete order cancellation (most common)
Partial Cancellation: Cancel specific nights or rooms (supplier-dependent)
State-Dependent: Cancellation rules vary by order status and supplier policies
Enterprise Reliability Features:
Order state machine validation and transitions
Comprehensive audit logging and tracking
Automatic rollback on processing failures
CQRS event publishing for downstream processing
Processing time monitoring and performance tracking
State Validation:
Validates order exists and is accessible
Checks current order state for cancellation eligibility
Prevents cancellation of non-cancellable orders
Returns appropriate validation errors for invalid states
Processing Flow:
1.
Validate order existence and accessibility
2.
Check order state for cancellation eligibility
3.
Update order state to NeedCancel
4.
Publish cancellation event to CQRS queue
5.
Handle rollback if processing fails
6.
Record comprehensive audit logs
Error Handling:
Order not found errors with appropriate HTTP status
State validation errors for non-cancellable orders
Downstream timeout errors for supplier delays
Automatic rollback on critical processing failures
Common Use Cases:
Customer-initiated order cancellations
Administrative order cancellations
Policy-based cancellation processing
Order lifecycle management

Request

Header Params

Body Params application/jsonRequired

Examples

Responses

🟢200成功
application/json
OK
Body

🟠400请求有误
🟠401未认证
🟠403权限不足
🟠404未找到
🟠429请求过多
🔴504网关超时
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api-test.hotelbyte.com/api/trade/cancel' \
--header 'Client-Request-Timestamp;' \
--header 'Currency;' \
--header 'IP;' \
--header 'Language;' \
--header 'Request-Id;' \
--header 'Session-Id;' \
--header 'Test;' \
--header 'Timeout-Milliseconds;' \
--header 'Trace-Id;' \
--header 'Authorization: Bearer ' \
--header 'Content-Type: application/json' \
--data-raw '{
    "customerReferenceNo": "string",
    "supplierReferenceNo": "string",
    "reason": "string"
}'
Response Response Example
200 - Example 1
{
    "code": 0,
    "msg": "string",
    "data": {
        "serviceFee": {
            "currency": "string",
            "amount": 0
        },
        "status": 0
    }
}
Previous
QueryOrders
Next
hotel.common.bff.Table
Built with