# Checkout Items in Cart

Based on the header object, submit the object to create the quote, order, or assets.

- If the header object is Opportunity, submit the opportunity to create a quote.

- If the header object is Quote, submit the quote to create an order.

- If the header object is Order, submit the order to create assets.

```nolang
POST /v2/cpq/carts/{cart_ID}/items/checkout
```

These APIs replace the following methods in [OmniCPQServiceWrapper](/docs/industries/cme/guide/comms-cpq-apis-to-replace-omnicpqservicewrapper.md):

- Submit Opportunity replaces OmniCPQServceWrapper `submitOpportunity`.

- Submit Order replaces OmniCPQServiceWrapper `submitOrder`.

- Submit Quote replaces OmniCPQServiceWrapper `submitQuote`.

For more information, see [OmniCPQServiceWrapper](https://help.salesforce.com/s/articleView?id=ind.v_dev_t_omnicpqservicewrapper\_661885.htm). 

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
checkout
```

## REST Handler

```nolang
APICheckoutItemsCartsCPQV2
```

## Apex Remote Service

```nolang
CpqAppHandler
```

## Apex Remote Input Map

ContextId is required for the Checkout Items in Cart remote action, which is used in the [Guided Selling OmniScript](https://help.salesforce.com/s/articleView?id=ind.comms_guided_selling_omniscript_using_cpq_apis.htm).

```nolang
{
  methodName:"checkout"
  cartId:801360000008eNU
  ContextId:801360000008eNU
}
```

## 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}/items/checkout` |

## Example Request

```nolang
POST
/v2/cpq/carts/{cart_ID}/items/checkout
```

## Example Responses

:::note
Submit Opportunity

```nolang
{
   "totalSize":1,
   "messages":[],
   "records":
   [
      {
         "messages":[],
         "displaySequence":-1,
         "id":"0Q01I000000TvNmSAK",
         "objectType":"Quote"
      }
   ]
}
```
:::

:::note
Submit Order

```nolang
"records": [
{
   "messages": [],
   "displaySequence": -1,
   "id": "00146000004DeR9AAK",
   "objectType": "Account"
}
]
```
:::

:::note
Submit Quote

```nolang
{
   "totalSize":1,
   "messages":[],
   "records":
   [
      {
         "messages":[],
         "displaySequence":-1,
         "id":"8011I000000KZW3QAO",
         "objectType":"Order"
      }
   ]
}
```
:::
