SquareConnect\DevicesApi

April 22, 2020 ยท View on GitHub

All URIs are relative to https://connect.squareup.com

MethodHTTP requestDescription
createDeviceCodePOST /v2/devices/codesCreateDeviceCode
getDeviceCodeGET /v2/devices/codes/{id}GetDeviceCode
listDeviceCodesGET /v2/devices/codesListDeviceCodes

createDeviceCode

Note: This endpoint is in beta.

\SquareConnect\Model\CreateDeviceCodeResponse createDeviceCode($body)

CreateDeviceCode

Creates a DeviceCode that can be used to login to a Square Terminal device to enter the connected terminal mode.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\DevicesApi();
$body = new \SquareConnect\Model\CreateDeviceCodeRequest(); // \SquareConnect\Model\CreateDeviceCodeRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

try {
    $result = $apiInstance->createDeviceCode($body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DevicesApi->createDeviceCode: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
body\SquareConnect\Model\CreateDeviceCodeRequestAn object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

\SquareConnect\Model\CreateDeviceCodeResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

getDeviceCode

Note: This endpoint is in beta.

\SquareConnect\Model\GetDeviceCodeResponse getDeviceCode($id)

GetDeviceCode

Retrieves DeviceCode with the associated ID.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\DevicesApi();
$id = "id_example"; // string | The unique identifier for the device code.

try {
    $result = $apiInstance->getDeviceCode($id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DevicesApi->getDeviceCode: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
idstringThe unique identifier for the device code.

Return type

\SquareConnect\Model\GetDeviceCodeResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

listDeviceCodes

Note: This endpoint is in beta.

\SquareConnect\Model\ListDeviceCodesResponse listDeviceCodes(cursor,cursor, location_id, $product_type)

ListDeviceCodes

Lists all DeviceCodes associated with the merchant.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure OAuth2 access token for authorization: oauth2
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');

$apiInstance = new SquareConnect\Api\DevicesApi();
$cursor = "cursor_example"; // string | A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query.  See [Paginating results](#paginatingresults) for more information.
$location_id = "location_id_example"; // string | If specified, only returns DeviceCodes of the specified location. Returns DeviceCodes of all locations if empty.
$product_type = "product_type_example"; // string | If specified, only returns DeviceCodes targeting the specified product type. Returns DeviceCodes of all product types if empty.

try {
    $result = $apiInstance->listDeviceCodes($cursor, $location_id, $product_type);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DevicesApi->listDeviceCodes: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

NameTypeDescriptionNotes
cursorstringA pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See Paginating results for more information.[optional]
location_idstringIf specified, only returns DeviceCodes of the specified location. Returns DeviceCodes of all locations if empty.[optional]
product_typestringIf specified, only returns DeviceCodes targeting the specified product type. Returns DeviceCodes of all product types if empty.[optional]

Return type

\SquareConnect\Model\ListDeviceCodesResponse

Authorization

oauth2

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]