Dynamic Pricing Engine

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)

post/v1/promo/evaluate-promotions

Request

Headers

x-site-contextstring required
Example:{"date": "2023-01-01T00:00:00.000Z", "channel": 12, "account": "1234abcd5678efgh9ijklmno","stage":"production"}

The x-site-context header is a JSON object that contains information about the source you wish to pull from. The mandatory account is the 24 character identifier found in Copilot. The channel (Sales channel ID), stage (environment name), and date attributes can be used to further narrow the scope of your data source.

Request body

traceIdstring

Trace ID, used to trace logs

isLoggedInboolean

true: user logged in<br /> false: user is not logged in

userIdstring

User ID

promoCodesstring[]

A list of coupon codes that are applicable only for coupons. For coupons, the response includes promo codes associated with the coupon. For promotions, the response includes an empty array.

datestring date-time

Date for which the promotions to be evaluated

userProfileobject[]

Segment the user belongs to

Example request

{
  "traceId": "394823457",
  "isLoggedIn": true,
  "userId": "5e2cfb9b45570b000864c4b5",
  "promoCodes": [
    "SUPERCOUPON1",
    "FIRSTPURCHASE10"
  ],
  "shipping": [
    {
      "shippingPrice": 20
    }
  ],
  "items": [
    {
      "lineItemId": 1,
      "itemId": 1111111,
      "quantity": 5,
      "group": [
        "5e2cfb9b45570b000863c4b5"
      ],
      "hierarchy": [
        [
          "clothingId1",
          "footwear",
          "sandalsId1"
        ],
        [
          "nike",
          "sandalsId2"
        ],
        [
          "clothingId2",
          "beach"
        ]
      ],
      "productAttributes": {
        "color": [
          "red",
          "green"
        ],
        "brand": "Nike",
        "size": "10"
      },
      "priceParams": {
        "options": {
          "length": "2",
          "width": "15",
          "blindMotor": true
        }
      },
      "price": {
        "sale": 10
      },
      "channel": [
        12,
        15
      ],
      "shippingPrice": 20
    }
  ],
  "date": "2019-08-24T14:15:22Z"
}

Response

Successfully evaluated the promotions

errorsstring[]
successboolean

Indicates if promotion is successfully evaluated

Example response

[
  {
    "items": [
      {
        "lineItemId": 1,
        "itemId": 1111111,
        "group": [
          "5e2cfb9b45570b000863c4b5",
          "clothingId1",
          "footwear"
        ],
        "quantity": 5,
        "price": {
          "currency": "USD",
          "base": 10,
          "kind": "BASE",
          "totalPrice": 50,
          "finalPrice": 50,
          "sale": 50
        },
        "priceAttributes": {
          "cost": 9,
          "floor": 10,
          "clearance": 10
        },
        "discount": [
          {
            "quantity": 5,
            "amount": 10,
            "unit": "%OFF",
            "value": 10,
            "promoId": "6197ec46e836ff000952c668",
            "promoCode": "SUPERCOUPON20",
            "promoTitle": "20% off",
            "type": "COUPON",
            "application": 1,
            "isStackable": true,
            "level": 1,
            "stackingType": "STACKABLE",
            "proratedAmount": 10,
            "proratedQuantity": 1
          }
        ],
        "attributes": {
          "color": "red",
          "brand": "Nike",
          "size": "10"
        },
        "shippingPrice": 20,
        "shippingDiscount": 5
      }
    ],
    "errors": [
      "Parameter does not exist"
    ],
    "shipping": [
      {
        "shippingPrice": 5,
        "shippingDiscount": 5
      }
    ],
    "appliedDiscounts": [
      {
        "promoId": "6197ec46e836ff000952c668",
        "promoCode": "SUPERCOUPON20",
        "promoTitle": "20% off",
        "type": "COUPON",
        "amount": 10
      }
    ],
    "suggestedProducts": [
      {
        "promotionId": "6197ec46e836ff000952c668",
        "promotionTitle": "Buy Shoes, get socks for free",
        "sku": "SHOE1234",
        "quantity": 2,
        "free": true,
        "discountType": "%OFF",
        "amount": 100
      }
    ],
    "notAppliedCoupons": [
      {
        "promoCode": "SUPERCOUPON",
        "promoId": "624b5aa2a8fd12000965dfdc",
        "message": "Invalid coupon"
      }
    ],
    "promotionMessages": [
      {
        "promoId": "61df12345678900009b7091c",
        "title": "Buy 2 get 1 free",
        "message": "Offer valid at participating stores through September 5, 2023.",
        "pages": [
          "PDP"
        ],
        "locales": [
          "en-CA"
        ],
        "type": "DISCOUNT",
        "threshold": 2
      }
    ]
  }
]

Changes

No recorded changes to this operation across all 2 revisions of this API.