Skip to content

Latest commit

 

History

History
160 lines (113 loc) · 4.86 KB

cash-drawers.md

File metadata and controls

160 lines (113 loc) · 4.86 KB

Cash Drawers

$cashDrawersApi = $client->getCashDrawersApi();

Class Name

CashDrawersApi

Methods

List Cash Drawer Shifts

Provides the details for all of the cash drawer shifts for a location in a date range.

function listCashDrawerShifts(
    string $locationId,
    ?string $sortOrder = null,
    ?string $beginTime = null,
    ?string $endTime = null,
    ?int $limit = null,
    ?string $cursor = null
): ApiResponse

Parameters

Parameter Type Tags Description
locationId string Query, Required The ID of the location to query for a list of cash drawer shifts.
sortOrder ?string(SortOrder) Query, Optional The order in which cash drawer shifts are listed in the response,
based on their opened_at field. Default value: ASC
beginTime ?string Query, Optional The inclusive start time of the query on opened_at, in ISO 8601 format.
endTime ?string Query, Optional The exclusive end date of the query on opened_at, in ISO 8601 format.
limit ?int Query, Optional Number of cash drawer shift events in a page of results (200 by
default, 1000 max).
cursor ?string Query, Optional Opaque cursor for fetching the next page of results.

Response Type

This method returns a Square\Utils\ApiResponse instance. The getResult() method on this instance returns the response data which is of type ListCashDrawerShiftsResponse.

Example Usage

$locationId = 'location_id4';

$apiResponse = $cashDrawersApi->listCashDrawerShifts($locationId);

if ($apiResponse->isSuccess()) {
    $listCashDrawerShiftsResponse = $apiResponse->getResult();
} else {
    $errors = $apiResponse->getErrors();
}

// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());

Retrieve Cash Drawer Shift

Provides the summary details for a single cash drawer shift. See ListCashDrawerShiftEvents for a list of cash drawer shift events.

function retrieveCashDrawerShift(string $locationId, string $shiftId): ApiResponse

Parameters

Parameter Type Tags Description
locationId string Query, Required The ID of the location to retrieve cash drawer shifts from.
shiftId string Template, Required The shift ID.

Response Type

This method returns a Square\Utils\ApiResponse instance. The getResult() method on this instance returns the response data which is of type RetrieveCashDrawerShiftResponse.

Example Usage

$locationId = 'location_id4';

$shiftId = 'shift_id0';

$apiResponse = $cashDrawersApi->retrieveCashDrawerShift(
    $locationId,
    $shiftId
);

if ($apiResponse->isSuccess()) {
    $retrieveCashDrawerShiftResponse = $apiResponse->getResult();
} else {
    $errors = $apiResponse->getErrors();
}

// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());

List Cash Drawer Shift Events

Provides a paginated list of events for a single cash drawer shift.

function listCashDrawerShiftEvents(
    string $locationId,
    string $shiftId,
    ?int $limit = null,
    ?string $cursor = null
): ApiResponse

Parameters

Parameter Type Tags Description
locationId string Query, Required The ID of the location to list cash drawer shifts for.
shiftId string Template, Required The shift ID.
limit ?int Query, Optional Number of resources to be returned in a page of results (200 by
default, 1000 max).
cursor ?string Query, Optional Opaque cursor for fetching the next page of results.

Response Type

This method returns a Square\Utils\ApiResponse instance. The getResult() method on this instance returns the response data which is of type ListCashDrawerShiftEventsResponse.

Example Usage

$locationId = 'location_id4';

$shiftId = 'shift_id0';

$apiResponse = $cashDrawersApi->listCashDrawerShiftEvents(
    $locationId,
    $shiftId
);

if ($apiResponse->isSuccess()) {
    $listCashDrawerShiftEventsResponse = $apiResponse->getResult();
} else {
    $errors = $apiResponse->getErrors();
}

// Getting more response information
var_dump($apiResponse->getStatusCode());
var_dump($apiResponse->getHeaders());