Documentation
Feedback
Guides

Pricing Hub - Overview

This feature is in closed beta, available only for selected customers. If you have any questions, contact our Support.

In the B2B scenario, it is common for stores to have personalized prices per customer and complex pricing systems that require external integrations. Pricing Hub is a system developed for the B2B context that works as an intermediary between VTEX and external pricing systems.

In VTEX, B2B stores have the option to use our internal pricing system or an external one. If the store chooses to operate with an external pricing system, Pricing Hub will query an external price calculation API. The external API should then respond with the price for all items in the shopping cart according to its predefined tax rules.

{"base64":"  ","img":{"width":2501,"height":1459,"type":"png","mime":"image/png","wUnits":"px","hUnits":"px","length":61444,"url":"https://user-images.githubusercontent.com/77292838/211634260-e4f7a516-91df-416e-ab43-d9c79d56bc91.png"}}

Implementation

To connect with external pricing systems using Pricing Hub, it is necessary to build a VTEX IO middleware app. We offer two reference implementation templates to simplify this process:

Read the documentation on each repository to learn more about the required steps to use and customize the app.

Specifications

See below all the specifications of the request and the response expected when communicating with Pricing Hub.

Price calculation request

The external prices calculation tool must provide an endpoint that will receive a POST Get Prices request. This route retrieves and applies prices for the items that are passed in the request. Pricing Hub will select the pricing method that will be used for each item and will fetch their respective price from the selected pricing method.

Responses from Pricing Hub tend to have a greater delay when compared to other VTEX systems. That is expected, however, due to the complexity of its nested requests. The timeout for this request is 900 milliseconds.

In this request, Pricing Hub provides a body in a specific format, exemplified below. This means that either the endpoint must be prepared to receive this body format, or the app must contain a parser to adapt it to the correct format.

Request body example


_11
{
_11
"item":
_11
{
_11
"index": 0,
_11
"skuId": "880011",
_11
"quantity": 1
_11
},
_11
"context":{
_11
"email": "john@email.com"
_11
}
_11
}

The request body should have the following properties:

AttributeTypeDescription
itemobjectThe item whose price is supposed to be fetched by Pricing Hub.
indexintegerThis is the index of the item at Checkout's cart. It has to be unique in the items array.
skuIdstringThis is the SKU ID of the item that will be priced.
quantityintegerThis is the amount of items that will be priced. It is possible to have a volume discount for many repeated items. Hence, the price may not be the quantity of the item multiplied by the unitary price.
contextobjectThe object that contains the context to inform the query.
emailstringThe customer's email address. If there is no value, use an empty string.

External prices provider response

In response to the request sent by Pricing Hub, we expect an outcome in the following format:


_13
{
_13
"item": {
_13
"price": 54035,
_13
"priceTables": "special",
_13
"index": 0,
_13
"skuId": "880011",
_13
"listPrice": 54035,
_13
"costPrice": 50000,
_13
"sellingPrice": 54035,
_13
"priceValidUntil": "2023-01-27T20:29:57Z",
_13
"tradePolicyId": "special"
_13
}
_13
}

The response should have the following properties:

AttributeTypeDescription
itemobjectThe object that contains the price data.
priceintegerThe price returned by the pricing API that was used by Pricing-Hub. It is measured in cents, so 5000 means 50,00 in local currency.
priceTablesstringThe price table that was used to price the item.
indexintegerThe same index referring to Checkout's cart that was passed to the API.
skuIdstringThe same SKU ID that was passed to the API.
listPriceintegerThe list price returned by the pricing API that was used by Pricing Hub. It is measured in cents, so 5000 means 50,00 in local currency.
costPriceintegerThe cost price returned by the pricing API that was used by Pricing-Hub. It is measured in cents, so 5000 means 50,00 in local currency.
sellingPriceintegerThe computed price before applying coupons, taxes or promotions.
priceValidUntilstringThe moment up until the price is valid. After that moment, it will be necessary to call the pricing API again. The format of the string is in RFC3339.
tradePolicyIdstringTrade Policy ID.

Index - Pricing Hub API

POST Get Prices PUT Configure External Price Source

Contributors
3
Photo of the contributor
Photo of the contributor
Photo of the contributor
+ 3 contributors
Was this helpful?
Yes
No
Suggest edits (Github)
Contributors
3
Photo of the contributor
Photo of the contributor
Photo of the contributor
+ 3 contributors
On this page