---
schema_version: "1"
id: b8565609f5b0b26a7ed382d72b9912c7c3f924109c9a625faed0ec4c6ea67dad
title: Submit a Cancel Order Request
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-submit-a-cancel-order-request.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-submit-a-cancel-order-request.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9617a19586821736f0ff4259107537ec573e0e1189843a679317a5cffeac2c9b
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# Submit a Cancel Order Request

Cancel an in-flight order.

```nolang
POST /v2/cpq/carts/{order_ID}/cancel
```

For CME Winter '20 and later releases, the **Cancel** button is used to cancel an in-flight order.

For releases prior to CME Winter '20, the **Cancel Order** button is used to invoke the submitCancelOrder API, create a supplemental order, and submit the order to Order Management.

The submitCancelOrder API uses the Supplemental Order interface implementations that predate the CME Winter '20 release, including SupplementalOrderService and XOMSupplementalOrderLifeCycle. See [In-Flight Order Cancellation](https://help.salesforce.com/s/articleView?id=ind.comms_in_flight_order_cancellation.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.


## Apex Method

Use this method with the supplemental order's ID as input (supplementalOrdId) to submit a cancel order request.

```nolang
public static void submitSupplementalOrder(Id originalOrdId, Id supplementalOrdId)
{
    final String methodName = 'submitCancelOrder';
    Map<String, Object> inputMap = new Map<String, Object>
    {
        'cartId' => originalOrdId,
        'methodName' => methodName,
        'cancelOrderId' => supplementalOrdId
    };
    Map<String, Object> outputMap = new Map<String, Object>();
    Map<String, Object> optionsMap = new Map<String, Object>();
    vlocity_cmt.CpqAppHandler handler = new vlocity_cmt.CpqAppHandler();
    handler.invokeMethod(methodName, inputMap, outputMap, optionsMap);

    // traverse the result that was returned, to find the supplemental order id.
    vlocity_cmt.JSONResult result = (vlocity_cmt.JSONResult) outputMap.get('result');
}
```

## 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/{order_ID}/cancel` |

## Example Request

```nolang
POST
/services/apexrest/v2/cpq/carts/{order_ID}/cancel
```


## Example Request Body

```nolang
{
  "cartId": "order_ID",
  "subaction": "submitCancelOrder",
  "cancelOrderId": "supplemental_order_ID"
}
```

**See Also**

- [Cancel Order](https://developer.salesforce.com/docs/industries/cme/guide/comms-cancel-order.md)
- [Create Supplemental Order](https://developer.salesforce.com/docs/industries/cme/guide/comms-create-supplemental-order.md)
- [In-Flight Order Cancellation](https://help.salesforce.com/s/articleView?id=ind.comms_in_flight_order_cancellation.htm)
