---
title: "Customer service methods"
slug: "customer-service-methods"
abstract: ""
---
# Customer service methods

Service providers are wrapper objects designed to make it easier to interact with Connect pipelines. The providers implement no logic other than calling pipelines. All of the business logic is implemented in the pipeline processors.

For each method there is a corresponding Request and Result object returned, for example, CreateUser takes a CreateUserRequest object and returns a CreateUserResult object.

The Customer service provider contains the following methods for interacting with customer and user data.

<details>
<summary><h2>CreateUser method</h2></summary>

| **Name:** | CreateUser |
| --- | --- |
| **Description:** | Creates a user account by which the user can re-authenticate themselves upon return.<br><br>By default the account is disabled until it has be confirmed by the visitor to be a valid request and `ActivateUserAccount` has been called.<br><br>Calls the `CreateUser` pipeline. |
| **Usage:** | Called from Sitecore when a visitor is registering for an account. It could be during the checkout process or through plain signup. |
| **Signature:** | `CreateUserResult CreateUser(CreateUserRequest request)` |
| **Input:** |  |
|  | **Username – string. Mandatory**<br><br>The user name for the new user. |
|  | **Email – string. Mandatory**<br><br>The e-mail address for the new user. |
|  | **Password – string. Mandatory**<br><br>The password for the new user. |
|  | **Shops– Mandatory**<br><br>An instance of the CommerceUser object is parsed in. Mandatory fields: **Username**, **Email**, **Shops**. |
| **Output:** |  |
|  | **User –** An instance of the user object is returned. The user object is updated by the external commerce system by supplying the External ID value. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```

var customerService = new CustomerServiceProvider();
var request = new CreateUserRequest("JohnSmith", "password", "john@abczyx.net", "webstore");
var result = customerService.CreateUser(request);

```

</details>

<details>
<summary><h2>UpdateUser method</h2></summary>

| **Name:** | UpdateUser |
| --- | --- |
| **Description:** | Updates an existing user account. Calls the `UpdateUser `pipeline. |
| **Usage:** | Called from Sitecore when a visitor wants to update the information stored on the account. |
| **Signature:** | `UpdateUserResult UpdateUser(UpdateUserRequest request)` |
| **Input:** |  |
|  | **CommerceUser –**An instance of the modified CommerceUser object is passed in. |
| **Output:** |  |
|  | **User –** An instance of the user object is returned. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```

var customerService = new CustomerServiceProvider();
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "john@abczyx.net", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
user.FirstName = "John";
// update the user
var updateRequest = new UpdateUserRequest(user);
var result = customerService.UpdateUser(updateRequest);

```

</details>

<details>
<summary><h2>DeleteUser method</h2></summary>

| **Name:** | DeleteUser |
| --- | --- |
| **Description:** | Deletes a user account.<br><br>Calls the `DeleteUser` pipeline. |
| **Usage:** | Called from Sitecore when the shop owner wants to delete an account.<br><br>It is a solution business decision whether the account is actually deleted or simply disabled. |
| **Signature:** | `DeleteUserResult DeleteUser(DeleteUserRequest request)` |
| **Input:** |  |
|  | **CommerceUser –**An instance of the CommerceUser object is parsed in |
| **Output:** |  |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```

var customerService = new CustomerServiceProvider();
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "john@abczyx.net", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
// delete the user
var deleteRequest = new DeleteUserRequest(user);
var result = customerService.DeleteUser(deleteRequest);

```

</details>

<details>
<summary><h2>DisableUser method</h2></summary>

| **Name:** | DisableUser |
| --- | --- |
| **Description:** | Disables a user account. Calls the `DisableUser `pipeline. |
| **Usage:** | Called from Sitecore when the user account should be disabled. |
| **Signature:** | `DisableUserResult DisableUser(DisableUserRequest request)` |
| **Input:** |  |
|  | **CommerceUser – Mandatory**<br><br>An instance of the user object is parsed in. |
|  | **Comment – Optional**<br><br>An optional string that can explain why the user account was disabled. Will be put in the Page Event as an explanation. |
| **Output:** |  |
|  | **CommerceUser –**The disabled CommerceUser entity. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```

var customerService = new CustomerServiceProvider();
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "john@abczyx.net", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
// disable the user
var disableRequest = new DisableUserRequest(user);
var disableResult = customerService.DisableUser(disableRequest);
// enable the user
var enableRequest = new EnableUserRequest(user);
var enableResult = customerService.EnableUser(enableRequest);

```

</details>

<details>
<summary><h2>EnableUser method</h2></summary>

| **Name:** | EnableUser |
| --- | --- |
| **Description:** | Enables a user account. Calls the `EnableUser` pipeline.<br><br>A user account can be disabled for different reasons and triggered by the shop owner or visitor.<br><br>When a user account is disabled it must be possible to enable it again, which is the purpose of this method.<br><br>The method seems similar to the `ActivateUserAccount` method because they both enable the account. The difference lies in the usage scenario and possible actions associated.<br><br>The `EnableUser` method is a generic method whereas the `UserAccountActivation` method is used in a specific scenario when a new account is created and must be validated and then activated. The two trigger different page events. |
| **Usage:** | Called from Sitecore when the user account should be enabled. |
| **Signature:** | `EnableUserResult EnableUser(EnableUserRequest request)` |
| **Input:** |  |
|  | **CommerceUser – Mandatory**<br><br>An instance of the user object is parsed in. |
|  | **Comment – Optional**<br><br>An optional string that can explain why the user account was enabled. Will be put in the Page Event as an explanation. |
| **Output:** |  |
|  | **CommerceUser –**The enabled CommerceUser entity. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```

var customerService = new CustomerServiceProvider();
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "john@abczyx.net", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
// disable the user
var disableRequest = new DisableUserRequest(user);
var disableResult = customerService.DisableUser(disableRequest);
// enable the user
var enableRequest = new EnableUserRequest(user);
var enableResult = customerService.EnableUser(enableRequest);

```

</details>

<details>
<summary><h2>GetUser method</h2></summary>

| **Name:** | GetUser |
| --- | --- |
| **Description:** | Returns a single user account. Calls the `GetUser` pipeline. |
| **Usage:** | Called from Sitecore when searching for one or more accounts. |
| **Signature:** | `GetUserResult GetUser(GetUserRequest request)` |
| **Input:** |  |
|  | **ShopName –**Mandatory. |
|  | **UserName –**Mandatory.<br><br>The ID of the user to retrieve. |
| **Output:** |  |
|  | **User –**A single instance of a User. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```

var customerService = new CustomerServiceProvider();
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "john@abczyx.net", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
var getRequest = new GetUserRequest("JohnSmith");
var result = customerService.GetUser(getRequest);

```

</details>

<details>
<summary><h2>GetUsers method</h2></summary>

| **Name:** | GetUsers |
| --- | --- |
| **Description:** | Queries and returns user accounts. Calls the `GetUsers` pipeline.<br><br>Different input parameters can be provided and they will be combined using logical *and**.* |
| **Usage:** | Called from Sitecore when searching for one or more accounts. |
| **Signature:** | `GetUsersResult GetUsers(GetUsersRequest request)` |
| **Input:** |  |
|  | **ExternalIDs –**Optional.<br><br>Can be a single or a list of IDs. When provided, it takes precedence. |
|  | **SitecoreIDs –**Optional.<br><br>Can be a single or a list of IDs. |
|  | **UserName –**Optional. |
|  | **Email –**Optional. |
|  | **ExternalCustomerIDs –**Optional.<br><br>Can be a single or a list of IDs. Used when looking for users associated with a given customer. |
|  | **Disabled -**Optional. |
|  | **ShopName –**Optional. |
| **Output:** |  |
|  | **List<User>** |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```

var customerService = new CustomerServiceProvider();
// create some users
var request = new CreateUserRequest("JohnSmith", "password", "john@abczyx.net", "webstore");
var result = customerService.CreateUser(request);
request = new CreateUserRequest("JaneSmith", "passWord", "jane@jane.net", "webstore");
result = customerService.CreateUser(request);
request = new CreateUserRequest("Rob", "abcdefghij", "r@r.com", "webstore");
result = customerService.CreateUser(request);

var getRequest = new GetUsersRequest(new UserSearchCriteria { ShopName = "webstore" });
var getResult = customerService.GetUsers(getRequest);
Sitecore.Diagnostics.Assert.AreEqual(3, getResult.CommerceUsers.Count, "should have a count of 3");

getRequest = new GetUsersRequest(new UserSearchCriteria { UserName = "JohnSmith" });
getResult = customerService.GetUsers(getRequest);
Sitecore.Diagnostics.Assert.AreEqual(1, getResult.CommerceUsers.Count, "should have a count of 1");

```

</details>

<details>
<summary><h2>AddUsers method</h2></summary>

| **Name:** | AddUsers |
| --- | --- |
| **Description:** | Add a user to a customer. Calls the `AddUsers` pipeline. |
| **Usage:** | Called to associate a user to a visitor. |
| **Signature:** | `AddUsersResult AddUsers(AddUsersRequest request)` |
| **Input:** |  |
|  | **List<string> UserIds –**The user IDs to add to the customer. |
| **Output:** |  |
|  | **IReadOnlyCollection<string> UserIds** – The list of user IDs associated with the customer. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "john@abczyx.net", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "autohaus" },
        ExternalId = "1234567890"
    })).CommerceCustomer;
// add the user to the customer
var addRequest = new AddUsersRequest(customer, new List<string> { user.ExternalId });
var addResult = customerService.AddUsers(addRequest);

```

</details>

<details>
<summary><h2>RemoveUsers method</h2></summary>

| **Name:** | RemoveUsers |
| --- | --- |
| **Description:** | Removes users from a customer. Calls the `RemoveUsers` pipeline. |
| **Usage:** | Called to remove an associated user to a visitor. |
| **Signature:** | `Remove UsersResult RemoveUsers( RemoveUsersRequest request)` |
| **Input:** |  |
|  | **List<string> UserIds –**The user IDs to remove from the customer. |
| **Output:** |  |
|  | **IReadOnlyCollection<string> UserIds** – The list of user IDs associated with the customer. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
// create 2 users
var request = new CreateUserRequest("JohnSmith", "password", "john@abczyx.net", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
request = new CreateUserRequest("JaneSmith", "passWord", "jane@jane.net", "webstore");
var user2 = customerService.CreateUser(request).CommerceUser;
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "autohaus" },
        ExternalId = "1234567890"
    })).CommerceCustomer;
// add the users to the customer
var addRequest = new AddUsersRequest(customer, new List<string> { user.ExternalId, user2.ExternalId });
var addResult = customerService.AddUsers(addRequest);
// remove a user
var removeRequest = new RemoveUsersRequest(customer, new List<string> { user.ExternalId });
var removeResult = customerService.RemoveUsers(removeRequest);

```

</details>

<details>
<summary><h2>CreateCustomer method</h2></summary>

| **Name:** | CreateCustomer |
| --- | --- |
| **Description:** | Creates a customer. Calls the `CreateCustomer` pipeline. |
| **Usage:** | Typically called when a visitor is going through the checkout process. |
| **Signature:** | `CreateCustomerResult CreateCustomer(CreateCustomerRequest request)` |
| **Input:** |  |
|  | **CommerceCustomer – Mandatory**<br><br>An instance of the CommerceCustomer object is parsed in.<br><br>Mandatory field values are: *Name* and *Shops***.** |
| **Output:** |  |
|  | **CommerceCustomer –** An instance of the customer object is returned. The customer object is updated by the external commerce system by supplying the External ID. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "autohaus" },
        IsDisabled = true,
        ExternalId = "Jeff",
        Users = new[] { "Jeff" }
    }));
customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Bob",
        Shops = new[] { "webstore" },
        IsDisabled = false,
        ExternalId = "Jeff",
        Users = new[] { "Bob" }
    }));

```

</details>

<details>
<summary><h2>UpdateCustomer method</h2></summary>

| **Name:** | UpdateCustomer |
| --- | --- |
| **Description:** | Updates an existing customer account. Calls the `UpdateCustomer` pipeline. |
| **Usage:** | Called from Sitecore when a visitor or shop owner wants to update the information stored on the customer account. |
| **Signature:** | `UpdateCustomerResult UpdateCustomer(UpdateCustomerRequest request)` |
| **Input:** |  |
|  | **CommerceCustomer –**An instance of the modified CommerceCustomer object is parsed in. |
| **Output:** |  |
|  | **CommerceCustomer –** An instance of the customer object is returned. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "autohaus" },
        IsDisabled = true,
        ExternalId = "Jeff",
        Users = new[] { "Jeff" }
    }));
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Bob",
        Shops = new[] { "webstore" },
        IsDisabled = false,
        ExternalId = "Jeff",
        Users = new[] { "Bob" }
    })).CommerceCustomer;
customer.IsDisabled = true;
customer.Name = "Bobby";
var request = new UpdateCustomerRequest(customer);
var result = customerService.UpdateCustomer(request);

```

</details>

<details>
<summary><h2>DisableCustomer method</h2></summary>

| **Name:** | DisableCustomer |
| --- | --- |
| **Description:** | Disables a customer account. Calls the `DisableCustomer` pipeline. |
| **Usage:** | Called from Sitecore when the customer account should be disabled. |
| **Signature:** | `DisableCustomerResult DisableCustomer(DisableCustomerRequest request)` |
| **Input:** |  |
|  | **CommerceCustomer – Mandatory**<br><br>An instance of the customer object is parsed in. |
|  | **Comment – Optional**<br><br>An optional string that can explain why the user account was disabled. Will be put in the Page Event as an explanation. |
|  |  |
| **Output:** |  |
|  | **CommerceCustomer –**The disabled customer. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Bob",
        Shops = new[] { "webstore" },
        IsDisabled = false,
        ExternalId = "Jeff",
        Users = new[] { "Bob" }
    })).CommerceCustomer;
var disableRequest = new DisableCustomerRequest(customer);
var disableResult = customerService.DisableCustomer(disableRequest);
var enableRequest = new EnableCustomerRequest(customer);
var enableResult = customerService.EnableCustomer(enableRequest);

```

</details>

<details>
<summary><h2>EnableCustomer method</h2></summary>

| **Name:** | EnableCustomer |
| --- | --- |
| **Description:** | Enables a customer account. Calls the `EnableCustomer` pipeline. |
| **Usage:** | Called from Sitecore when the customer account should be enabled. |
| **Signature:** | `EnableCustomerResult EnableCustomer(EnableCustomerRequest request)` |
| **Input:** |  |
|  | **CommerceCustomer – Mandatory**<br><br>An instance of the customer object is parsed in. |
|  | **Comment – Optional**<br><br>An optional string that can explain why the user account was enabled. Will be put in the Page Event as an explanation. |
|  |  |
| **Output:** |  |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Bob",
        Shops = new[] { "webstore" },
        IsDisabled = false,
        ExternalId = "Jeff",
        Users = new[] { "Bob" }
    })).CommerceCustomer;
var disableRequest = new DisableCustomerRequest(customer);
var disableResult = customerService.DisableCustomer(disableRequest);
var enableRequest = new EnableCustomerRequest(customer);
var enableResult = customerService.EnableCustomer(enableRequest);

```

</details>

<details>
<summary><h2>DeleteCustomer method</h2></summary>

| **Name:** | DeleteCustomer |
| --- | --- |
| **Description:** | Deletes a customer account.<br><br>Calls the `DeleteUser` pipeline. |
| **Usage:** | Called when an account should be deleted.<br><br>It is a solution business decision whether the account is actually deleted or simply disabled. |
| **Signature:** | `DeleteCustomerResult DeleteCustomer(DeleteCustomerRequest request)` |
| **Input:** |  |
|  | **CommerceCustomer –**An instance of the CommerceCustomer object is parsed in. |
| **Output:** |  |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Bob",
        Shops = new[] { "webstore" },
        IsDisabled = false,
        ExternalId = "Jeff",
        Users = new[] { "Bob" }
    })).CommerceCustomer;
var deleteRequest = new DeleteCustomerRequest(customer);
var deleteResult = customerService.DeleteCustomer(deleteRequest);

```

</details>

<details>
<summary><h2>GetCustomer method</h2></summary>

| **Name:** | GetCustomer |
| --- | --- |
| **Description:** | Returns a single customer instance. Calls the `GetCustomer` pipeline. |
| **Usage:** | Called from Sitecore when searching for an account. |
| **Signature:** | `GetCustomerResult GetCustomer(GetCustomerRequest request)` |
| **Input:** |  |
|  | **ShopName –**Mandatory. |
|  | **ExternalID –**Mandatory.<br><br>The unique ID of the customer in the given shop. |
| **Output:** |  |
|  | **CommerceCustomer –**An instance of the CommerceCustomer if it exists. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Bob",
        Shops = new[] { "webstore" },
        IsDisabled = false,
        ExternalId = "1234567890",
        Users = new[] { "Bob" }
    }));
var getRequest = new GetCustomerRequest("1234567890");
var result = customerService.GetCustomer(getRequest);

```

</details>

<details>
<summary><h2>GetCustomers method</h2></summary>

| **Name:** | GetCustomers |
| --- | --- |
| **Description:** | Queries and returns customer entities. Calls the `GetCustomers` pipeline.<br><br>Different input parameters can be provided and they will be combined using logical *and**.* |
| **Usage:** | Called from Sitecore when searching for an account. |
| **Signature:** | `GetCustomersResult GetCustomers(GetCustomersRequest request)` |
| **Input:** |  |
|  | **ExternalIDs –**Optional.<br><br>Can be a single or a list of IDs. When provided, it takes precedence. |
|  | **SitecoreIDs –**Optional.<br><br>Can be a single or a list of IDs. |
|  | **Name –**Optional |
|  | **ExternalUserIDs –**Optional.<br><br>Can be a single or a list of IDs. Used when looking for customers associated with a given user. |
|  | **Disabled –**Optional. |
|  | **ShopName –**Optional. |
| **Output:** |  |
|  | **List<CommerceCustomer>** |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "autohaus" },
        IsDisabled = true,
        ExternalId = "Jeff",
        Users = new[] { "Jeff" }
    }));
customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Bob",
        Shops = new[] { "webstore" },
        IsDisabled = false,
        ExternalId = "Jeff",
        Users = new[] { "Bob" }
    }));
customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Michael",
        Shops = new[] { "autohaus" },
        IsDisabled = false,
        ExternalId = "Michael",
        Users = new[] { "Michael" }
    }));
customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Kerry",
        Shops = new[] { "webstore" },
        IsDisabled = true,
        ExternalId = "Michael",
        Users = new[] { "Michael" }
    }));
var result = customerService.GetCustomers(new GetCustomersRequest(new CustomerSearchCriteria { IsDisabled = true }));
Sitecore.Diagnostics.Assert.AreEqual(2, result.CommerceCustomers.Count, "Should have 2 disabled");
result = customerService.GetCustomers(new GetCustomersRequest(new CustomerSearchCriteria { ExternalIDs = new[] { "Jeff" }, Name = "Bob" }));
Sitecore.Diagnostics.Assert.AreEqual(2, result.CommerceCustomers.Count, "Should have 1 match");

```

</details>

<details>
<summary><h2>AddCustomers method</h2></summary>

| **Name:** | AddCustomers |
| --- | --- |
| **Description:** | Add a customer to a user. Calls the `AddCustomers` pipeline. |
| **Usage:** | Called to associate a visitor to a user. |
| **Signature:** | `AddCustomersResult AddCustomers(AddCustomersRequest request)` |
| **Input:** |  |
|  | **List<string> CustomerIds –**The customer IDs to add to the user. |
| **Output:** |  |
|  | **IReadOnlyCollection<string> CustomerIds** – The list of customer IDs associated with the user. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
// create a customer
customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "autohaus" },
        ExternalId = "1234567890"
    }));
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "john@abczyx.net", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
// add the customer to the user
var addRequest = new AddCustomersRequest(user, new List<string> { "1234567890" });
var addResult = customerService.AddCustomers(addRequest);

```

</details>

<details>
<summary><h2>RemoveCustomers method</h2></summary>

| **Name:** | **RemoveCustomers** |
| --- | --- |
| **Description:** | Removes customers from a user. Calls the `RemoveCustomers` pipeline. |
| **Usage:** | Called to remove an associated visitor to a user. |
| **Signature:** | `RemoveCustomersResult RemoveCustomers(RemoveCustomersRequest request)` |
| **Input:** |  |
|  | **List<string> CustomerIds –**The customer IDs to remove from the user. |
| **Output:** |  |
|  | **IReadOnlyCollection<string> CustomerIds** – The list of customer IDs associated with the user. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
// create 2 customers
customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "webstore" },
        ExternalId = "1234567890"
    }));
customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Bob",
        Shops = new[] { "webstore" },
        ExternalId = "9876543210"
    }));
// create a user
var request = new CreateUserRequest("JohnSmith", "password", "john@abczyx.net", "webstore");
var user = customerService.CreateUser(request).CommerceUser;
// add the customers to the user
var addRequest = new AddCustomersRequest(user, new List<string> { "1234567890", "9876543210" });
var addResult = customerService.AddCustomers(addRequest);
// remove a customer
var removeRequest = new RemoveCustomersRequest(user, new List<string> { "1234567890" });
var removeResult = customerService.RemoveCustomers(removeRequest);

```

</details>

<details>
<summary><h2>AddCustomerParties method</h2></summary>

| **Name:** | AddCustomerParties |
| --- | --- |
| **Description:** | This method is responsible for adding one or more given customer parties to the specified customer. |
| **Usage:** | Called from Sitecore when adding parties to a customer account, typically during checkout or editing the customer account. |
| **Signature:** | `AddCustomerPartiesResult AddCustomerParties (AddCustomerPartiesRequest request)` |
| **Input:** |  |
|  | **Customer – CommerceCustomer.**Mandatory.<br><br>An instance of the customer. |
|  | **CustomerParties –**List<CustomerParty>**.**Mandatory.<br><br>A list of customer parties to associate with the customer. |
| **Output:** |  |
|  | **Customer -**Customer. Mandatory. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "autohaus" },
        ExternalId = "1234567890"
    })).CommerceCustomer;
// create the add request
var request = new AddCustomerPartiesRequest(customer,
    new List<CustomerParty>
    {
        new CustomerParty {ExternalId = "1234567890", PartyID = "1", Name = "HomeAddess", PartyType = 2}
    });
var result = customerService.AddCustomerParties(request);

```

</details>

<details>
<summary><h2>RemoveCustomerParties method</h2></summary>

| **Name:** | RemoveCustomerParties |
| --- | --- |
| **Description:** | This method is responsible for removing one or more given customer parties from the specified customer. |
| **Usage:** | Called from Sitecore when removing parties to a customer account, typically when editing the customer account. |
| **Signature:** | `RemoveCustomerPartiesResult RemoveCustomerParties (RemoveCustomerPartiesRequest request)` |
| **Input:** |  |
|  | **Customer – CommerceCustomer.**Mandatory.<br><br>An instance of the customer. |
|  | **Parties –**List<Party>**.**Mandatory.<br><br>A list of customer parities to un-associate with the customer. |
| **Output:** |  |
|  | **Customer -**Customer. Mandatory. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "autohaus" },
        ExternalId = "1234567890"
    })).CommerceCustomer;
var parties = new List<CustomerParty>
{
    new CustomerParty {ExternalId = "1234567890", PartyID = "1", Name = "HomeAddess", PartyType = 2}
};
// create the add request
var request = new AddCustomerPartiesRequest(customer, parties);
var result = customerService.AddCustomerParties(request);
// remove the parties
var removeRequest = new RemoveCustomerPartiesRequest(customer, parties);
var removeResult = customerService.RemoveCustomerParties(removeRequest);

```

</details>

<details>
<summary><h2>UpdateCustomerParties method</h2></summary>

| **Name:** | UpdateCustomerParties |
| --- | --- |
| **Description:** | This method is responsible for updating one or more given customer parties on the specified customer. |
| **Usage:** | Called from Sitecore when updating parties on a customer account, typically when editing the customer account. |
| **Signature:** | `UpdateCustomerPartiesResult UpdateCustomerParties (UpdateCustomerPartiesRequest request)` |
| **Input:** |  |
|  | **Customer – CommerceCustomer.**Mandatory.<br><br>An instance of the customer. |
|  | **Parties –**List<Party>**.**Mandatory.<br><br>A list of customer parties to update on the customer. |
| **Output:** |  |
|  | **Customer -**Customer. Mandatory. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "autohaus" },
        ExternalId = "1234567890"
    })).CommerceCustomer;
var parties = new List<CustomerParty>
{
    new CustomerParty {ExternalId = "1234567890", PartyID = "1", Name = "HomeAddess", PartyType = 2}
};
// create the add request
var request = new AddCustomerPartiesRequest(customer, parties);
var result = customerService.AddCustomerParties(request);
parties.Add(new CustomerParty { ExternalId = "9876543210", PartyID = "2", Name = "BillingAddess", PartyType = 1 });
// update the parties
var updateRequest = new UpdateCustomerPartiesRequest(customer, parties);
var updateResult = customerService.UpdateCustomerParties(updateRequest);

```

</details>

<details>
<summary><h2>GetParties method</h2></summary>

| **Name:** | GetParties |
| --- | --- |
| **Description:** | This method is responsible for getting all the parties. |
| **Usage:** | Called from Sitecore when adding parties to a customer account, typically during checkout or editing the customer account. |
| **Signature:** | `AddPartiesResult AddParties(AddPartiesRequest request)` |
| **Input:** |  |
|  | **Customer – CommerceCustomer.**Mandatory.<br><br>An instance of the customer. |
| **Output:** |  |
|  | **Parties –**List<Party><br><br>A list of parties |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "autohaus" },
        ExternalId = "1234567890"
    })).CommerceCustomer;
var parties = new List<Party>
{
    new Party {ExternalId = "1234567890", Address1 = "123 My Street", City = "My City", Country = "My Country", PartyId = "1"}
};
// add the party
var addRequest = new AddPartiesRequest(customer, parties);
var addResult = customerService.AddParties(addRequest);
// get the party
var getRequest = new GetPartiesRequest(customer);
var getResult = customerService.GetParties(getRequest);

```

</details>

<details>
<summary><h2>UpdateParties method</h2></summary>

| **Name:** | UpdateParties |
| --- | --- |
| **Description:** | This method is responsible for updating one or more given customer parties on the specified customer. |
| **Usage:** | Called from Sitecore when updating parties on a customer account, typically when editing the customer account. |
| **Signature:** | `UpdatePartiesResult UpdateParties(UpdatePartiesRequest request)` |
| **Input:** |  |
|  | **Customer – CommerceCustomer.**Mandatory.<br><br>An instance of the customer. |
|  | **Parties –**List<Party>**.**Mandatory.<br><br>A list of parties to update |
| **Output:** |  |
|  | **Customer -**Customer. Mandatory. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "autohaus" },
        ExternalId = "1234567890"
    })).CommerceCustomer;
var parties = new List<Party>
{
    new Party {ExternalId = "1234567890", Address1 = "123 My Street", City = "My City", Country = "My Country", PartyId = "1"}
};
// add the party
var addRequest = new AddPartiesRequest(customer, parties);
var addResult = customerService.AddParties(addRequest);
parties.Add(new Party { ExternalId = "9876543210", Address1 = "123 My Road", City = "My Town", Country = "Your Country", PartyId = "2" });
// update the parties
var updateRequest = new UpdatePartiesRequest(customer, parties);
var getResult = customerService.UpdateParties(updateRequest);

```

</details>

<details>
<summary><h2>AddParties method</h2></summary>

| **Name:** | AddParties |
| --- | --- |
| **Description:** | This method is responsible for adding one or more given customer parties to the specified customer. |
| **Usage:** | Called from Sitecore when adding parties to a customer account, typically during checkout or editing the customer account. |
| **Signature:** | `AddPartiesResult AddParties(AddPartiesRequest request)` |
| **Input:** |  |
|  | **Customer – CommerceCustomer.**Mandatory.<br><br>An instance of the customer. |
|  | **Parties –**List<Party>**.**Mandatory.<br><br>A list of customer parties to add. |
| **Output:** |  |
|  | **Customer -**Customer. Mandatory. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "autohaus" },
        ExternalId = "1234567890"
    })).CommerceCustomer;
var parties = new List<Party>
{
    new Party {ExternalId = "1234567890", Address1 = "123 My Street", City = "My City", Country = "My Country", PartyId = "1"}
};
// add the party
var addRequest = new AddPartiesRequest(customer, parties);
var addResult = customerService.AddParties(addRequest);

```

</details>

<details>
<summary><h2>RemoveParties method</h2></summary>

| **Name:** | RemoveParties |
| --- | --- |
| **Description:** | This method is responsible for removing one or more given customer parties from the specified customer. |
| **Usage:** | Called from Sitecore when removing parties to a customer account, typically when editing the customer account. |
| **Signature:** | `RemovePartiesResult RemoveParties(RemovePartiesRequest request)` |
| **Input:** |  |
|  | **Customer – CommerceCustomer.**Mandatory.<br><br>An instance of the customer. |
|  | **Parties –**List<Party>**.**Mandatory.<br><br>A list of customer parties to remove. |
| **Output:** |  |
|  | **Customer -**Customer. Mandatory. |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```csharp
var customerService = new CustomerServiceProvider();
// create a customer
var customer = customerService.CreateCustomer(new CreateCustomerRequest(
    new CommerceCustomer
    {
        Name = "Jeff",
        Shops = new[] { "autohaus" },
        ExternalId = "1234567890"
    })).CommerceCustomer;
var parties = new List<Party>
{
    new Party {ExternalId = "1234567890", Address1 = "123 My Street", City = "My City", Country = "My Country", PartyId = "1"}
};
// add the party
var addRequest = new AddPartiesRequest(customer, parties);
var addResult = customerService.AddParties(addRequest);
// remove the party
var removeRequest = new RemovePartiesRequest(customer, parties);
var getResult = customerService.RemoveParties(removeRequest);

```

</details>

<details>
<summary><h2>UpdatePassword method</h2></summary>

| **Name:** | UpdatePassword |
| --- | --- |
| **Description:** | Change the user password. Calls the `UpdatePassword` pipeline. |
| **Usage:** | Called from Sitecore when the password must be changed. |
| **Signature:** | `UpdatePasswordResult UpdatePassword(UpdatePasswordRequest request)` |
| **Input:** |  |
|  | **UserID – Mandatory**The ID of the user to change the password for. |
|  | **OldPassword** – **Mandatory**.<br><br>The old password. |
|  | **NewPassword – Mandatory**<br><br>The new password. |
| **Output:** |  |
|  | **SystemMessages****-** Collection of messages from the external system. |

Usage example:

```

var customerService = new CustomerServiceProvider();
// create a customer
var request = new CreateUserRequest("JohnSmith", "password", "john@abczyx.net", "webstore");
customerService.CreateUser(request);
// update the password
var updateRequest = new UpdatePasswordRequest("JohnSmith", "password", "nEwPaSsWoRd");
var result = customerService.UpdatePassword(updateRequest);

```

</details>