---
schema_version: "1"
id: b289ec630e3c1bd25be49393158c255f9f6102c12702f77cea1485aea353afff
title: "SDK Example: Save the Cart (Winter '20)"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-t-sdk-examplesave-the-cartwinter20-.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-examplesave-the-cartwinter20-.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: fa9af52c9d0769f837c7cff3569e399fdc685bd3b15ec9d313dea8d8d694c232
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: Save the Cart (Winter '20)

Use the example SDK code in this topic to save the cart by creating an order for the specified basket.

```nolang
// Instantiate the input object for saveCart to specify parameters
const input = digitalCommerce.createSaveCartInput();
input.email = "YOUR EMAIL ID";
input.catalogCode = "CATALOG CODE";
input.cartContextKey = "CART CONTEXT KEY";

// Invoke saveCart API
digitalCommerce
  .saveCart(input)
  .then(response => {
    Logger.info(
      "Vlocity digital commerce saveCart: " + JSON.stringify(response)
    );
  })
  .catch(error => {
    Logger.info("saveCart apexrest call failed" + error);
  });
```

Possible error conditions:

"SaveCartInput::getRequestPayload() must have email."

"SaveCartInput::getRequestPayload() must have catalogCode."

"SaveCartInput::getRequestPayload() must have cartContextKey."
