Cancel an in-flight order.
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.
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.
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.
Resource Information
| Response Format | JSON |
|---|---|
| Resource URL | /services/apexrest/{namespace}/v2/cpq/carts/{order_ID}/cancel |
Example Request
POST
/services/apexrest/v2/cpq/carts/{order_ID}/cancel
Example Request Body
{
"cartId": "order_ID",
"subaction": "submitCancelOrder",
"cancelOrderId": "supplemental_order_ID"
}
See Also