Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Latest commit

 

History

History
260 lines (176 loc) · 9.18 KB

CustomerGroupsApi.md

File metadata and controls

260 lines (176 loc) · 9.18 KB

SquareConnect\CustomerGroupsApi

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

Method HTTP request Description
createCustomerGroup POST /v2/customers/groups CreateCustomerGroup
deleteCustomerGroup DELETE /v2/customers/groups/{group_id} DeleteCustomerGroup
listCustomerGroups GET /v2/customers/groups ListCustomerGroups
retrieveCustomerGroup GET /v2/customers/groups/{group_id} RetrieveCustomerGroup
updateCustomerGroup PUT /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

Name Type Description Notes
body \SquareConnect\Model\CreateCustomerGroupRequest An 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

Name Type Description Notes
group_id string The 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

Name Type Description Notes
cursor 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 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

Name Type Description Notes
group_id string The 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($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

Name Type Description Notes
group_id string The ID of the customer group to update.
body \SquareConnect\Model\UpdateCustomerGroupRequest An 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]