$bookingsApi = $client->getBookingsApi();
BookingsApi
- List Bookings
- Create Booking
- Search Availability
- Bulk Retrieve Bookings
- Retrieve Business Booking Profile
- List Location Booking Profiles
- Retrieve Location Booking Profile
- List Team Member Booking Profiles
- Bulk Retrieve Team Member Booking Profiles
- Retrieve Team Member Booking Profile
- Retrieve Booking
- Update Booking
- Cancel Booking
Retrieve a collection of bookings.
To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ
for the OAuth scope.
To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ
and APPOINTMENTS_READ
for the OAuth scope.
function listBookings(
?int $limit = null,
?string $cursor = null,
?string $customerId = null,
?string $teamMemberId = null,
?string $locationId = null,
?string $startAtMin = null,
?string $startAtMax = null
): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
limit |
?int |
Query, Optional | The maximum number of results per page to return in a paged response. |
cursor |
?string |
Query, Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. |
customerId |
?string |
Query, Optional | The customer for whom to retrieve bookings. If this is not set, bookings for all customers are retrieved. |
teamMemberId |
?string |
Query, Optional | The team member for whom to retrieve bookings. If this is not set, bookings of all members are retrieved. |
locationId |
?string |
Query, Optional | The location for which to retrieve bookings. If this is not set, all locations' bookings are retrieved. |
startAtMin |
?string |
Query, Optional | The RFC 3339 timestamp specifying the earliest of the start time. If this is not set, the current time is used. |
startAtMax |
?string |
Query, Optional | The RFC 3339 timestamp specifying the latest of the start time. If this is not set, the time of 31 days after start_at_min is used. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type ListBookingsResponse
.
$apiResponse = $bookingsApi->listBookings();
if ($apiResponse->isSuccess()) {
$listBookingsResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Creates a booking.
The required input must include the following:
Booking.location_id
Booking.start_at
Booking.AppointmentSegment.team_member_id
Booking.AppointmentSegment.service_variation_id
Booking.AppointmentSegment.service_variation_version
To call this endpoint with buyer-level permissions, set APPOINTMENTS_WRITE
for the OAuth scope.
To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_WRITE
and APPOINTMENTS_WRITE
for the OAuth scope.
For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
function createBooking(CreateBookingRequest $body): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreateBookingRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type CreateBookingResponse
.
$body = CreateBookingRequestBuilder::init(
BookingBuilder::init()->build()
)->build();
$apiResponse = $bookingsApi->createBooking($body);
if ($apiResponse->isSuccess()) {
$createBookingResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Searches for availabilities for booking.
To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ
for the OAuth scope.
To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ
and APPOINTMENTS_READ
for the OAuth scope.
function searchAvailability(SearchAvailabilityRequest $body): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
body |
SearchAvailabilityRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type SearchAvailabilityResponse
.
$body = SearchAvailabilityRequestBuilder::init(
SearchAvailabilityQueryBuilder::init(
SearchAvailabilityFilterBuilder::init(
TimeRangeBuilder::init()->build()
)->build()
)->build()
)->build();
$apiResponse = $bookingsApi->searchAvailability($body);
if ($apiResponse->isSuccess()) {
$searchAvailabilityResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Bulk-Retrieves a list of bookings by booking IDs.
To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ
for the OAuth scope.
To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ
and APPOINTMENTS_READ
for the OAuth scope.
function bulkRetrieveBookings(BulkRetrieveBookingsRequest $body): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
body |
BulkRetrieveBookingsRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type BulkRetrieveBookingsResponse
.
$body = BulkRetrieveBookingsRequestBuilder::init(
[
'booking_ids8',
'booking_ids9',
'booking_ids0'
]
)->build();
$apiResponse = $bookingsApi->bulkRetrieveBookings($body);
if ($apiResponse->isSuccess()) {
$bulkRetrieveBookingsResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Retrieves a seller's booking profile.
function retrieveBusinessBookingProfile(): ApiResponse
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type RetrieveBusinessBookingProfileResponse
.
$apiResponse = $bookingsApi->retrieveBusinessBookingProfile();
if ($apiResponse->isSuccess()) {
$retrieveBusinessBookingProfileResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Lists location booking profiles of a seller.
function listLocationBookingProfiles(?int $limit = null, ?string $cursor = null): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
limit |
?int |
Query, Optional | The maximum number of results to return in a paged response. |
cursor |
?string |
Query, Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type ListLocationBookingProfilesResponse
.
$apiResponse = $bookingsApi->listLocationBookingProfiles();
if ($apiResponse->isSuccess()) {
$listLocationBookingProfilesResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Retrieves a seller's location booking profile.
function retrieveLocationBookingProfile(string $locationId): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
locationId |
string |
Template, Required | The ID of the location to retrieve the booking profile. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type RetrieveLocationBookingProfileResponse
.
$locationId = 'location_id4';
$apiResponse = $bookingsApi->retrieveLocationBookingProfile($locationId);
if ($apiResponse->isSuccess()) {
$retrieveLocationBookingProfileResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Lists booking profiles for team members.
function listTeamMemberBookingProfiles(
?bool $bookableOnly = false,
?int $limit = null,
?string $cursor = null,
?string $locationId = null
): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
bookableOnly |
?bool |
Query, Optional | Indicates whether to include only bookable team members in the returned result (true ) or not (false ).Default: false |
limit |
?int |
Query, Optional | The maximum number of results to return in a paged response. |
cursor |
?string |
Query, Optional | The pagination cursor from the preceding response to return the next page of the results. Do not set this when retrieving the first page of the results. |
locationId |
?string |
Query, Optional | Indicates whether to include only team members enabled at the given location in the returned result. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type ListTeamMemberBookingProfilesResponse
.
$bookableOnly = false;
$apiResponse = $bookingsApi->listTeamMemberBookingProfiles($bookableOnly);
if ($apiResponse->isSuccess()) {
$listTeamMemberBookingProfilesResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Retrieves one or more team members' booking profiles.
function bulkRetrieveTeamMemberBookingProfiles(BulkRetrieveTeamMemberBookingProfilesRequest $body): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
body |
BulkRetrieveTeamMemberBookingProfilesRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type BulkRetrieveTeamMemberBookingProfilesResponse
.
$body = BulkRetrieveTeamMemberBookingProfilesRequestBuilder::init(
[
'team_member_ids3',
'team_member_ids4',
'team_member_ids5'
]
)->build();
$apiResponse = $bookingsApi->bulkRetrieveTeamMemberBookingProfiles($body);
if ($apiResponse->isSuccess()) {
$bulkRetrieveTeamMemberBookingProfilesResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Retrieves a team member's booking profile.
function retrieveTeamMemberBookingProfile(string $teamMemberId): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
teamMemberId |
string |
Template, Required | The ID of the team member to retrieve. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type RetrieveTeamMemberBookingProfileResponse
.
$teamMemberId = 'team_member_id0';
$apiResponse = $bookingsApi->retrieveTeamMemberBookingProfile($teamMemberId);
if ($apiResponse->isSuccess()) {
$retrieveTeamMemberBookingProfileResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Retrieves a booking.
To call this endpoint with buyer-level permissions, set APPOINTMENTS_READ
for the OAuth scope.
To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_READ
and APPOINTMENTS_READ
for the OAuth scope.
function retrieveBooking(string $bookingId): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
bookingId |
string |
Template, Required | The ID of the Booking object representing the to-be-retrieved booking. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type RetrieveBookingResponse
.
$bookingId = 'booking_id4';
$apiResponse = $bookingsApi->retrieveBooking($bookingId);
if ($apiResponse->isSuccess()) {
$retrieveBookingResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Updates a booking.
To call this endpoint with buyer-level permissions, set APPOINTMENTS_WRITE
for the OAuth scope.
To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_WRITE
and APPOINTMENTS_WRITE
for the OAuth scope.
For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
function updateBooking(string $bookingId, UpdateBookingRequest $body): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
bookingId |
string |
Template, Required | The ID of the Booking object representing the to-be-updated booking. |
body |
UpdateBookingRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type UpdateBookingResponse
.
$bookingId = 'booking_id4';
$body = UpdateBookingRequestBuilder::init(
BookingBuilder::init()->build()
)->build();
$apiResponse = $bookingsApi->updateBooking(
$bookingId,
$body
);
if ($apiResponse->isSuccess()) {
$updateBookingResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());
Cancels an existing booking.
To call this endpoint with buyer-level permissions, set APPOINTMENTS_WRITE
for the OAuth scope.
To call this endpoint with seller-level permissions, set APPOINTMENTS_ALL_WRITE
and APPOINTMENTS_WRITE
for the OAuth scope.
For calls to this endpoint with seller-level permissions to succeed, the seller must have subscribed to Appointments Plus or Appointments Premium.
function cancelBooking(string $bookingId, CancelBookingRequest $body): ApiResponse
Parameter | Type | Tags | Description |
---|---|---|---|
bookingId |
string |
Template, Required | The ID of the Booking object representing the to-be-cancelled booking. |
body |
CancelBookingRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
This method returns a Square\Utils\ApiResponse
instance. The getResult()
method on this instance returns the response data which is of type CancelBookingResponse
.
$bookingId = 'booking_id4';
$body = CancelBookingRequestBuilder::init()->build();
$apiResponse = $bookingsApi->cancelBooking(
$bookingId,
$body
);
if ($apiResponse->isSuccess()) {
$cancelBookingResponse = $apiResponse->getResult();
} else {
$errors = $apiResponse->getErrors();
}
// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());