---
schema_version: "1"
id: 2f7a001c6ce5c56317bfe2caacd5086a67f080f1d5c75598bad0a3a16f0de28c
title: "SDK Example: ValidateOffer (Fall '19)"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-t-sdk-examplevalidateofferfall19-.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-examplevalidateofferfall19-.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 05a0658255757fd0a7c960e62d3764fe82ac61d4ced88a6392c8dd7fb7f1b7a7
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: ValidateOffer (Fall '19)

Use the example SDK code in this topic to validate an offer.

```nolang
// Instantiate the input object for validateOffer to specify parameters
const input = digitalCommerce.createValidateOfferInput();
input.catalogCode = "Phones"; // use your Catalog Code
input.offerCode = "iPhoneX"; // use your Offer Code

// input.offerConfiguration: use digitalCommerce.getSelectedOffer(offerCode)
input.offerConfiguration = digitalCommerce.getSelectedOffer(offerCode);
input.customFields = ["customAttribute__c"]; // optional field which returns your custom attributes or any given keys
// Invoke ConfigureOfferDetails API via method validateOffer()
digitalCommerce
  .validateOffer(input)
  .then(response => {
    Logger.info(
      "vlocity validate offer for anonymous user" + JSON.stringify(response)
    );
  })
  .catch(error => {
    Logger.info("vlocity validateOffer for anonymous user failed" + error);
  });

```

Possible error conditions:

"ValidateOfferInput::getAPIPath() must have catalogCode."

"ValidateOfferInput::getAPIPath() must have offerCode."

"ValidateOfferInput::getPostBody() must have productConfiguration."
