---
schema_version: "1"
id: 7ddee8f53614781d3a12032c1fa6ea0d67181dfbc482c86a1f9c339ee8a6bdce
title: "SDK Example: ValidateOffer (Fall '20)"
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-t-sdk-examplevalidateofferfall20-.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sdk-examplevalidateofferfall20-.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 4c87f28768de36c1b900d314385b58fbc53143b076ce345c3165d7f7db305d22
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# SDK Example: ValidateOffer (Fall '20)

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
 (Fall '20)
// 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
input.secureApiCall = false; // set to true if needs secure api calls without context parameters and session key.
// 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."
