---
schema_version: "1"
id: 790c0b75bf3c5e01faf28c20d92b7aa3b727906421a8d4e4363873f9d09c0b2d
title: Validate Cart Action
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-validate-cart-action.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-validate-cart-action.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5590182b221fa70baad5177daf312640bd8ac680ab8908a2ca3794302a075816
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# Validate Cart Action

Run validation and pricing for the items in the cart. This API runs the implementations defined in your org under the product validation and pricing interfaces.

```nolang
POST /v2/cpq/carts/{cart_ID}/validate
```

Salesforce provides multiple implementations for product validation and pricing interfaces. The product validation implementation will typically run the configuration rules and the pricing implementations will run the pricing rules.

## Remote Method

```nolang
runCartValidation
```

## REST Handler

```nolang
validate
```

## Apex Remote Service

Class:

```nolang
vlocity_cmt.CardCanvasController
```

Method:

```nolang
global static Object doGenericInvoke(String sClassName, String sMethodName, String input, String options)
```

## Apex Remote Input Map

```nolang
String sClassName: vlocity_cmt.CpqAppHandler
String sMethodName: runCartValidation
String input: {
 "cartId": "8011N00000157LkQAI",
 "methodName": "runCartValidation",
 "price": true,
 "validate": true
}
String options: {
 "vlcClass": "vlocity_cmt.CpqAppHandler"
}
```

## 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    | `/v2/cpq/carts/{cart_ID}/validate` Example: `/services/apexrest/vlocity_cmt/v2/cpq/carts/801360000000oQ9/validate` |

## Example Request

```nolang
{
    "cartId": "8011N00000157LkQAI",
    "methodName": "runCartValidation",
    "price": true,
    "validate": true
}
```

## Example Response

```nolang
{
  "totalSize": 0,
  "messages": [],
  "actions": {
    "itemadded": {
      "rest": {
        "params": {},
        "method": null,
        "link": null
      },
      "remote": {
        "params": {}
      },
      "client": {
        "params": {
          "items": [
            {
              "message": "Product Hier 6 Child 3 has been auto-added to the cart.",
              "Id": "8021N000006wtUCQAY"
            }
          ]
        },
        "records": [
          {
            "messages": [],
            "actions": {
              "addtocart": {
                "rest": {
                  "params": {
                    "items": [
                      {
                        "quantity": 1,
                        "parentId": "8021N000006wtU7QAI",
                        "itemId": "01u1N00000C1WAlQAN"
                      }
                    ],
                    "cartId": "8011N00000157LkQAI",
                    "price": true,
                    "validate": true,
                    "includeAttachment": false,
                    "pagesize": 20,
                    "lastRecordId": null,
                    "query": null
                  },
                  "method": "POST",
                  "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/8011N00000157LkQAI/items"
                },
                "remote": {
                  "params": {
                    "methodName": "postCartsItems",
                    "items": [
                      {
                        "quantity": 1,
                        "parentId": "8021N000006wtU7QAI",
                        "itemId": "01u1N00000C1WAlQAN"
                      }
                    ],
                    "cartId": "8011N00000157LkQAI",
                    "price": true,
                    "validate": true,
                    "includeAttachment": false,
                    "pagesize": 20,
                    "lastRecordId": null,
                    "query": null
                  }
                },
                "client": {
                  "params": {}
                }
              },
              "updateitems": {
                "rest": {
                  "params": {
                    "items": [
                      {
                        "itemId": "8021N000006wtU7QAI"
                      }
                    ],
                    "filters": null,
                    "fields": null,
                    "cartId": "8011N00000157LkQAI",
                    "price": true,
                    "validate": true,
                    "includeAttachment": false,
                    "pagesize": 20,
                    "lastRecordId": null,
                    "query": null
                  },
                  "method": "PUT",
                  "link": "/services/apexrest/vlocity_cmt/v2/cpq/carts/8011N00000157LkQAI/items"
                },
                "remote": {
                  "params": {
                    "methodName": "putCartsItems",
                    "items": [
                      {
                        "itemId": "8021N000006wtU7QAI"
                      }
                    ],
                    "filters": null,
                    "fields": null,
                    "cartId": "8011N00000157LkQAI",
                    "price": true,
                    "validate": true,
                    "includeAttachment": false,
                    "pagesize": 20,
                    "lastRecordId": null,
                    "query": null
                  }
                },
                "client": {
                  "params": {}
                }
              },
...
[EXAMPLE TRUNCATED FOR BREVITY]
```
