This document provides details of what fabric Offers is, why it is so valuable, core concepts of fabric Offers including its features, and how to use Offers APIs with your storefront.

Overview

fabric Offers is a headless and holistic ecommerce solution for pricing and promotion tools. It enables merchants to create and manage a range of pricing strategies to increase their competitiveness in the market.

fabric Offers APIs are divided into two categories— Management APIs and Storefront APIs. Management APIs let merchants create prices, promotions, and coupons. Storefront APIs serve prices and promotions if the conditions are met.

  • Management APIs: These APIs are supported by fabric’s Offers engine that lets merchants create prices, promotions, coupons, set conditions for offers to be applied, and set discount amounts. For details, see Offers v2 > API References > Management APIs from the left side navigation pane.
  • Storefront APIs: These APIs are supported by fabric’s Dynamic Pricing Engine which evaluates promotions, calculates prices in real-time for one or many items, and displays these prices on storefront sites. For details, see Offers v2 > API References > Storefront APIs from the left side navigation pane.
    • Get Price: /price/get-by-sku (under Dynamic Pricing Engine) endpoint displays prices on your product details page. It considers all the active promotions and returns the original price that was set earlier along with the discounted prices of the product.
    • Evaluate Promotions: This endpoint (/promo/evaluate-promotions) applies promotions to one or more items that exist in the cart if the conditions are met. For example:
      • You may have promotions for specific items, for a minimum quantity of an item, or a combination of items to be purchased.
      • You may also create promotions that require a certain cart amount to be reached to get the discount. Request body contains all relevant information related to cart (items, quantities, customer type, and many more) to get all the applied discount amounts in the response. The cart repeats the process every time the contents change.

If an item is eligible for multiple promotions, promotions will be applied as per the priority order set. Each promotion type has an assigned priority which is configured by merchants during onboarding. Each promotion type can also be configured as stackable or non-stackable. Stackable promotion means discounts of all the stacked promotions will be summed together and the final discount will be applied. Non-stackable promotion means only the highest discounted amount will be applied for every priority.

Following is a flow-diagram that depicts how a price is calculated by fabric Offers.

Benefits of Using fabric Offers

The controls and automation provided with Offers will drastically reduce operational overhead and ensure that merchants can quickly react to their fast-changing environment.

Following are the key principles that drive fabric Offers:

  • Headless: fabric Offers can be integrated with any ecommerce site.
  • Holistic: fabric Offers provides both pricing and discounting tools.
  • Modular: fabric Offers can be used as a standalone product or with fabric’s platform for faster implementation.
  • Configurable: fabric Offers provides flexibility to configure defaults ad priorities.
  • Operator first: fabric Offers has a simple design that makes it easier to use.

Core Concepts

Following are some of the core concepts of fabric Offers:

Price lists

A price list is a collection of items and their assigned prices. An item can exist in multiple price lists. This gives you the ability to assign different prices to same item. Price lists let you set currency and duration of the prices. For example, if the price list expires, the prices of the items within the price list will also expire.

When requesting prices or evaluating promotions, you should mention the price list ID that you want to use. You can configure the pricing API to include your default price list in all requests.

Promotions

A promotion is a discount on an item, cart or shipping method based on set conditions. The evaluate promotions API (under Dynamic Pricing Engine) lets you submit a range of data that will be referenced against the conditions. 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 an expected discount. As promotions can be linked to specific price lists, it is important to submit the correct price list ID.

Customer segmentation support

Customer segment is a group of customers who are given a unique reference to easily identify them. Customers may be grouped in a number of ways such as demographics, locations or device type. fabric Offers supports the assignment of a customer segment to a promotion so that the promotion is applied only to a specific group of customers. You must provide your customer segment IDs in the ‘Settings’ of the Copilot application.

Pricing and Promotion Features

Following are the pricing and promotion features of fabric Offers:

  • Ability to schedule prices in future
  • Ability to manage prices across priceLists
  • Ability to link promotions to priceLists
  • Allows to create coupons that can be applied to get promotions or discounts
  • Supports both Business-to-Business (B2B) and Business-to-Customer (B2C) with the support of contract pricing for B2B.
  • Ability to perform the following promotion use cases:
    • SKU based promotion: Amount off or % off on specific items
    • Quantity based promotion: Amount off or % off on specific items that are purchased in a certain quantity
    • Cart value based promotion: Amount off or % off on the total cart amount
    • BuyGet promotion: Amount off or % off on specific items based on purchasing a specific bundle of items. For example, buy two shirts, and get one t-shirt free.
    • SpendGet promotion: Amount off or % off on total cart amount based on the amount spent. For example, get a flat 500offifcartamountis500 off if cart amount is 5000 or more.
    • Shipping promotion: Amount off or % off on shipping cost
    • Coupon codes: Applying promotions only when a valid coupon code is submitted
  • Ability to safeguard specific items against discounts (Global exclusions)
  • Ability to link promotions to a customer segment (Segmentation)

Using Offers With Your Storefront

Prerequisites

  1. Product data: fabric Offers needs item name and item SKU for which you want to create price and discount details.
  2. Shipping methods: fabric Offers provides the ability to discount specific shipping methods. For example, you may want to provide free standard delivery but charge amount for next day delivery. Offers will need to know what shipping methods you will use.

You must provide an access token while making an API request. If you don’t include your access token when making an API request, or use an incorrect or outdated one, fabric returns an error.

Your storefront consumes Offers components via REST APIs, which returns a JSON object with the attributes defined in the descriptor files mapped against the static content.

fabric Offers supports both Identity v1 and Identity v2 approaches of getting access tokens. Following Generate Authorization Token section is related to Identity v1 for generating merchant specific access tokens.

Generate Authorization Token

  • You can find your API tokens on the Copilot UI, Or
  • You can use the Login API (/api-identity/auth/local/login) to generate an authorization token. For details, see Offers v1 > API References > Login API

To generate authorization token:

  1. Log in to Copilot with your fabric credentials.
  2. Navigate to Offers
  3. Right click, and then click Inspect.
  4. Navigate to Application tab.
  5. Under Session Storage, click the copilot URL, and find a value for accessToken.
  6. This accessToken value is the authorization token you must use while calling fabric Offers APIs.
Curl Example:
curl --location --request GET 'https://stg02.copilot.fabric.inc/api-offers/price-range/10015766 FOG/priceList/100000' \
--header 'x-site-context: {"date":"2021-11-11T21:48:47.769Z","channel":12,"account":"5f689caa4216e7000750d1ef","stage":"stg02"}' \
--header 'Authorization: eyJraWQiOiItOWxOcTZVcmR3bl9tNFJ2bDd1a2RMN0NUOUNndXIya3VJXzNjUnhnaGhVIiwiYWxnIjoiUlMyNTYifQ.eyJ2ZXIiOjEsImp0aSI6IkFULnpyWHBvQWVBTC1YVDJ0QllCMXhaWFo1NzVfcURYOURQTU1sWGQybXN5RzQiLCJpc3MiOiJodHRwczovL2NvcGlsb3QubG9naW4tc2J4LmZhYnJpYy5pbmMvb2F1dGgyL2F1c29wYm85c3JPUndIY001Njk2IiwiYXVkIjoiYXBpOi8vc2VydmljZSIsImlhdCI6MTY2MDMxNjg2MywiZXhwIjoxNjYwMzE3NDYzLCJjaWQiOiIwb2Exam9rNDhkemFmS2RGbDY5NyIsInNjcCI6WyJzMnMiXSwic3ViIjoiMG9hMWpvazQ4ZHphZktkR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