Wiki

Clone wiki

API-2.0 / Cancel_booking_for_customer

Method: POST

Path: /customer/bookings/:id/cancel

Cancel existing booking and create next recurring (if applicable).

id (required)

Booking unique ID.

Request schema:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Cancel booking request",
    "type": "object",

    "properties": {
        "confirmed_late": {
            "type": "boolean"
        },
        "confirmed_fee": {
            "type": ["number", "null"],
            "minimum": 0,
            "maximum": 100000
        },
        "confirmed_recurring": {
            "type": ["object", "null"],
            "properties": {
                "cancel_future": {
                    "type": "boolean"
                }
            },
            "required": ["cancel_future"]
        },
        "reason": {
            "type": ["string", "null"],
            "minLength": 1
        }
    }
}

Where:

  • confirmed_late is required to cancel booking that corresponds to booking late cancellation policy (see Booking cancellation policy and actions->late_cancel in Get booking for customer)
  • confirmed_fee only may present for late cancellation (i.e. in combination with confirmed_late=true); if present, confirmed_fee should correspond to what customer supposed to pay for late cancellation ( could be fixed fee or % of booking’s before-tax amount, see Booking cancellation policy)
  • confirmed_recurring is required to cancel recurring booking (see actions->show_recurring_options in Get booking for customer); has attributes:
    • cancel_future if true, next recurring booking will not be created
  • reason is explanation why booking cancelled, is required if cancellation_reason_on=true in Booking cancellation policy

Example of request JSON (non-late and non-recurring booking)

Empty request or

{
   "confirmed_late": false,
   "reason": "booked by mistake"
}

Example of request JSON (late and non-recurring booking)

{
   "confirmed_late": true,
   "confirmed_fee": 50.50
}

i.e. user mast confirm that (s)he agree to pay cancellation fee 50.50.

Example of request JSON (non-late and recurring booking)

Empty request or

{
   "confirmed_recurring": {
     "cancel_future": false
   }
}
  • set cancel_future to false if customer selected to cancel only this booing and keep future bookings, i.e. backend will create next recurring booking
  • set cancel_future to true if customer wants to cancel this and all future bookings, i.e. backend will not create next recurring booking (AND IMPORTANT: WILL NOT CANCEL ALREADY EXISTING NEXT RECURRING)

Example of request JSON (late and recurring booking)

Empty request or

{
   "confirmed_late": true,
   "confirmed_fee": 50.50,
   "confirmed_recurring": {
     "cancel_future": false
   }
}
  • set cancel_future to false if customer selected to cancel only this booing and keep future bookings, i.e. backend will create next recurring booking
  • set cancel_future to true if customer wants to cancel this and all future bookings, i.e. backend will not create next recurring booking (AND IMPORTANT: WILL NOT CANCEL ALREADY EXISTING NEXT RECURRING)

Example request:

For production, replace https://acme-sandbox.l27.co with https://<your subdomain>.launch27.com

Replace BEARER_FROM_LOGIN with bearer from Login

curl -H "Content-Type: application/json" \
     -H 'Authorization: Bearer BEARER_FROM_LOGIN' \
     -X POST -k \
     -d '{"confirmed_late": false, "reason": "booked by mistake"}' \
      https://acme-sandbox.l27.co/latest/customer/bookings/3/cancel

If you want to test example, please first create booking (see Create booking as non-logged-in or Create booking for customer), than use id from response to cancel booking.

Response

  • 200 OK with empty body on success on success.
  • 401 Unauthorized on login failure.
  • 422 on JSON schema errors or validation errors.

Updated