CustomerGroupsApi customerGroupsApi = client.getCustomerGroupsApi();
CustomerGroupsApi
- List Customer Groups
- Create Customer Group
- Delete Customer Group
- Retrieve Customer Group
- Update Customer Group
Retrieves the list of customer groups of a business.
CompletableFuture<ListCustomerGroupsResponse> listCustomerGroupsAsync(
final String cursor,
final Integer limit)
Parameter | Type | Tags | Description |
---|---|---|---|
cursor |
String |
Query, Optional | A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for your original query. For more information, see Pagination. |
limit |
Integer |
Query, Optional | The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results. If the limit is less than 1 or greater than 50, Square returns a 400 VALUE_TOO_LOW or 400 VALUE_TOO_HIGH error. The default value is 50.For more information, see Pagination. |
customerGroupsApi.listCustomerGroupsAsync(null, null).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});
Creates a new customer group for a business.
The request must include the name
value of the group.
CompletableFuture<CreateCustomerGroupResponse> createCustomerGroupAsync(
final CreateCustomerGroupRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreateCustomerGroupRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
CustomerGroup customerGroup = new CustomerGroup.Builder(
"Loyal Customers")
.build();
CreateCustomerGroupRequest body = new CreateCustomerGroupRequest.Builder(
group)
.build();
customerGroupsApi.createCustomerGroupAsync(body).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});
Deletes a customer group as identified by the group_id
value.
CompletableFuture<DeleteCustomerGroupResponse> deleteCustomerGroupAsync(
final String groupId)
Parameter | Type | Tags | Description |
---|---|---|---|
groupId |
String |
Template, Required | The ID of the customer group to delete. |
String groupId = "group_id0";
customerGroupsApi.deleteCustomerGroupAsync(groupId).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});
Retrieves a specific customer group as identified by the group_id
value.
CompletableFuture<RetrieveCustomerGroupResponse> retrieveCustomerGroupAsync(
final String groupId)
Parameter | Type | Tags | Description |
---|---|---|---|
groupId |
String |
Template, Required | The ID of the customer group to retrieve. |
String groupId = "group_id0";
customerGroupsApi.retrieveCustomerGroupAsync(groupId).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});
Updates a customer group as identified by the group_id
value.
CompletableFuture<UpdateCustomerGroupResponse> updateCustomerGroupAsync(
final String groupId,
final UpdateCustomerGroupRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
groupId |
String |
Template, Required | The ID of the customer group to update. |
body |
UpdateCustomerGroupRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
String groupId = "group_id0";
CustomerGroup customerGroup = new CustomerGroup.Builder(
"Loyal Customers")
.build();
UpdateCustomerGroupRequest body = new UpdateCustomerGroupRequest.Builder(
group)
.build();
customerGroupsApi.updateCustomerGroupAsync(groupId, body).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});