# Price Items in Cart (Query)

Retrieve current prices for the items in the cart.

```nolang
GET /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

```nolang
getCartLineItemPrices
```

## REST Handlers

```nolang
REST endpoint: APIPriceCartsCpqV2.cls
Implementation: CpqGetCartLineItemPricesActionV2.cls
```

## Apex Remote Service

```nolang
CpqAppHandler
```

## Apex Remote Input Map

```nolang
{
 "methodName": "getCartLineItemPrices",
 "cartId": "801360000008eNU",
 "priceDetailsFields": "vlocity_cmt__OneTimeCharge__c, vlocity_cmt__RecurringCharge__c, vlocity_cmt__OneTimeTotal__c, vlocity_cmt__RecurringTotal__c"
}
```

## Package

Communication (vlocity_cmt)

## API Parameters and Response Format

For API parameter names and descriptions, see [Cart-Based API Swagger Reference](https://developer.salesforce.com/docs/industries/cme/references/cpq?meta=Summary).

## Resource Information

| Response Format | JSON                                                          |
| --------------- | ------------------------------------------------------------- |
| Resource URL    | `/services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/price` |

## Example Request

```nolang
GET
/services/apexrest/vlocity_cmt/v2/cpq/carts/80146000000iwCx/price?price=true
```

:::note
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.
:::

## Example Response

```nolang
{
  "totalSize": 1,
  "messages": [],
  "records": [
    {
      "messages": [],
      "displaySequence": -1,
      "vlocity_cmt__EffectiveQuantity__c": {
        "value": 1
      },
      "vlocity_cmt__OneTimeCharge__c": {
        "value": 100
      },
      "vlocity_cmt__OneTimeManualDiscount__c": {
        "value": 0
      },
      "vlocity_cmt__OneTimeCalculatedPrice__c": {
        "value": 100
      },
      "vlocity_cmt__OneTimeTotal__c": {
        "value": 100
      },
      "vlocity_cmt__RecurringCharge__c": {
        "value": 20
      },
      "vlocity_cmt__RecurringManualDiscount__c": {
        "value": 0
      },
      "vlocity_cmt__RecurringCalculatedPrice__c": {
        "value": 20
      },
      "vlocity_cmt__RecurringTotal__c": {
        "value": 20
      },
      "vlocity_cmt__EffectiveOneTimeTotal__c": {
        "value": 100
      },
      "vlocity_cmt__EffectiveRecurringTotal__c": {
        "value": 20
      },
      "Quantity": {
        "value": 1
      },
      "Id": {
        "value": "80246000000dwt8AAA"
      },
      "PricebookEntryId": {
        "value": "01u46000001YhBOAA0"
      },
      "vlocity_cmt__LineNumber__c": {
        "value": "0001"
      },
      "PricebookEntry": {
        "attributes": {
          "type": "PricebookEntry",
          "url": "/services/data/v41.0/sobjects/PricebookEntry/01u46000001YhBOAA0"
        },
        "Id": "01u46000001YhBOAA0",
        "Product2Id": "01t46000000LFXRAA4",
        "Pricebook2Id": "01s46000003EDDHAA4",
        "Product2": {
          "attributes": {
            "type": "Product2",
            "url": "/services/data/v41.0/sobjects/Product2/01t46000000LFXRAA4"
          },
          "Id": "01t46000000LFXRAA4",
          "Name": "Product A",
          "ProductCode": "PROD_A",
          "vlocity_cmt__Type__c": "None",
          "vlocity_cmt__IsConfigurable__c": false
        }
      },
      "Name": "Product A"
    }
  ]
}
```
