Salesforce Commerce Pricing and Promotions APIs

The Commerce Pricing and Promotion APIs enable developers to access product prices and promotions, streamlining the development of their applications. These APIs are typically used to populate Product Listing Page and Product Display Page, as well as when users add products to their carts.

The pricing API allows users to retrieve prices for single or multiple products. Product prices are determined by selecting the lowest (or highest priority) price from the pricebooks assigned to the store and any buyer groups the shopper belongs to.

There are two promotion evaluation APIs: Evaluate Products and Evaluate Cart. Evaluate products is commonly used on the Product Display Pages (PDP) and Product Listing Pages (PLP) to display promotion price and promotion messaging. For example, 10% of items in category clothing when you spend $50.

Evaluate cart is invoked during any cart modification, such as adding to the cart, changing quantity, and applying coupons, and during checkout to compute promotion adjustments for the cart. This can either be called as part of the above-mentioned operations or directly through the Webstore Promotions, Evaluate Action API.

Furthermore, it's flexible in assessing promotions for specific products or sets, including variants and independent items, while excluding parent products. The API caters to both domain-dependent and independent needs, utilizing parameters like webstoreId and effectiveAccountId for internal evaluations or external datasets like SKUs.

Lastly, the Coupon API monitors coupon code redemption usage, allowing you to revert previously redeemed codes and tracking increases in usage of coupon codes.

Let's consider a basic scenario for understanding how to use Pricing and Promotion APIs. This example covers just a few Pricing and Promotion APIs APIs and doesn't include the entire APIs functionality. Alt text

In a typical shopping journey, when users land on your store's homepage, they've two options: they can either browse products by category or use the search box to find products, which are then displayed on the Product Listing Page (PLP). If customers choose to browse by category, the Product Listing Page loads, showcasing all products within the chosen category.

The process of displaying products onto the Product Listing Page involves two key steps: firstly, retrieving the list of products along with their prices, and secondly, fetching the promotions entitled to users. Make a GET call on the Webstore Products API to retrieve products and their prices. Make a POST request to Webstore Cart Items API to add product items to the cart and fetch and apply cart-level promotions entitled to users. This API offers the ability to retrieve cart-level promotions that users are entitled to, calculate the required price adjustments, and add the chosen products to the cart, in addition to adding products to the cart. Subsequently, make a GET call on the Webstore Cart Items API to review your cart and proceed with checkout.

Depending on your specific scenario, you may call these independent APIs, such as making a GET or POST request on the Webstore Pricing Products API to retrieve the pricing of products, making a POST request on the Webstore Promotions, Evaluate Products Action API to view the product promotions alongside displaying the products and pricing on the Product Listing Page and compute the applicable price adjustments, or making a POST request to the Webstore Promotions, Evaluate Action API to get promotions entitied to users based on the store and buyer group to be applied to the cart.

Here’s a list of Product Pricing and Promotions resources:

ResourceSupported HTTP MethodsDescription
/commerce/webstores/{webstoreId}/pricing/​products/{productId}GETGet the list and buyer price for a product.
/commerce/webstores/{webstoreId}/pricing/​productsGET, POSTGet the prices for multiple products.
/commerce/promotions/actions/evaluatePOSTDetermine which promotions the customer is eligible for based on the store and buyer group, and compute the applicable price adjustments based on the coupons and the items in the cart. This API evaluates only the first 50 active manual promotions and first 50 active automatic promotions, based on priority. This API computes and returns applicable price adjustments, but it does not apply those adjustments to the webcart record. If you want to enable promotions based on shipping, contact Salesforce Customer Support.
/commerce/promotions/actions/evaluate-productsPOSTDetermine which promotions apply to a product or set of products, and compute the applicable price adjustments. This API evaluates discrete products, including product variants and independent products but not parent products. Domain dependent and independent use cases are both supported. For example, a domain dependent call uses webstoreId and effectiveAccountId to evaluate products in a cart based on internal products or product categories. A domain independent call uses an external dataset based on SKUs or product categories.
/commerce/promotions/actions/decrease-use​/coupon-codesPOSTGet coupon code redemption usage to revert a previously redeemed coupon code.
/commerce/promotions/actions/increase-use​/coupon-codesPOSTGet coupon code redemption addition (increase) usage.

See Also