POST
/
price-engine
/
actions
/
evaluate-cart
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

Authorization
string
headerrequired

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-fabric-tenant-id
string
required

Merchant's 24-character tenant ID

x-fabric-date
string

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.

x-fabric-request-id
string

A unique request ID.

x-fabric-channel-id
string
required

The sales channel ID.

Body

application/json
customer
object

Customer details

couponCodes
string[]

Promotion codes to be applied

cartItems
object[]
required

The details of items in the cart.

locale
string

The language code, which is a combination of language (ISO 639 format) and country (ISO 3166 format). <br />Default value is en-US.

Response

200 - application/json
cartItems
object[]

The list of items in the cart.

errors
string[]

The error details.

appliedDiscounts
object[]

The details of the discounts applied to the cart.

suggestedProducts
object[]

Suggested free products

notAppliedCoupons
object[]

Rejected coupons

promotionMessages
object[]

The message displayed for the promotion.