In the request URL, you can specify up to 50 IDs. If you specify an ID that contains either parentheses or the separator characters, you must URL encode these characters. Each request returns only enabled promotions as the server does not consider promotion qualifiers or schedules.
If you would like to get a raw Response object use the other getPromotions function.
An object containing the options for this method.
A promise of type PromotionResult.
In the request URL, you can specify up to 50 IDs. If you specify an ID that contains either parentheses or the separator characters, you must URL encode these characters. Each request returns only enabled promotions as the server does not consider promotion qualifiers or schedules.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type PromotionResult otherwise.
Retrieves promotion information using filter criteria. In the request URL, you must provide a campaign_id parameter, and you can optionally specify a date range by providing start_date and end_date parameters. Both parameters are required to specify a date range, and omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled promotions, since the server does not consider promotion qualifiers or schedules.
If you would like to get a raw Response object use the other getPromotionsForCampaign function.
An object containing the options for this method.
A promise of type PromotionResult.
Retrieves promotion information using filter criteria. In the request URL, you must provide a campaign_id parameter, and you can optionally specify a date range by providing start_date and end_date parameters. Both parameters are required to specify a date range, and omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled promotions, since the server does not consider promotion qualifiers or schedules.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type PromotionResult otherwise.
Generated using TypeDoc
Shopper Promotions
*Download API specification
API Overview
Retrieve information about active promotions within the context of a shopper and a site. You can use this API to retrieve promotions that you configured in the commerce platform by searching for specific promotion IDs or by searching for promotions associated with a campaign.
Authentication & Authorization
The Shopper Promotions API requires a JSON Web Token acquired via the Shopper Customers endpoint:
https://{shortCode}.api.commercecloud.salesforce.com/customer/shopper-customers/v1/organizations/{organizationId}/customers/actions/loginYou must include the relevant scope(s) in the client ID used to generate the SLAS token. For details, see Authorization Scopes Catalog.
Customization
Custom Properties
This API supports custom properties (prefixed with
c_). For details, see Custom Properties.Hooks
For details on working with hooks, see Extensibility with Hooks.
Request Details
URL Encoding
If resource identifiers in request parameters contain commas (
,) or percent signs (%), they must be URL encoded. For details, see Encode URL Special Characters.Response Details
Personalization
Responses from this API can be personalized using the Shopper Context API. By setting context attributes such as customer group, source code, or store ID, you can retrieve personalized promotions, pricing, and shipping methods. For details on how personalization interacts with caching, see Personalized Caching.
Caching
Caching is provided for this API. For details, see Server-Side Web-Tier Caching.
Timeouts
Shopper API requests must respond within 10 seconds, including any hook execution. If a response exceeds this threshold, an HTTP 504 status code is returned. For details, see Timeouts and Limits.
Error Handling
Error responses follow the RFC 7807 problem detail format. To trace errors, include a
correlation-idheader in your request — the response returns it asx-correlation-id. For details, see HTTP Status Codes and Errors.Use Cases
Get Promotions by ID
Retrieve one or more promotions by their IDs (comma-separated, max 50).
curl "https://{shortCode}.api.commercecloud.salesforce.com/pricing/shopper-promotions/v1/organizations/{organizationId}/promotions?ids=Buy5for50,free_shipping&siteId=RefArch" \ -H "Authorization: Bearer {access_token}"Get Promotion by Promotion ID
Use the Shopper Promotions API to find promotion information by the promotion ID.
For example, a customer who is browsing on a commerce shopping app built using Commerce Cloud APIs can see the details about the applied promotions in the cart.
Get Promotion by Campaign ID
Use the Shopper Promotions API to find promotion information by the campaign ID.
For example, a customer who is browsing on a commerce shopping app built using Commerce Cloud APIs can see the possible promotions that can be applied in the cart.
Related APIs
Simple example:
API Version: 0.0.33import { ShopperPromotions } from "commerce-sdk-isomorphic"; const clientConfig = { parameters: { clientId: "XXXXXX", organizationId: "XXXX", shortCode: "XXX", siteId: "XX" } }; const shopperPromotionsClient = new ShopperPromotions(clientConfig);Last Updated: