Bỏ qua để đến nội dung

Update Booking (Online Check-in)

API cho đối tácAdd-on
POST
/properties/{tenant_id}/bookings/{booking_id}/update

Update booking with rooms, guests, payments, status, and notes. Use this endpoint for online check-in to submit guest information and complete check-in.

Scope Required: bookings:write

Content-Type: multipart/form-data (to support file uploads)

URL Parameters:

  • booking_id (required): The booking code to update

Request Format: Send as multipart/form-data with:

  • data: JSON string containing the update payload
  • rooms[{index}][guests][records][{guestIndex}][identity_image]: Single identity image file (backward compatible)
  • rooms[{index}][guests][records][{guestIndex}][identity_image][]: Multiple identity image files (max 3)

Body Parameters (in data JSON):

Rooms (rooms array) - Updates per booking room:

  • rooms[].id (required): UUID of the booking room
  • rooms[].status (optional): “checked_in” to check in this specific room
  • rooms[].guests (optional): Guest updates for this room
  • rooms[].guests.method (required with guests): “add” or “replace”
    • add: Add new guests to existing list
    • replace: Remove all existing guests and replace with new list
  • rooms[].guests.records[] (required with guests): Array of guest objects
    • id (optional): ID of the customer
    • name (required): Guest full name
    • email (optional): Email address
    • phone (optional): Phone number
    • birthday (optional): Date of birth (YYYY-MM-DD)
    • gender (optional): male, female, unknown
    • identity (optional): ID/Passport number
    • id_type (optional): identity_card, passport, other
    • identity_issue_date (optional): ID issue date (YYYY-MM-DD)
    • identity_image (optional): File upload(s) - single file or array of files (JPEG/PNG, max 5MB each, max 3 files)
    • address (optional): Street address
    • ward (optional): Ward/District
    • city (optional): City
    • country (optional): Country, ISO 3166-1 alpha-2 format (2 uppercase letters). Example: VN, US, JP, KR
    • is_primary_guest (optional): Boolean, primary guest for room
    • accommodation_type (optional): permanent, temporary, other
    • travel_purpose (optional): business, tourism, other
    • guest_category (optional): solo, couple, family, small_group, large_group

Services (rooms[].services object) - Per room:

  • rooms[].services.method (required with services): Only “add” is supported
    • add: Add new services to existing list (no replace functionality)
  • rooms[].services.records[] (required with services): Array of service objects
    • id (required): Service ID (e.g., SVAB12CD34 - get from /services endpoint)
    • quantity (required): Quantity of service (must be > 0)
    • price_per_unit (optional): Override default price per unit
    • service_used_date (optional): Date service was used (YYYY-MM-DD)
    • notes (optional): Service notes

Payments (payments object) - Booking level:

  • payments.method (required with payments): “add” or “replace”
    • add: Add new payments to existing list
    • replace: Remove unpaid payments and replace with new list (paid payments preserved)
  • payments.records[] (required with payments): Array of payment objects
    • amount (required): Payment amount
    • method (optional): Payment method (cash, bank_transfer, credit_card, etc.)
    • paid_at (optional): Payment timestamp (YYYY-MM-DD HH:mm:ss)
    • notes (optional): Payment notes/reference

Notes (notes string) - Booking level:

  • notes (optional): Booking notes

Invoice (invoice object) - Booking level: Optional invoice/billing info collected at online check-in (e.g. a guest requesting a VAT invoice for their company). Persisted onto the booking’s primary guest (resolved server-side via the first display room’s primary guest).

  • invoice.company (optional): Company/organization name (max 255)
  • invoice.tax_code (optional): Tax code / MST (max 20)
  • invoice.address (optional): Billing address (max 255)
  • invoice.email (optional): Email to receive the invoice (max 255)

Important Notes:

  • All fields are optional - only provided fields will be updated
  • For file uploads, use multipart/form-data with JSON data in ‘data’ field
  • Cannot check in before checkin_date
  • Cannot check in cancelled bookings
  • Sending invoice with any value while the booking has no resolvable primary guest fails with HTTP 422 (INVOICE_NO_PRIMARY_GUEST)
tenant_id
required
string
booking_id
required
string
UpdateBookingRequest

Update Booking Request (Online Check-in)

Update a booking with rooms, guests, payments, status, and notes. This endpoint uses multipart/form-data to support file uploads for guest identity images.

Request Format

Send data as multipart/form-data with:

  • data: JSON string containing the booking update payload
  • rooms[{index}][guests][records][{guestIndex}][identity_image]: Optional identity image files

Data Payload Structure

{
  "rooms": [
    {
      "id": "uuid-of-booking-room",
      "status": "checked_in",
      "guests": {
        "method": "add|replace",
        "records": [
          {
            "id": "123",
            "name": "John Doe",
            "email": "john@example.com",
            "phone": "+84123456789",
            "birthday": "1990-05-15",
            "gender": "male",
            "identity": "123456789012",
            "id_type": "identity_card",
            "identity_issue_date": "2020-01-15",
            "address": "123 Nguyen Hue Street",
            "ward": "Ben Nghe",
            "city": "Ho Chi Minh",
            "country": "VN",
            "is_primary_guest": true,
            "accommodation_type": "temporary",
            "travel_purpose": "tourism",
            "guest_category": "couple"
          }
        ]
      }
    }
  ],
  "invoice": {
    "company": "GoHost Co Ltd",
    "tax_code": "0312345678",
    "address": "123 Nguyen Hue Street, Q1, HCMC",
    "email": "invoice@gohostco.com"
  },
  "payments": {
    "method": "add|replace",
    "records": [
      {
        "amount": 1500000,
        "method": "cash",
        "paid_at": "2026-01-12 14:30:00",
        "notes": "Check-in payment"
      }
    ]
  },
  "notes": "Online check-in completed"
}

Services (per room)

Services can be added to each room using the services field. Only method: "add" is supported (no replace).

{
  "rooms": [
    {
      "id": "uuid-of-booking-room",
      "services": {
        "method": "add",
        "records": [
          {
            "id": "SVAB12CD34",
            "quantity": 2,
            "price_per_unit": 50000,
            "service_used_date": "2026-01-22",
            "notes": "Mini bar consumption"
          }
        ]
      }
    }
  ]
}

Guest Methods

  • add: Add new guests to the room without removing existing guests
  • replace: Remove all existing guests and replace with new guest list

Invoice Info (booking level)

Optional top-level invoice block — company, tax_code, address, email. The server resolves the booking’s primary guest (displayBookingRooms()->first()->getPrimaryGuest()) and persists the values into that customer’s dedicated customers.invoice_* columns — never overwrites the guest’s own company/address/email. If no primary guest can be resolved, the update fails with 422 INVOICE_NO_PRIMARY_GUEST.

Payment Methods

  • add: Add new payments without removing existing payments
  • replace: Remove unpaid payments and replace with new payment list (paid payments are preserved)

Room Status

  • checked_in: Check in the room (only allowed on or after checkin_date)
object
booking_id
required
string
notes

Notes (booking level)

string | null
<= 1000 characters
invoice

Invoice info (booking level) — saved onto the booking’s primary guest.

object
company
string | null
<= 255 characters
tax_code
string | null
<= 20 characters
address
string | null
<= 255 characters
email
string | null format: email
<= 255 characters
payments
required

Payments (booking level)

object
method
string
Allowed values: add replace
records
Array<object>
>= 1 items
object
amount
required
number
method
string | null
paid_at
string | null format: date-time
notes
string | null
<= 500 characters
rooms

Rooms - grouped by booking room with guests and status

array | null
object
id
required
string format: uuid
status
string | null
Allowed values: checked_in
guests

Guests within each room

object
method
string
Allowed values: add replace
records
Array<object>
object
id
integer | null
name
required
string
<= 255 characters
email
string | null format: email
<= 255 characters
phone
string | null
birthday
string | null format: date-time
gender
string | null
Allowed values: male female unknown
identity
string | null
<= 50 characters
id_type
string | null
Allowed values: identity_card passport other
identity_issue_date
string | null format: date-time
identity_image

Identity images (always array format, max 3 files)

array | null
<= 3 items
address

5MB each

string | null
<= 500 characters
ward
string | null
<= 100 characters
city
string | null
<= 100 characters
country
string | null
<= 100 characters
is_primary_guest
boolean | null
accommodation_type
string | null
Allowed values: permanent temporary other
travel_purpose
string | null
Allowed values: business tourism other
guest_category
string | null
Allowed values: solo couple family small_group large_group
services

Services within each room

object
method
string
Allowed values: add
records

Only ‘add’ is supported

Array<object>
>= 1 items
object
id
required
string
<= 10 characters
quantity
required

Service code as ID (10 chars: SV + 8 hex)

number
price_per_unit
number | null
service_used_date
string | null format: date
notes
string | null
<= 500 characters
Any of:
string

Validation error

object
message
required

Errors overview.

string
errors
required

A detailed description of each field that failed validation.

object
key
additional properties
Array<string>
Bài này có giúp được bạn không?