> For the complete documentation index, see [llms.txt](https://developer.emporix.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.emporix.io/ce/core-commerce/customer-management/assisted-buying.md).

# Assisted Buying

Here you can find an overview of the Emporix Assisted Buying, along with its features and benefits.

{% hint style="info" %}

* Looking for Management Dashboard guides? Check out the [Sites](/ce/management-dashboard/settings/sites.md) and [Customers](/ce/management-dashboard/customer-management/customers.md) guides.
* Looking for related API documentation? Check out the [Site Settings Service](/api-references/api-guides/configuration/site-settings-service.md), [Customer Service](/api-references/api-guides/companies-and-customers/customer-service.md), [Orders Service](/api-references/api-guides/orders/order.md) and [Returns Service](/api-references/api-guides/orders/returns.md).
  {% endhint %}

### Purpose

Assisted Buying is a feature focusing on providing faster and better customer support. Whenever customers have any issues with orders or just ask to act on their behalf, merchant employees can address their requirements in a convenient way.

#### Overview video

{% embed url="<https://www.youtube.com/embed/REYvMy_KZno?si=o7xAjwEK3FaQyVau&rel=0&showinfo=0&autohide=1>" %}

### Features

| Feature                                              | Description                                                                                                                                             |
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Activation on site level in Management Dashboard** | Easy activation done by adding a relevant storefront URL to site settings.                                                                              |
| **Acting on behalf of the customer**                 | The feature allows an employee to log in as a customer and perform specific actions on a storefront, for example: creating an order, returns or quotes. |

<figure><img src="/files/Qh5sqJ5jEXn1gR2pldvk" alt=""><figcaption></figcaption></figure>

### Enabling and using the assisted buying

To enable the feature, you need to provide a storefront URL for each site where assisted buying should work. This can be done in the Management Dashboard UI, in Site Settings.

{% hint style="info" %}
To see the details, check the [Assisted Buying in Sites](#enabling-and-using-the-assisted-buying) guide.
{% endhint %}

After enabling the feature for a specific site, you can now log in as a customer and perform the requested actions on their behalf.

{% hint style="warning" %}
The Assisted Buying functionality works only if the logged in user is a member of the support group.
{% endhint %}

1. In **Management Dashboard**, go to **Customer Management** -> **Customers** and choose the customer on behalf of whom you want to log in to the storefront.
2. In the Details view, open the **Assisted Buying** dropdown list and choose the site.

When you choose the site that you want to use, it opens a new browser tab with the storefront. You can now do any purchases that were requested by the customer.

### Storefront implementation

When you log in to the configured storefront site, you're invoking the following request to authenticate as a customer:

{% hint style="warning" %}
Please note that the `employee token` is required to complete this request to assure that an authorized person logs in as a customer. The endpoint doesn't work with API key.
{% endhint %}

```json
curl --location --request POST 'https://api.emporix.io/customer/{TENANT}/login' \
--header 'Authorization: Bearer 4eqtOqb8TUhWPz65m3sRa9PY4UWG' \
--header 'Content-Type: application/json' \
--data-raw '{
  "email": "",
  "password": ""
}'
```

The response includes the following details:

```json
{
    "accessToken": "wOxp8G6vLiz3S2QYJMzRglFRRprI",
    "saasToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIwNjI0ODM3NiIsImV4cCI6MTY5Nzk1NjcyOX0.HYksa0G9LUXEfRx6DvFsugtcuv2FvC7QDbSQ51Aqr50",
    "expiresIn": 2591999,
    "refreshToken": "VmjmyVumjt5AD1WfN7nAp5kmfzcJAcgS",
    "refreshTokenExpiresIn": 86399
}
```

This information is visible in the URL and attached as query parameters, like in this example:

Storefront URL configured in Management Dashboard for the site:

```
https://storefront.emporix.io?tenant=MyTenant&clientId=StorefrontApiKey
```

URL of the storefront after you open the site:

```
 https://storefront.emporix.io?tenant=MyTenant&clientId=StorefrontApiKey&customerToken=wOxp8G6vLiz3S2QYJMzRglFRRprI&customerTokenExpiresIn=2591999&saasToken=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIwNjI0ODM3NiIsImV4cCI6MTY5Nzk1NjcyOX0.HYksa0G9LUXEfRx6DvFsugtcuv2FvC7QDbSQ51Aqr50
```

Set the values in your storefront and use them when making the https calls.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.emporix.io/ce/core-commerce/customer-management/assisted-buying.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
