Add Promotion to Cart

Add a promotion to the specified cart. If an optional child product belongs to a promotion, the promotion is applied to the newly added product when that product is added to the cart.

POST /v2/cpq/carts/{cart_ID}/promotions

This API supports the guest user enhancements that Salesforce introduced with the Winter ‘21 release. To encrypt and decrypt data for guest users, use the UserSecurity class with this API. See Guest User Technical Details.

For additional information, ​see UserSecurity Class and CPQ and Digital Commerce Changes for Guest Users.

Remote Method

postCartsPromoItems

REST Handler

APIPromotionsCartsCpqV2

Apex Remote Service

CpqAppHandler

Apex Remote Input Map

{
  methodName:"postCartsPromoItems",
  cartId:801360000008eNU,
  items:[ { itemId:01t36000000pfcKAAQ }]
}

Package

Communication (vlocity_cmt)

API Parameters and Response Format

For API parameter names and descriptions, see Cart-Based API Swagger Reference.

Resource Information

Response Format JSON
Resource URL /services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/promotions

Example Request

POST
{
  "items": [
    {
      "itemId": "a30460000001vbgAAA"
    }
  ],
  "price": false,
  "validate": false
}

Example Response

{
  "messages": [
    {
      "severity": "string",
      "messageId": "string",
      "code": 0,
      "message": "Successfully completed"
    }
  ],
  "records": [
    {
      "messages": [
        {
          "severity": "string",
          "messageId": "string",
          "code": 0,
          "message": "Successfully completed"
        }
      ],
      "displaySequence": -1,
      "Id": "8016A000000bwElQAI",
      "Name": "New customer order",
      "EffectiveDate": "2017-12-25",
      "AccountId": "0016A0000053kHN",
      "Account.Name": "Acme Inc.",
      "EffectiveRecurringTotal__c": 0,
      "EffectiveOneTimeTotal__c": 0,
      "EffectiveOrderTotal__c": 0,
      "OrderNumber": "00000141",
      "Status": "Draft"
    }
  ]
}