Price Items in Cart (Query)

Retrieve current prices for the items in the cart.

1GET /v2/cpq/carts/{cart_ID}/price?price={true|false}&priceDetailsFields={field_name}%2C{field_name}

This API provides a way of retrieving minimal pricing fields to refresh the UI. It is called by the UI after a putCartsItems call. When this API is called by the CPQ cart UI, it uses price=false, so the pricing interface implementation is not executed.

This API can be called either through REST or through Apex remote calls. The default value for the price parameter is true. If price=false is not specified, pricing is executed by default. Specify price=false if you do not want to execute pricing.

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 

1getCartLineItemPrices

REST Handlers 

1REST endpoint: APIPriceCartsCpqV2.cls
2Implementation: CpqGetCartLineItemPricesActionV2.cls

Apex Remote Service 

1CpqAppHandler

Apex Remote Input Map 

1{
2 "methodName": "getCartLineItemPrices",
3 "cartId": "801360000008eNU",
4 "priceDetailsFields": "vlocity_cmt__OneTimeCharge__c, vlocity_cmt__RecurringCharge__c, vlocity_cmt__OneTimeTotal__c, vlocity_cmt__RecurringTotal__c"
5}

Package 

Communication (vlocity_cmt)

API Parameters and Response Format 

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

Resource Information 

Response FormatJSON
Resource URL/services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/price

Example Request 

1GET
2/services/apexrest/vlocity_cmt/v2/cpq/carts/80146000000iwCx/price?price=true

Setting price=true will run the pricing engine, which can negatively impact performance. To enhance performance, set price=false to return pricing information without repricing.

Note

Example Response 

1{
2  "totalSize": 1,
3  "messages": [],
4  "records": [
5    {
6      "messages": [],
7      "displaySequence": -1,
8      "vlocity_cmt__EffectiveQuantity__c": {
9        "value": 1
10      },
11      "vlocity_cmt__OneTimeCharge__c": {
12        "value": 100
13      },
14      "vlocity_cmt__OneTimeManualDiscount__c": {
15        "value": 0
16      },
17      "vlocity_cmt__OneTimeCalculatedPrice__c": {
18        "value": 100
19      },
20      "vlocity_cmt__OneTimeTotal__c": {
21        "value": 100
22      },
23      "vlocity_cmt__RecurringCharge__c": {
24        "value": 20
25      },
26      "vlocity_cmt__RecurringManualDiscount__c": {
27        "value": 0
28      },
29      "vlocity_cmt__RecurringCalculatedPrice__c": {
30        "value": 20
31      },
32      "vlocity_cmt__RecurringTotal__c": {
33        "value": 20
34      },
35      "vlocity_cmt__EffectiveOneTimeTotal__c": {
36        "value": 100
37      },
38      "vlocity_cmt__EffectiveRecurringTotal__c": {
39        "value": 20
40      },
41      "Quantity": {
42        "value": 1
43      },
44      "Id": {
45        "value": "80246000000dwt8AAA"
46      },
47      "PricebookEntryId": {
48        "value": "01u46000001YhBOAA0"
49      },
50      "vlocity_cmt__LineNumber__c": {
51        "value": "0001"
52      },
53      "PricebookEntry": {
54        "attributes": {
55          "type": "PricebookEntry",
56          "url": "/services/data/v41.0/sobjects/PricebookEntry/01u46000001YhBOAA0"
57        },
58        "Id": "01u46000001YhBOAA0",
59        "Product2Id": "01t46000000LFXRAA4",
60        "Pricebook2Id": "01s46000003EDDHAA4",
61        "Product2": {
62          "attributes": {
63            "type": "Product2",
64            "url": "/services/data/v41.0/sobjects/Product2/01t46000000LFXRAA4"
65          },
66          "Id": "01t46000000LFXRAA4",
67          "Name": "Product A",
68          "ProductCode": "PROD_A",
69          "vlocity_cmt__Type__c": "None",
70          "vlocity_cmt__IsConfigurable__c": false
71        }
72      },
73      "Name": "Product A"
74    }
75  ]
76}