Пређи на садржај

Cart checkout

Perform a booking of one or more items by providing a cart object. This endpoint accepts the same parameters as the /book endpoint, but instead of a single product, an array of items can be provided. Each item in the cart should have a product, interval, occupancy and form values. If the booking is successful, a reference and booking ID will be returned for each item in the cart. If a payment URL is included in the response, the user should be redirected to that URL to complete the booking.

Parameters

currencyCurrency | null

The currency to use for the booking. Defaults to the product's currency. See the widget docs for the allowed values.

failure_urlstring

The URL to redirect the user to when a booking payment fails. Defaults to the booking page.

languageLanguage

The user's preferred language.

redirect_urlstring | null

The URL to redirect the user to after the booking is completed.

show_pending_as"CONFIRMED" | "TENTATIVE" | "CANCELLED"

How to interpret pending events when checking availability. Defaults to TENTATIVE

Body

coupon_codesrequiredArray<string>

The coupon codes entered for the bookings in the cart.

itemsrequiredArray<CartItem>

The items to book. Each item has a product, interval, occupancy and form values, and a client-side id to match results to items.

Responses

201

Information identifying the booking. If a payment URL is set, the user should be redirected to that URL to complete the booking.

TypeScript
{
  booking_id: uuid;
  payment_expiry_timestamp: number | null;
  payment_url: string | null;
  reference: string;
  secret: string;
}
POST /cart-checkout
curl -X POST "https://api.bookingmood.com/v1/cart-checkout?currency=USD&failure_url=https:%2F%2Fexample.com%2Fbooking-failed&language=en-US&redirect_url=https:%2F%2Fexample.com%2Fbooking-success&show_pending_as=TENTATIVE" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "coupon_codes": [
      "SUMMER21"
    ],
    "items": [
      {
        "form_values": {
          "00000000-0000-0000-0000-000000000000": {
            "first_name": "John",
            "last_name": "Doe"
          },
          "00000000-0000-0000-0000-000000000001": {
            "city": "Anytown",
            "country": "US",
            "street": "123 Main St",
            "zip": "12345"
          },
          "00000000-0000-0000-0000-000000000002": "value"
        },
        "interval": {
          "start": "2026-10-30",
          "end": "2026-11-03"
        },
        "id": "00000000-0000-0000-0000-000000000000",
        "occupancy": {
          "00000000-0000-0000-0000-000000000000": 1
        },
        "product_id": "00000000-0000-0000-0000-000000000000"
      }
    ]
  }'
Example response
JSON
{
  "booking_id": "00000000-0000-0000-0000-000000000000",
  "payment_url": null,
  "reference": "ABC123",
  "secret": "SECRET"
}

Преузмите контролу над својим резервацијама. Изградите свој посао.

Придружите се 1200+ независним компанијама за изнајмљивање смештаја користећи Bookingmood како бисте повећали број директних резервација и изградили јаче односе са гостима.

Започните бесплатну пробну верзију од 14 дана