SquareConnect\CustomerGroupsApi

April 22, 2020 · View on GitHub

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

MethodHTTP requestDescription
createCustomerGroupPOST /v2/customers/groupsCreateCustomerGroup
deleteCustomerGroupDELETE /v2/customers/groups/{group_id}DeleteCustomerGroup
listCustomerGroupsGET /v2/customers/groupsListCustomerGroups
retrieveCustomerGroupGET /v2/customers/groups/{group_id}RetrieveCustomerGroup
updateCustomerGroupPUT /v2/customers/groups/{group_id}UpdateCustomerGroup

createCustomerGroup

Note: This endpoint is in beta.

\SquareConnect\Model\CreateCustomerGroupResponse createCustomerGroup($body)

CreateCustomerGroup

Creates a new customer group for a business. The request must include the name value of the group.

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\CustomerGroupsApi();
$body = new \SquareConnect\Model\CreateCustomerGroupRequest(); // \SquareConnect\Model\CreateCustomerGroupRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

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

Parameters

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

Return type

\SquareConnect\Model\CreateCustomerGroupResponse

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]

deleteCustomerGroup

Note: This endpoint is in beta.

\SquareConnect\Model\DeleteCustomerGroupResponse deleteCustomerGroup($group_id)

DeleteCustomerGroup

Deletes a customer group as identified by the group_id value.

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\CustomerGroupsApi();
$group_id = "group_id_example"; // string | The ID of the customer group to delete.

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

Parameters

NameTypeDescriptionNotes
group_idstringThe ID of the customer group to delete.

Return type

\SquareConnect\Model\DeleteCustomerGroupResponse

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]

listCustomerGroups

Note: This endpoint is in beta.

\SquareConnect\Model\ListCustomerGroupsResponse listCustomerGroups($cursor)

ListCustomerGroups

Retrieves the list of customer groups of a business.

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\CustomerGroupsApi();
$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 the [Pagination guide](https://developer.squareup.com/docs/working-with-apis/pagination) for more information.

try {
    $result = $apiInstance->listCustomerGroups($cursor);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CustomerGroupsApi->listCustomerGroups: ', $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 the Pagination guide for more information.[optional]

Return type

\SquareConnect\Model\ListCustomerGroupsResponse

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]

retrieveCustomerGroup

Note: This endpoint is in beta.

\SquareConnect\Model\RetrieveCustomerGroupResponse retrieveCustomerGroup($group_id)

RetrieveCustomerGroup

Retrieves a specific customer group as identified by the group_id value.

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\CustomerGroupsApi();
$group_id = "group_id_example"; // string | The ID of the customer group to retrieve.

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

Parameters

NameTypeDescriptionNotes
group_idstringThe ID of the customer group to retrieve.

Return type

\SquareConnect\Model\RetrieveCustomerGroupResponse

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]

updateCustomerGroup

Note: This endpoint is in beta.

\SquareConnect\Model\UpdateCustomerGroupResponse updateCustomerGroup(groupid,group_id, body)

UpdateCustomerGroup

Updates a customer group as identified by the group_id value.

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\CustomerGroupsApi();
$group_id = "group_id_example"; // string | The ID of the customer group to update.
$body = new \SquareConnect\Model\UpdateCustomerGroupRequest(); // \SquareConnect\Model\UpdateCustomerGroupRequest | An object containing the fields to POST for the request.  See the corresponding object definition for field details.

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

Parameters

NameTypeDescriptionNotes
group_idstringThe ID of the customer group to update.
body\SquareConnect\Model\UpdateCustomerGroupRequestAn object containing the fields to POST for the request. See the corresponding object definition for field details.

Return type

\SquareConnect\Model\UpdateCustomerGroupResponse

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]