> For the complete documentation index, see [llms.txt](https://developer.esw.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.esw.com/getting-started/get-started-with-esw/quick-start-guide/pricing-advisor.md).

# Pricing Advisor

Get Pricing Advisor v4.0 multipliers and calculate local-currency shopper prices.

The Pricing Advisor API returns the data needed to show a local-currency shopper price. This includes FX rates, estimated duties and taxes, retailer adjustments, rounding rules, and currency display formats. It is **read-only**. All six endpoints are `GET` requests with no request body.

In this quick start you fetch pricing advice for one country and turn a base price into a shopper price.

**Time:** about 15 minutes

**Environment:** sandbox

### Before you begin

* Your `tenantCode`
* Sandbox client credentials with the `pricing.advisor.api.all` scope. If you have not requested a token yet, follow [Quick start: Authentication](https://developer.esw.com/getting-started/get-started-with-esw/quick-start-guide/authentication.md)

### Choose an advice type

Pricing Advisor v4.0 offers two views of the same data.

|           | Multiplier Advice                                                    | Standard Advice                                                               |
| --------- | -------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
| Returns   | One pre-calculated multiplier per currency pair and product category | The individual components: FX rates, tax, duty, fees, and retailer adjustment |
| Use it to | Calculate a shopper price with one multiplication                    | Show a price breakdown, or apply your own pricing logic                       |
| Path      | `/api/4.0/MultiplierAdvice/{tenantCode}/{countryIso}`                | `/api/4.0/StandardAdvice/{tenantCode}/{countryIso}`                           |

Most storefronts that only need to display localized prices start with Multiplier Advice.

{% stepper %}
{% step %}

#### Get an access token

Request a token with `scope=pricing.advisor.api.all` using the request from [Quick start: Authentication](https://developer.esw.com/getting-started/get-started-with-esw/quick-start-guide/authentication.md). Store it in `ESW_TOKEN`.
{% endstep %}

{% step %}

#### Fetch multiplier advice for a country

Pass your tenant code and an ISO 3166-1 alpha-2 country code.

```sh
curl "https://pricing-advisor-api.sandbox.eshopworld.com/api/4.0/MultiplierAdvice/<tenantCode>/DE" \
  --header "Authorization: Bearer $ESW_TOKEN" \
  --header "Accept: application/json"
```

A `200` response looks like this (abridged):

{% code expandable="true" %}

```json
{
  "id": "ma-001-de",
  "version": "4.0.1",
  "countryIso": "DE",
  "lastUpdated": "2024-05-01T08:00:00Z",
  "tenantIdentifier": "ACME",
  "categories": [
    {
      "id": "ApparelAccessories",
      "multipliers": [
        {
          "fromCurrencyIso": "GBP",
          "toCurrencyIso": "EUR",
          "value": 1.52,
          "adjustedValue": 1.52
        }
      ],
      "roundingConfigurations": [
        {
          "currencyIso": "EUR",
          "currencyExponent": 2,
          "direction": "Up",
          "model": "none.none"
        }
      ],
      "currencyDisplays": [
        {
          "currencyIso": "EUR",
          "currencySymbol": "€",
          "currencyExponent": 2,
          "decimalSeparator": ",",
          "thousandSeparator": ".",
          "showTrailingZeros": true,
          "configurationString": "€#,##0.00"
        }
      ]
    }
  ]
}
```

{% endcode %}

To get every configured country in one call, omit the country: `GET /api/4.0/MultiplierAdvice/{tenantCode}`.
{% endstep %}

{% step %}

#### Calculate the shopper price

Each multiplier has two fields:

| Field           | What it is                                                                                                                   | Use it                                         |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| `adjustedValue` | The multiplier adjusted for the country's pricing model. It accounts for duties or taxes already included in your base price | By default, to calculate the shopper price     |
| `value`         | The standard multiplier with FX, retailer adjustment, and all estimated duties, taxes, and fees, before that adjustment      | Only to compare raw multipliers across markets |

The two are often identical. They differ when the country uses a model such as DAP, or when your base prices already include tax, for example VAT-inclusive prices. In those markets, `value` counts the embedded rates twice. If you are unsure which rates a market includes, check `merchandisePricingModel` on Standard Advice, and confirm the field with ESW before production.

Multiply your retailer base price by the `adjustedValue` for the product's category and currency pair:

```
shopperPrice = basePrice × multiplier.adjustedValue
```

For example, a product that costs 100 GBP, with a GBP-to-EUR `adjustedValue` of `1.52` for Germany, costs 152 EUR before rounding.

Use the category `id` returned in the advice response, and match both currency codes exactly.

{% code expandable="true" %}

```js
function rawShopperPrice(
  basePrice,
  advice,
  categoryId,
  fromCurrency,
  toCurrency,
  multiplierField = "adjustedValue"
) {
  if (!["value", "adjustedValue"].includes(multiplierField)) {
    throw new Error("Invalid multiplier field");
  }

  const category = advice.categories.find((c) => c.id === categoryId);
  if (!category) throw new Error(`Missing pricing category: ${categoryId}`);

  const multiplier = category.multipliers.find(
    (m) => m.fromCurrencyIso === fromCurrency && m.toCurrencyIso === toCurrency
  );
  if (!multiplier) {
    throw new Error(`Missing multiplier: ${fromCurrency} to ${toCurrency}`);
  }

  return basePrice * multiplier[multiplierField]; // round and format next
}
```

{% endcode %}

Use a decimal library for money in production code. Floating point arithmetic can produce off-by-a-cent results.

Then finish the price in two steps:

1. **Round** it using the entry in `roundingConfigurations` for the shopper currency. `direction` is `Up`, `Down`, or `Nearest`. `model` has two rules separated by a period, one for the whole number and one for the decimals, for example `multiple50.fixed00`. See the [Pricing Advisor overview](https://developer.esw.com/pricing-advisor-api/pricing-advisor-api/overview.md) for every rounding model.
2. **Format** it using `currencyDisplays`: symbol, decimal and thousand separators, exponent, and `configurationString`.

{% hint style="warning" %}
If `value` and `adjustedValue` differ for a market, pricing with `value` overcounts the rates already in your base price. Use `adjustedValue` unless ESW has confirmed otherwise for your configuration.
{% endhint %}
{% endstep %}

{% step %}

#### Optional: get the price breakdown

Call Standard Advice when you want to show duties and taxes separately.

```sh
curl "https://pricing-advisor-api.sandbox.eshopworld.com/api/4.0/StandardAdvice/<tenantCode>/DE" \
  --header "Authorization: Bearer $ESW_TOKEN" \
  --header "Accept: application/json"
```

The response includes these key fields:

| Field                             | Description                                                                                             |
| --------------------------------- | ------------------------------------------------------------------------------------------------------- |
| `fxRates[]`                       | Conversion rates, each with `from`, `to`, and `rate`                                                    |
| `categories[].estimatedTax`       | Estimated VAT or sales tax, as a percentage                                                             |
| `categories[].estimatedDuty`      | Estimated import duty, as a percentage                                                                  |
| `categories[].estimatedFee`       | Estimated carrier and handling fee, as a percentage                                                     |
| `categories[].retailerAdjustment` | Retailer-defined price adjustment, as a percentage                                                      |
| `merchandisePricingModel`         | `DDP` (Delivered Duty Paid) or `DAP` (Delivered At Place), with the rates included in the shopper price |

For worked calculations, see the Pricing Advisor [Use Cases](https://developer.esw.com/pricing-advisor-api/pricing-advisor-api/use-cases.md).
{% endstep %}
{% endstepper %}

### Look up historical advice

Each advice record has an `id`. Use it to audit a past price, for example to check which rates applied when an order was placed.

```http
GET /api/4.0/MultiplierAdvice/{id}/archived
GET /api/4.0/StandardAdvice/{id}/archived
```

The archived response has the same structure as the current one, with the `version`, `lastUpdated`, and values from that point in time.

{% hint style="info" icon="lightbulb" %}

### Production guidance

* FX rates update daily. Cache advice per country and refresh it at least once a day instead of calling the API for every product view.
* Call the all-countries endpoint, `GET /api/4.0/MultiplierAdvice/{tenantCode}`, at start-up or on a schedule to discover every market configured for your tenant.
* Pass the pricing strategy to Checkout with the optional `pricingSynchronizationId` on the PreOrder. If you omit it, the default strategy for the brand and country applies. See [Quick start: Checkout](https://developer.esw.com/getting-started/get-started-with-esw/quick-start-guide/checkout.md).
* Use production credentials and the production Pricing Advisor base URL when you go live. Confirm the base URL with your ESW representative.
  {% endhint %}

### Common errors

| Error                       | Cause                                                       | Fix                                                                                                                         |
| --------------------------- | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| `401`                       | Token missing or expired                                    | Request a new token and resend                                                                                              |
| `403`                       | Token lacks the Pricing Advisor scope                       | Request a token with `pricing.advisor.api.all`                                                                              |
| `404` on a country          | No advice configured for that `tenantCode` and `countryIso` | Use the two-letter code in uppercase, for example `DE`. Call the all-countries endpoint to see which markets are configured |
| `404` on an archived record | The `id` does not match any record                          | Fetch current advice again to get a valid `id`                                                                              |
| `400` on all-countries      | Invalid `tenantCode`                                        | Check the exact tenant code, which is case-sensitive                                                                        |

### Next steps

* Read the [Pricing Advisor overview](https://developer.esw.com/pricing-advisor-api/pricing-advisor-api/overview.md) for `currencyDisplays` and rounding model details
* Follow a worked example in [Pricing Advisor Example to Settlement](https://developer.esw.com/getting-started/get-started-with-esw/finance-and-settlement/pricing/pricing-advisor-example-to-settlement.md)
* Return to the [Quick Start Guide](https://developer.esw.com/getting-started/get-started-with-esw/quick-start-guide.md)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developer.esw.com/getting-started/get-started-with-esw/quick-start-guide/pricing-advisor.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
