- Support
- Product Releases
- Blog
- Overview
- API References
- API Authentication
- Getting Started with fabric APIs
- Making your first API request
- Example
- Using Developer Portal
- Security and Compliance
- Product Catalog API - Overview
- Developer Guide
Attributes & Attribute Mapping
Categories
Products
Collections
Background Jobs
Bulk Import & Export
Published Products
Allocations
- Orders (3.0.0)
Backorders Preorders
Exports
Developer Guide
Invoices
Shopping Lists
Shopping List Items
Notifications
Orders
Returns
Cancellations
Tracking
Frauds
Payments
Appeasements
Credits
Shipments
Shipping Methods
Shipping Method Items
Webhooks
- Orders FAQ(s)
- Overview
- Algolia standard integration
- Avalara standard integration
- Constructor.io standard integration
- Stripe standard integration
- Offers (3.0.0)
Real-time Pricing Engine
Promotions
Webhook Events
Redemptions
Priced Products
Product Exclusion Lists
Price Types
Coupons
Coupon Codes
Segments
Prices
Price Methods
Price Controls
Price Lists
Add-ons
Exports
Imports
Attributes
Customer Profile
Customer Address
Customer Self
Getting Started
Product Catalog
Orders
Integrations
Offers
Customers
Evaluate cart promotions
Evaluate cart’s total cost instantly, after applying all applicable promotions and discount coupons. Using this endpoint, submit a range of data that will be referenced against the conditions that are set earlier using the promotions, coupons or prices APIs. The response includes the details of the promotions and discounts applied. These promotions and discounts can be displayed on your website to help shoppers know that they are getting their expected discounts.
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Merchant's 24-character tenant ID
The Date and time, in ISO 8601 format, for which the evaluation should be done. The prices and promotions that are active on this date will be considered for evaluation.
A unique request ID.
The sales channel ID.
A sample cart evaluation request.
Customer details
Unique identifier for the customer
List of segments to which the customer belongs
Promotion codes to be applied
The details of items in the cart.
The language code, which is a combination of language (ISO 639 format) and country (ISO 3166 format). <br />Default value is en-US.
curl --request POST \
--url https://api.fabric.inc/v3/price-engine/actions/evaluate-cart \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-fabric-channel-id: <x-fabric-channel-id>' \
--header 'x-fabric-tenant-id: <x-fabric-tenant-id>' \
--data '{
"customer": {
"id": "5e2cfb9b45570b000864c4b5",
"segments": [
{
"name": "category",
"value": [
"GOLD",
"YELLOW"
]
},
{
"name": "ageGroup",
"value": [
"elderly"
]
}
]
},
"couponCodes": [
"SUPERCOUPON1"
],
"cartItems": [
{
"itemId": 1730902008,
"position": 1,
"sku": "16B2GS8LD5FDS",
"productAttributes": [
{
"attributeId": "60c2a358eb2ec30008ae70a1",
"name": "gift wrapping (small)",
"description": "Gift wrapping for a small package",
"mapping": "ITEM",
"type": "GIFT",
"value": "true",
"price": 10,
"level": "order"
}
],
"quantity": 15,
"priceListId": 108674,
"price": {
"sale": 1000.15,
"cost": 900.15,
"base": 2000.15,
"unitPriceWithoutDiscounts": 2000.15,
"lineTotalWithoutDiscounts": 2000.15,
"lineTotalWithDiscounts": 2000.15,
"type": "BASE"
},
"groups": [
"61d38e117162b7dba69c3d6d"
],
"attributes": {
"productFamily": "Laptop computers"
},
"shippingDetails": {
"shippingCost": 150.25,
"shippingMethodId": "dfsae-2d32113-32lpdd",
"shippingDiscount": 150.25,
"shippingMethodName": "Express Delivery"
},
"productCollections": [
"5e2cfb9b45570b000863c4b5"
]
}
],
"locale": "en-US"
}'
{
"cartItems": [
{
"itemId": 1730902008,
"position": 1,
"sku": "16B2GS8LD5FDS",
"productAttributes": [
{
"attributeId": "60c2a358eb2ec30008ae70a1",
"name": "gift wrapping (small)",
"description": "Gift wrapping for a small package",
"mapping": "ITEM",
"type": "GIFT",
"value": "true",
"price": 10,
"level": "order"
}
],
"quantity": 15,
"priceListId": 108674,
"price": {
"sale": 1000.15,
"cost": 900.15,
"base": 2000.15,
"unitPriceWithoutDiscounts": 2000.15,
"lineTotalWithoutDiscounts": 2000.15,
"lineTotalWithDiscounts": 2000.15,
"type": "BASE"
},
"groups": [
"61d38e117162b7dba69c3d6d"
],
"attributes": {
"productFamily": "Laptop computers"
},
"shippingDetails": {
"shippingCost": 150.25,
"shippingMethodId": "dfsae-2d32113-32lpdd",
"shippingDiscount": 150.25,
"shippingMethodName": "Express Delivery"
},
"discounts": [
{
"amount": 100.15,
"quantity": 1,
"proratedAmount": 100.15,
"proratedQuantity": 1,
"application": 1,
"promotion": {
"id": "6197ec46e836ff000952d668",
"value": 2000.15,
"groupId": "61a6354d0d70e30009415f16",
"level": 1,
"isStackable": true,
"isAlwaysApplied": true,
"name": "20% OFF",
"type": "Coupon",
"discountType": "AMOUNT_OFF"
}
}
],
"priceAttributes": {
"floor": 1000.15,
"cost": 900.15,
"clearance": 2000.15
},
"productCollections": [
"5e2cfb9b45570b000863c4b5"
]
}
],
"errors": [
"Parameter does not exist"
],
"appliedDiscounts": [
{
"promotionId": "6197ec46e836ff000952c665",
"promotionName": "Buy shoes get socks for free",
"couponCode": "SUPERCOUPON20",
"type": "COUPON",
"amount": 105.15
}
],
"suggestedProducts": [
{
"promotionId": "6197ec46e836ff000952c665",
"promotionName": "Buy shoes get socks for free",
"itemId": 234343,
"itemIds": [
1120201,
1120202
],
"sku": "SHOE1234",
"skus": [
"SHOE-1",
"SHOE-2"
],
"eligiblePriceLists": [
10000
],
"quantity": 2,
"promotionQuantity": 10,
"isFree": true,
"discountType": "PERCENTAGE_OFF",
"amount": 105.15
}
],
"notAppliedCoupons": [
{
"couponCode": "SUPERCOUPON",
"promotionId": "624b5aa2a8fd12000965dfdc",
"message": "Invalid coupon"
}
],
"promotionMessages": [
{
"title": "Buy 1 get 1 free",
"message": "Offer valid at participating stores through September 5, 2023.",
"pages": [
"PDP",
"Cart"
],
"locales": [
"en-CA",
"fr-CA"
],
"promoId": "61df12345678900009b7091c"
}
]
}
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Headers
Merchant's 24-character tenant ID
The Date and time, in ISO 8601 format, for which the evaluation should be done. The prices and promotions that are active on this date will be considered for evaluation.
A unique request ID.
The sales channel ID.
Body
Customer details
Unique identifier for the customer
List of segments to which the customer belongs
Segment name
Segment values
Promotion codes to be applied
The details of items in the cart.
Item ID obtained from Product Catalog
Line item position (starts at 1)
Line item SKU
Line item product attributes
Attribute ID
Attribute name
Attribute description
Attribute mapping
Attribute type
Attribute value
Attribute price
Attribute level
Line item quantity within the cart
The price list ID of the line item.
Individual line item price
Price at which the product is offered for sale
Cost of goods sold, from either producing or purchasing from other vendors
Starting price of a single item
Price of a single item without discount. This price is either the base
or sale
price. The type used is noted in the type
property.
Total price of all items without calculating discounts. This is the unitPriceWithoutDiscounts
multiplied by the quantity.
Total price of all items after all discounts. This is the unitPriceWithoutDiscounts multiplied by the quantity, less the promotion discount(s).
Price type
Currency string value
List of group IDs for groups or category the line items belongs to
Line item attributes passed by caller
Shipping details
Shipping cost
Shipping method ID
Discount amount
Shipping method name
The collections associated with given item.
The language code, which is a combination of language (ISO 639 format) and country (ISO 3166 format). <br />Default value is en-US.
Response
The list of items in the cart.
Item ID obtained from Product Catalog
Line item position (starts at 1)
Line item SKU
Line item product attributes
Attribute ID
Attribute name
Attribute description
Attribute mapping
Attribute type
Attribute value
Attribute price
Attribute level
Line item quantity within the cart
The price list ID of the line item.
Individual line item price
Price at which the product is offered for sale
Cost of goods sold, from either producing or purchasing from other vendors
Starting price of a single item
Price of a single item without discount. This price is either the base
or sale
price. The type used is noted in the type
property.
Total price of all items without calculating discounts. This is the unitPriceWithoutDiscounts
multiplied by the quantity.
Total price of all items after all discounts. This is the unitPriceWithoutDiscounts multiplied by the quantity, less the promotion discount(s).
Price type
Currency string value
List of group IDs for groups or category the line items belongs to
Line item attributes passed by caller
Shipping details
Shipping cost
Shipping method ID
Discount amount
Shipping method name
A list of applicable discounts.
Actual discount amount
The number of items eligible for the promotional discount.
The discount amount distributed proportionally among all the selected items. The distribution is determined based on each item's price relative to the total price of all participating items. Typically, proratedAmount
matches the amount
. However, there might be variations, particularly in the context of Buy-Get promotions.
This is used in conjunction with proratedAmount
to determine the discount portion allocated to the respective units of BuyGet promotions. This is applicable in partial return scenarios.
An identifier for an instance of the Buy-Get promotion that can be applied repeatedly. For example, consider a promotion - Buy 1 shirt and get 1 pant at a 20% off. If a shopper buys three shirts, 20% discount is individually applied to each shirt-pant pair. Each such discounted pair is assigned a unique application
number for tracking purposes.
The promotion details.
A 24-character system-generated Promotion ID.
The discount in percent or amount.
ID of the group or category this product belongs to
The order in which the current promotion is executed.
A flag indicating whether the promotion is stackable. Set to true
to combine the given promotion with other promotions. The discount of the current promotion is combined with other promotions, if applicable, to the item. Set to false
if the promotion is not stackable; the given promotion cannot be combined with other promotions.
A flag indicating whether the promotion is always applied regardless of any exclusive promotions on the same item. Set to true
if the promotion is always applied and set to false
if the promotion is not applied on the item by default.
The name of the promotion.
The type of the promotion.
The type of discount.
PERCENTAGE_OFF
, AMOUNT_OFF
, FIXED_PRICE
Price attributes
Cost price
Lowest price at which a product is sold
Selling price
The collections associated with given item.
The error details.
The details of the discounts applied to the cart.
Promotion ID
Coupon code
Promotion name
Promotion type
Discount amount
Suggested free products
The promotion ID
The promotion name
The item ID of the free product
The suggested item IDs from which shoppers can choose one or more items based on the configuration of BuyGet promotion. Even if an item ID is already in the cart, they appear in the list of potential item IDs. This ensures visibility and enables shoppers to make informed decisions during the checkout process.
The Stock Keeping Unit (SKU) of the free product.
The suggested SKUs from which shoppers can choose one or more items based on the configuration of BuyGet promotion. Even if an SKU is already in the cart, they appear in the list of potential SKUs. This ensures visibility and enables shoppers to make informed decisions during the checkout process.
Th price list IDs eligible for promotion. When they are not specified, promotion applies to all price lists.
The number of complimentary items in the promotion.
The maximum limit of complimentary items available for the BuyGet promotion. For example, consider the promotionQuantity
is 10 and promotion condition is Buy 1 pair of shoes and Get 1 pair of socks free. If a shopper purchases up to 10 pairs of shoes, they will get an equivalent number of socks for free. However, even if they buy more than 10 pairs of shoes, the maximum free pairs of socks will remain 10, as defined by the promotionQuantity
parameter.
A flag indicating whether a free item is included as part of promotion. Set to true
to indicate a free item is offered as promotion and false
to indicate otherwise.
The type of discount.
The discount amount.
Rejected coupons
Coupon code
Promotion ID
Reason why coupon not applied
The message displayed for the promotion.
Message name
Message description
The types of web pages where the message is displayed.
The locales in which the promotion message is displayed. Locale is a set of language or country-based preferences for user interface.
Promotion ID
Was this page helpful?
curl --request POST \
--url https://api.fabric.inc/v3/price-engine/actions/evaluate-cart \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-fabric-channel-id: <x-fabric-channel-id>' \
--header 'x-fabric-tenant-id: <x-fabric-tenant-id>' \
--data '{
"customer": {
"id": "5e2cfb9b45570b000864c4b5",
"segments": [
{
"name": "category",
"value": [
"GOLD",
"YELLOW"
]
},
{
"name": "ageGroup",
"value": [
"elderly"
]
}
]
},
"couponCodes": [
"SUPERCOUPON1"
],
"cartItems": [
{
"itemId": 1730902008,
"position": 1,
"sku": "16B2GS8LD5FDS",
"productAttributes": [
{
"attributeId": "60c2a358eb2ec30008ae70a1",
"name": "gift wrapping (small)",
"description": "Gift wrapping for a small package",
"mapping": "ITEM",
"type": "GIFT",
"value": "true",
"price": 10,
"level": "order"
}
],
"quantity": 15,
"priceListId": 108674,
"price": {
"sale": 1000.15,
"cost": 900.15,
"base": 2000.15,
"unitPriceWithoutDiscounts": 2000.15,
"lineTotalWithoutDiscounts": 2000.15,
"lineTotalWithDiscounts": 2000.15,
"type": "BASE"
},
"groups": [
"61d38e117162b7dba69c3d6d"
],
"attributes": {
"productFamily": "Laptop computers"
},
"shippingDetails": {
"shippingCost": 150.25,
"shippingMethodId": "dfsae-2d32113-32lpdd",
"shippingDiscount": 150.25,
"shippingMethodName": "Express Delivery"
},
"productCollections": [
"5e2cfb9b45570b000863c4b5"
]
}
],
"locale": "en-US"
}'
{
"cartItems": [
{
"itemId": 1730902008,
"position": 1,
"sku": "16B2GS8LD5FDS",
"productAttributes": [
{
"attributeId": "60c2a358eb2ec30008ae70a1",
"name": "gift wrapping (small)",
"description": "Gift wrapping for a small package",
"mapping": "ITEM",
"type": "GIFT",
"value": "true",
"price": 10,
"level": "order"
}
],
"quantity": 15,
"priceListId": 108674,
"price": {
"sale": 1000.15,
"cost": 900.15,
"base": 2000.15,
"unitPriceWithoutDiscounts": 2000.15,
"lineTotalWithoutDiscounts": 2000.15,
"lineTotalWithDiscounts": 2000.15,
"type": "BASE"
},
"groups": [
"61d38e117162b7dba69c3d6d"
],
"attributes": {
"productFamily": "Laptop computers"
},
"shippingDetails": {
"shippingCost": 150.25,
"shippingMethodId": "dfsae-2d32113-32lpdd",
"shippingDiscount": 150.25,
"shippingMethodName": "Express Delivery"
},
"discounts": [
{
"amount": 100.15,
"quantity": 1,
"proratedAmount": 100.15,
"proratedQuantity": 1,
"application": 1,
"promotion": {
"id": "6197ec46e836ff000952d668",
"value": 2000.15,
"groupId": "61a6354d0d70e30009415f16",
"level": 1,
"isStackable": true,
"isAlwaysApplied": true,
"name": "20% OFF",
"type": "Coupon",
"discountType": "AMOUNT_OFF"
}
}
],
"priceAttributes": {
"floor": 1000.15,
"cost": 900.15,
"clearance": 2000.15
},
"productCollections": [
"5e2cfb9b45570b000863c4b5"
]
}
],
"errors": [
"Parameter does not exist"
],
"appliedDiscounts": [
{
"promotionId": "6197ec46e836ff000952c665",
"promotionName": "Buy shoes get socks for free",
"couponCode": "SUPERCOUPON20",
"type": "COUPON",
"amount": 105.15
}
],
"suggestedProducts": [
{
"promotionId": "6197ec46e836ff000952c665",
"promotionName": "Buy shoes get socks for free",
"itemId": 234343,
"itemIds": [
1120201,
1120202
],
"sku": "SHOE1234",
"skus": [
"SHOE-1",
"SHOE-2"
],
"eligiblePriceLists": [
10000
],
"quantity": 2,
"promotionQuantity": 10,
"isFree": true,
"discountType": "PERCENTAGE_OFF",
"amount": 105.15
}
],
"notAppliedCoupons": [
{
"couponCode": "SUPERCOUPON",
"promotionId": "624b5aa2a8fd12000965dfdc",
"message": "Invalid coupon"
}
],
"promotionMessages": [
{
"title": "Buy 1 get 1 free",
"message": "Offer valid at participating stores through September 5, 2023.",
"pages": [
"PDP",
"Cart"
],
"locales": [
"en-CA",
"fr-CA"
],
"promoId": "61df12345678900009b7091c"
}
]
}