Content Management / Affiliate

An affiliate usually provides a way for guests to search for availability, but leaves the checkout and financial administration to BEX.

An affiliate is usually responsible for the following actions:

  • Creating a channel in Booking Experts
  • Fetching availability
  • Creating CheckoutPortal Reservations
  • Redirecting the customer to the CheckoutPortal

Relevant permissions

An affiliate will usually need the following permissions:

  • availability|read
  • channel|write
  • rentable_type:read
  • checkout_portal:manage

Creating a channel

Channels in Booking Experts are used to track the origin of reservations. Administrations can also create custom prices and Costs for channels.

To create a channel, you will need the channel|write permission. Please see the POST channels endpoint for more information. An example can be seen below.

{
  "data": {
    "type": "channel",
    "attributes": {
      "name": "Reseller.com",
      "kind": "reseller",
      "available_currencies": ["EUR"]
    }
  }
}

Fetching availability

For fetching availability, use the GET availabilities endpoint. It is possible to do live queries to this endpoint, but you can also cache the results if desired. Besides price and availability, this will also return the rent price, original price and discount price. It also returns the expected check-in and check-out time of reservations. You will need the availability|read permission to be able to access this endpoint.


Creating CheckoutPortal Reservations

Use the POST checkout_portal_reservation endpoint to create a CheckoutPortal Reservation. A reservation must at least contain a period (start_date, end_date), an accommodation (rentable_type) and a guest group (guest_group). You will need the checkout_portal|managepermission for this.

Here is an example request:

{
  "data": {
    "type": "checkout_portal_reservation",
    "attributes": {
      "start_date": "2014-01-08",
      "end_date": "2014-01-15",
      "guest_group": {
        "seniors": 0,
        "adults": 2,
        "adolescents": 0,
        "children": 2,
        "babies": 0,
        "pets": 0
      }
    },
    "relationships": {
      "rentable_type": {
        "data": {
          "id": "1",
          "type": "rentable_type"
        }
      },
      "checkout_portal_booking": {
        "data": {
          "type": "checkout_portal_booking",
          "meta": {
            "temp_id": "checkout_portal_booking-id",
            "method": "create"
          }
        }
      }
    }
  },
  "included": [{
    "type": "checkout_portal_booking",
    "attributes": {
      "locale": "nl",
      "currency": "EUR"
    },
    "meta": {
      "temp_id": "checkout_portal_booking-id"
    }
  }]
}

When creating a reservation, be sure to include the checkout_portal_booking in the response. When a CheckoutPortal Reservation has successfully been created, the included CheckoutPortal Booking will include the checkout_portal_url to which the customer should be redirected:

{
  "data": {
    "id": "1",
    "type": "checkout_portal_reservation",
    "attributes": {
      "start_date": "2014-01-08",
      "end_date": "2014-01-15",
      "guest_group": {
        "seniors": 0,
        "adults": 2,
        "adolescents": 0,
        "children": 2,
        "babies": 0,
        "pets": 0
      },
      "total": {
        "currency": "EUR",
        "value": "70.40"
      },
      "deposit": {
        "currency": "EUR",
        "value": "0.00"
      },
      "created_at": "2014-01-01T12:00:00.000+01:00",
      "updated_at": "2014-01-01T12:00:00.000+01:00"
    },
    "relationships": {
      "checkout_portal_booking": {
        "data": {
          "id": "1",
          "type": "checkout_portal_booking"
        }
      },
      "rentable_type": {
        "data": {
          "id": "1",
          "type": "rentable_type"
        }
      }
    }
  },
  "included": [
    {
      "id": "1",
      "type": "checkout_portal_booking",
      "attributes": {
        "locale": "nl",
        "currency": "EUR",
        "is_option": false,
        "created_at": "2014-01-01T12:00:00.000+01:00",
        "updated_at": "2014-01-01T12:00:00.000+01:00",
        "total": {
          "currency": "EUR",
          "value": "70.40"
        },
        "deposit": {
          "currency": "EUR",
          "value": "0.00"
        }
      },
      "relationships": {
        "checkout_portal_reservations": {
          "data": [
            {
              "id": "1",
              "type": "checkout_portal_reservation"
            }
          ]
        }
      },
      "links": {
        "checkout_portal_url": "https://app.bookingexperts.nl/checkout/9SvysSrmgK7HYsM4mAanTqN7/reservations/1/stay"
      }
    }
  ]
}