VTEX

Pricing Hub

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

Other#openapi

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

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.

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.

> The app used by Pricing Hub to connect must be a major 0.

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

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

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:

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

The response should have the following properties:

…

Endpoints 2

Pricing Hub Prices

  • POSTGet Prices/api/pricing-hub/prices?accountName=apiexamplesThis 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…
  • PUTConfigure External Price Source/config?an=apiexamplesThis route facilitates setting up an external price source in Pricing Hub. It also allows you to activate or deactivate that source in a given account. >ℹ️…

API details

Base URL
https://vtex.local
https://prchub.{environment}.com.br
Authentication
An API key in the X-VTEX-API-AppKey header
An API key in the X-VTEX-API-AppToken header
Operations
2 operations on 2 pathsPUT 1POST 1
Main resources
Pricing Hub Prices 2
Response formats
application/json
Description format
OpenAPI 3.0.0, API version 1.0
Listed from
APIs.guru OpenAPI Directory (CC0-1.0)
Source updated

How to test the Pricing Hub in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the Pricing Hub collection, without the publisher's secrets.
  3. Add your credentialsThis API uses an API key in the X-VTEX-API-AppKey header. Add yours in the collection's variables or an environment; the requests already reference it.
  4. Send a requestPick an endpoint, for example “Get Prices” (POST /api/pricing-hub/prices?accountName=apiexamples), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the Pricing Hub?

> This feature is in closed beta, available only for selected customers. If you have any questions, contact our… It is listed under Other and has 2 endpoints.

Who publishes the Pricing Hub?

It is listed from VTEX's public API description (an OpenAPI document), not published by VTEX on Swastik Codes. Anyone who controls vtex.com can claim the profile by adding a DNS TXT record.

What is the base URL of the Pricing Hub?

Its description lists 2 base URLs: https://vtex.local, https://prchub.{environment}.com.br. The first is the usual one; the others are typically sandbox or regional servers.

How do I authenticate with the Pricing Hub?

It accepts 2 methods: an API key in the X-VTEX-API-AppKey header; an API key in the X-VTEX-API-AppToken header.

How many endpoints does the Pricing Hub have?

2 operations on 2 paths (1 PUT, 1 POST). The largest groups are Pricing Hub Prices.

Is forking the Pricing Hub free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.