SDK Core Class Structure and Methods

The Software Development Kit (SDK) is used by developers to create applications that call the Digital Commerce APIs.

Fall '20 Release

The main class is VlocityDigitalCommerce, which has the following methods:

  • getOffers()

    • Retrieve a list of offers

    • Maps to GetOffersByCatalog API (/v3/catalogs/{catalog_code}/offers) or, if the contains parameter is specified, maps to the GetContainsProducts API (/v3/catalogs/{ catalog_code}/offers?contains={product_code})

  • getFilteredOffersList

    • Retrieves a filtered list of products and promotions.
  • getOffer()

    • Retrieves an offer with details

    • Maps to GetOfferDetails API (/v3/catalogs/{ catalog_code}/offers/{offer_code})

  • validateOffer()

    • Validates an offer

    • Maps to Configure Offer API (/v3/catalogs/{ catalog_code}/offers/{offer_code})

    • If the offer is of offerType=Promotion, then the client must get the transactionKey from the first response and then call the same API again with transactionKey in the request POST body. This complexity is handled inside the SDK; therefore the client only needs to call the SDK configureOfferDetails method once regardless of what the offerType is.

  • addToBasket()

    • maps to Basket API: (/v3/catalogs/{catalog_code}/basket)

    • If the offer is of offerType=Promotion, then the client must get the transactionKey from the first response and then call the same API again with transactionKey inside the request Post body. This complexity is handled inside the SDK; therefore client only needs to call SDK addToBasket method once regardless of what the offerType is.

    • The basket is tracked using the cartContextKey in the URL; for an empty basket, there is no need to pass the cartContextKey. After the first call, cartContextKey is returned and the client must include this in all subsequent calls with cartContextKey in request Body. This complexity is handled and automated inside this SDK method.

  • updateItemsInCart()

    • maps to Basket API: (/v3/catalogs/{catalog_code}/basket/{cart_context_key})

    • If the offer is of offerType=Promotion, then the client must get the transactionKey from the first response and then call the same API again with transactionKey inside the request Post body. This complexity is handled inside the SDK; therefore client only needs to call SDK addToBasket method once regardless of what the offerType is.

    • The basket is tracked using the cartContextKey in the URL; for an empty basket, there is no need to pass the cartContextKey. After the first call, cartContextKey is returned and the client must include this in all subsequent calls with cartContextKey in request Body. This complexity is handled and automated inside this SDK method.

  • checkoutCart()

  • getPromotions()

    • Maps to GetOffersByCatalog API: /v3/catalogs/{catalog_code}/offers

    • Returns promotions for all products or for an associated to product.

  • assetToBasket()

    • Maps to Basket API: /v3/catalogs/{catalog_code}/basket/{asset_ID}

    • Create a basket from a given asset ID

  • authenticateUser()

    • Maps to SignIn API: {checkout_SDK_node_server_URL}/signIn

    • Maps to SignUp API: {checkout_SDK_node_server_URL}/signUp

    • Securely login to salesforce using checkout node server SDK

  • updateBillingDetails()

    • Maps to SignIn API: {checkout_SDK_node_server_URL}/updateDetails

    • Securely update shipping and billing address to the Salesforce user account.

  • saveCart()

    • Maps to SignIn API: {checkout_SDK_node_server_URL}/createOrder

    • Securely save the cart by creating an Order.

  • submitOrder()

    • Maps to SignIn API: {checkout_SDK_node_server_URL}/submitOrder

    • Securely create and submit order for given accountId and cartContextKey

  • signOutUser

    • Signs out the user from the ServerSDK.

See the SDK Reference for more details.

For reference information about the Spring '20 SDK release, see Digital Commerce Lightning Web Components (107.0).