Price Matching
Finds the best price based on specified criteria.
To simplify, the price matching algorithm is made up of the following steps for each item:
The price lists that match the request are ranked, and the prices from the highest-ranked price lists that contain a price for the item are fetched. If no price list contains a price for the item, the catalog prices that match the specified criteria are fetched.
A unified
originalValueis calculated for each fetched price.The price with the lowest
effectiveValueis returned.
Prices from price lists take precedence over catalog prices. Price lists are ranked by the following criteria, in order of priority. Each criterion only decides between price lists that are equal in the criteria before it:
Customer match: a price list assigned to at least one of the customer groups of the
principal, or to thelegalEntityIdor one of its parent legal entities, ranks above a price list that isn't. The number of matched customer groups doesn't change the rank, and customer group, legal entity, and parent legal entity price lists rank the same.Country match: a price list assigned to the target country ranks above a price list that isn't.
Region match: a price list assigned to more of the target country's regions ranks higher.
Price lists that are equal in all three criteria share a rank. The ranks are checked from the highest to the lowest, and only the first rank that contains a price for the item is used. Prices from the ranks below are not compared, even if they are lower. For an example and a flowchart, see Influence of price lists on price matching.
To use the price matching functionality, you need to define appropriate tax classes in the Tax Service and then assign them to products for which prices are matched through the Product Service.
Special cases:
If the matched price currency is different than the requested currency, the price is calculated based on exchange rates.
Note: To calculate prices in different currencies, you need to define their exchange rates in the Currency Service.
If the matched price location is different than the requested location, the price is calculated based on tax classes.
Note: To calculate prices for different locations, you need to assign their tax classes to the product for which the price is matched. Tax classes need to be defined in the Tax Service and then assigned to the product through the Product Service.
The includesTax setting, defined at the site or price model level, determines if the algorithm returns net or gross prices. The endpoint returns the best price as a gross or net depending on the following cases:
If requested site's
includesTaxfield is specified (through the Site Settings Service):If the
includesTaxfield is set totrue, the matched price is returned as a gross value.If the
includesTaxfield is set tofalse, the matched price is returned as a net value.
If requested site's
includesTaxfield is not specified:If the
includesTaxfield in the price model associated with the price is set totrue, the matched price is returned as a gross value.If the
includesTaxfield in the price model associated with the price is set tofalse, the matched price is returned as a net value.
- : Needed to manage prices.
- : Needed to retrieve prices.
Your Emporix tenant's name.
Note: The tenant should always be written in lowercase.
^[a-z][a-z0-9]+$Code of the currency in which the prices should be matched, as defined in the Currency Service.
Note: If the matched price is defined in another currency, a currency exchange algorithm will be used, but only if exchange rates between the two currencies have been defined.
Code of the site to which the matched prices should apply.
If no price that matches the criteria is found for the specified site, the price matching functionality will try to find the best price for the main site. To enable this option, this field needs to be set to true.
Note: Using the fallback mechanism may impact the performance as the price matching has to run a second time. If the fallback mechanism is used, the response's siteCode field will be set to main.
Legal entity for which price lists are included in the price match. Note: Price lists for the entity's parent legal entities are also included.
OK
Price's unique identifier, generated when the price is created.
Price list's unique identifier. The property is populated only in case when the return price belongs to any price list.
Currency related to the price.
Represents an original value without any discounts for a single unit of the requested item (PRODUCT or SKU). The value is a gross price (if includesTax is true) or net price (if includesTax is false).
It's worth to mention that the cent part is not limited just to two digits. For example, if the price is for one piece of screw, it could look like this: 0.0000317
Represents a value with a discount (if applicable) for a single unit of the requested item (PRODUCT or SKU). The value is a gross price (if includesTax is true) or net price (if includesTax is false).
It's worth to mention that the cent part is not limited just to two digits. For example, if the price is for one piece of screw, it could look like this: 0.0000317
Represents a total value with a discount (if applicable) for all units of the requested item (PRODUCT or SKU). The value is a gross price (if includesTax is true) or net price (if includesTax is false).
It's worth to mention that the cent part is not limited just to two digits. For example, if the price is for one piece of screw, it could look like this: 0.0000317
Flag indicating whether prices assigned to the price model are expressed as net or gross.
| Value | Description |
|---|---|
true | Prices are expressed as gross values. |
false | Prices are expressed as net values. |
Bad Request
Given request is unauthorized - the authorization token is invalid or has expired. Details are provided in the response payload.
Given authorization scopes are not sufficient and do not match the scopes required by the endpoint.
Not Found
Some server-side error occurred. Details are provided in the response payload.
POST /price/{tenant}/match-prices HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 199
{
"targetCurrency": "EUR",
"siteCode": "1111",
"targetLocation": {
"countryCode": "DE"
},
"items": [
{
"itemId": {
"itemType": "PRODUCT",
"id": "5f5a3a365bac380024b93c45"
},
"quantity": {
"quantity": 10,
"unitCode": "kg"
}
}
]
}{
"priceId": "6245aa0a78a8576e338fa9c4",
"itemId": {
"itemType": "PRODUCT",
"id": "5f5a3a365bac380024b93c45"
},
"site": {
"code": "1111"
},
"currency": "EUR",
"location": {
"countryCode": "DE"
},
"originalValue": 13.55,
"effectiveValue": 13.55,
"totalValue": 1355,
"quantity": {
"quantity": 10,
"unitCode": "kg"
},
"includesTax": true,
"priceModel": {
"id": "6245a8f578a8576e338fa9c3",
"name": {
"en": "Tiered in grams"
},
"includesTax": true,
"includesMarkup": true,
"measurementUnit": {
"quantity": 0.1,
"unitCode": "kg"
},
"tierDefinition": {
"tierType": "TIERED",
"tiers": [
{
"minQuantity": {
"quantity": 0,
"unitCode": "kg"
}
},
{
"minQuantity": {
"quantity": 0.5,
"unitCode": "kg"
}
},
{
"minQuantity": {
"quantity": 5,
"unitCode": "kg"
}
}
]
},
"metadata": {
"version": 1,
"createdAt": "2022-03-31T13:13:25.816Z",
"modifiedAt": "2022-03-31T13:13:25.816Z"
}
},
"tax": {
"taxClass": "STANDARD",
"taxRate": 20,
"prices": {
"originalValue": {
"netValue": 10.84,
"grossValue": 13.55,
"taxValue": 2.71
},
"effectiveValue": {
"netValue": 10.84,
"grossValue": 13.55,
"taxValue": 2.71
},
"totalValue": {
"netValue": 1084,
"grossValue": 1355,
"taxValue": 271
}
}
},
"tierValues": [
{
"id": "04e9b68bc1ea4982a42247726239e7be",
"priceValue": 15.55
},
{
"id": "04e9b68bc1ea4982a42247726239e7be",
"priceValue": 14.55
},
{
"id": "04e9b68bc1ea4982a42247726239e7be",
"priceValue": 13.55
}
],
"metadata": {
"version": "1",
"createdAt": "2022-03-31T13:18:02.379Z",
"modifiedAt": "2022-03-31T13:18:02.379Z"
}
}Finds the best price based on information retrieved from the session context.
The behavior of the logic is the same as of the price/{tenant}/match-prices mechanism. The only exception is that the criteria are created based on the information retrieved from the session details assigned to the access-token in the Session-context Service.
The list of items is also needed as body parameter (similar to the other endpoint).
Your Emporix tenant's name.
Note: The tenant should always be written in lowercase.
^[a-z][a-z0-9]+$The prices were successfully matched.
Price's unique identifier, generated when the price is created.
Price list's unique identifier. The property is populated only in case when the return price belongs to any price list.
Currency related to the price.
Represents an original value without any discounts for a single unit of the requested item (PRODUCT or SKU). The value is a gross price (if includesTax is true) or net price (if includesTax is false).
It's worth to mention that the cent part is not limited just to two digits. For example, if the price is for one piece of screw, it could look like this: 0.0000317
Represents a value with a discount (if applicable) for a single unit of the requested item (PRODUCT or SKU). The value is a gross price (if includesTax is true) or net price (if includesTax is false).
It's worth to mention that the cent part is not limited just to two digits. For example, if the price is for one piece of screw, it could look like this: 0.0000317
Represents a total value with a discount (if applicable) for all units of the requested item (PRODUCT or SKU). The value is a gross price (if includesTax is true) or net price (if includesTax is false).
It's worth to mention that the cent part is not limited just to two digits. For example, if the price is for one piece of screw, it could look like this: 0.0000317
Flag indicating whether prices assigned to the price model are expressed as net or gross.
| Value | Description |
|---|---|
true | Prices are expressed as gross values. |
false | Prices are expressed as net values. |
Bad Request
Given request is unauthorized - the authorization token is invalid or has expired. Details are provided in the response payload.
Given authorization scopes are not sufficient and do not match the scopes required by the endpoint.
Not Found
Some server-side error occurred. Details are provided in the response payload.
POST /price/{tenant}/match-prices-by-context HTTP/1.1
Host: api.emporix.io
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 119
{
"items": [
{
"itemId": {
"itemType": "PRODUCT",
"id": "5f5a39d95bac380024b93c24"
},
"quantity": {
"quantity": 1,
"unitCode": "kg"
}
}
]
}{
"priceId": "6245aa0a78a8576e338fa9c4",
"itemId": {
"itemType": "PRODUCT",
"id": "5f5a3a365bac380024b93c45"
},
"site": {
"code": "1111"
},
"currency": "EUR",
"location": {
"countryCode": "DE"
},
"originalValue": 13.55,
"effectiveValue": 13.55,
"totalValue": 1355,
"quantity": {
"quantity": 10,
"unitCode": "kg"
},
"includesTax": true,
"priceModel": {
"id": "6245a8f578a8576e338fa9c3",
"name": {
"en": "Tiered in grams"
},
"includesTax": true,
"includesMarkup": true,
"measurementUnit": {
"quantity": 0.1,
"unitCode": "kg"
},
"tierDefinition": {
"tierType": "TIERED",
"tiers": [
{
"minQuantity": {
"quantity": 0,
"unitCode": "kg"
}
},
{
"minQuantity": {
"quantity": 0.5,
"unitCode": "kg"
}
},
{
"minQuantity": {
"quantity": 5,
"unitCode": "kg"
}
}
]
},
"metadata": {
"version": 1,
"createdAt": "2022-03-31T13:13:25.816Z",
"modifiedAt": "2022-03-31T13:13:25.816Z"
}
},
"tax": {
"taxClass": "STANDARD",
"taxRate": 20,
"prices": {
"originalValue": {
"netValue": 10.84,
"grossValue": 13.55,
"taxValue": 2.71
},
"effectiveValue": {
"netValue": 10.84,
"grossValue": 13.55,
"taxValue": 2.71
},
"totalValue": {
"netValue": 1084,
"grossValue": 1355,
"taxValue": 271
}
}
},
"tierValues": [
{
"id": "04e9b68bc1ea4982a42247726239e7be",
"priceValue": 15.55
},
{
"id": "04e9b68bc1ea4982a42247726239e7be",
"priceValue": 14.55
},
{
"id": "04e9b68bc1ea4982a42247726239e7be",
"priceValue": 13.55
}
],
"metadata": {
"version": "1",
"createdAt": "2022-03-31T13:18:02.379Z",
"modifiedAt": "2022-03-31T13:18:02.379Z"
}
}Last updated
Was this helpful?

