Dynamic Pricing Engine (2.0.0)

Download OpenAPI specification:Download

E-mail: support@fabric.inc License: fabric INC

fabric's Dynamic Pricing Engine provides APIs that help to evaluate promotions and calculate prices instantly for the cart items using real-time price calculation method, that incorporates the latest information, to provide personalized and competitive prices for specific customers. It supports formula based custom SKU dynamic pricing, and shows discount breakdown details for separate items having separate promotions.

It uses the cache information, instead of fetching offer details of items from database, to evaluate promotions and calculate prices instantly. It is fast, scalable to millions of pricing requests per day, and supports complex promotional strategies.

Promotions

Promotion endpoint evaluates promotions and discount coupons instantly. The evaluate promotions endpoint allows you to submit a range of data that will be referenced against the conditions that are set earlier using Management APIs. The response will include the details of the promotions and discounts applied. This can be displayed on your Storefront to help shoppers know that they are getting the expected discounts.

Evaluate promotions

Evaluates a cart's promotions, discount coupons and implicit promotions,either by specified itemId or by SKU (based on the customer specific configuration set in the backend)

Request
header Parameters
x-api-key
required
string

The x-api-key enables you to access fabric APIs without Authorization. You must request fabric Inc to obtain this key.

tenant-key
required
string

Merchant's copilot account ID (10 character) provided by fabric

required
object (xSiteContext)

JSON object containing channel, account, stage, and date.

Authorization
required
string

Authorization token or access token for the user, provided by fabric.
Note: To know about how to generate authorization token, see Generate Authorization Token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json
traceId
string

Trace ID, used to trace logs

isLoggedIn
boolean

true: user logged in
false: user is not logged in

userId
string

User ID

promoCodes
Array of strings

List of all the promotion codes (coupon codes) to apply

Array of objects (promotionRequestShipping)

Shipping cost for the entire cart. You can use this shipping array if you want to add shipping cost for the entire cart.
If you want to add shipping cost for individual items, you can provide details for each item using items.shippingMethodId and items.shippingPrice fields.

required
Array of objects (promotionRequestItem)

List of item information objects

date
string <date-time> yyyy-MM-ddThh:mm:ssZ

Date for which the promotions to be evaluated

Array of objects

Segment the user belongs to

Responses
200

Successfully evaluated the promotions

400

Bad Request

403

Forbidden

404

Not Found

500

Internal Server Error

post/promo/evaluate-promotions
Request samples
application/json
{
  • "traceId": "394823457",
  • "isLoggedIn": true,
  • "userId": "5e2cfb9b45570b000864c4b5",
  • "promoCodes": [
    ],
  • "shipping": [
    ],
  • "items": [
    ],
  • "date": "2019-08-24T14:15:22Z",
  • "userProfile": {
    }
}
Response samples
application/json
[
  • {
    }
]

Price

Price endpoint calculates price details for one or more itemsin real-time, and displays the calculated price on the website.

Get calculated prices

Retrieves prices for items either by SKUs or by item IDs based on the customer specific configuration set in the backend.

Request
header Parameters
x-api-key
required
string

The x-api-key enables you to access fabric APIs without Authorization. You must request fabric Inc to obtain this key.

tenant-key
required
string

Merchant's copilot account ID (10 character) provided by fabric

required
object (xSiteContext)

JSON object containing channel, account, stage, and date.

Authorization
required
string

Authorization token or access token for the user, provided by fabric.
Note: To know about how to generate authorization token, see Generate Authorization Token

Example: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYxZjIyMTU4...
Request Body schema: application/json
traceId
string

Trace ID, used to trace logs

priceList
Array of strings

List of price list IDs which items or skus belong to

sku
Array of strings

List of item SKUs for which prices to retrieve.Either SKUs or ItemIds required. If both provided, SKU overrides itemId.

itemId
Array of integers <int32>

List of item SKUs for which prices to retrieve.Either SKUs or ItemIds required. If both provided, SKU overrides itemId.

userId
string

User ID

object

Segment the user belongs to

isLoggedIn
boolean

true if the user logged in
false if the user is not logged in

channel
Array of integers <int32>

List of channel ID from where the request is coming

date
string <date-time> yyyy-MM-ddThh:mm:ssZ

Date for which the prices are to be retrieved

Array of objects (priceRequestParam)

Various price parameters to calculate final price

audit
boolean

true if audit is required. Response body will have an audit object with details about how the dynamic pricing engine obtained the result.
false if audit is not required.

Responses
200

Successfully retrieved the prices

400

Bad Request

403

Forbidden

404

Not Found

500

Internal Server Error

post/price/get-by-sku
Request samples
application/json
{
  • "traceId": 394823457,
  • "priceList": [
    ],
  • "sku": [
    ],
  • "itemId": [
    ],
  • "userId": "5e2cfb9b45570b000864c4b5",
  • "userProfile": {
    },
  • "isLoggedIn": true,
  • "channel": [
    ],
  • "date": "2019-08-24T14:15:22Z",
  • "priceParams": [
    ],
  • "audit": true
}
Response samples
application/json
[
  • {
    }
]