1.1.3
API Overview
With the Shopper Context API, you can set any context information as a key/value pair and use it to retrieve personalized promotions, payment methods, and shipping methods. The context information that is set is evaluated against the customer group definitions to determine a customer group (shopper segment), and is then used to activate the experiences that are associated with a particular segment, such as promotions.
You can also get personalized API responses triggered by shopper context from the Open Commerce API (OCAPI). Support for both the B2C Commerce API and OCAPI allows shopper context to be used in hybrid deployments.
Warning Access tokens with a scope that includes the Shopper Context API are powerful. They can activate specific promotions and can be used to see how a storefront would be displayed in the future. Don't share them with untrusted clients like web browsers or client apps.
Make Shopper Context calls with a private client and only set shopper context through a secure backend channel. To avoid misuse, do not make direct calls through a browser or similar client in which data can be viewed.
As part of this, when creating a SLAS public client for a tenant, if you attempt to add the Shopper Context API scope, a warning message is displayed to ensure you are aware of the pitfalls of doing so.
Note:
Shopper context is valid for 1 day for guest shoppers and 7 days for registered shoppers. To extend the context set, create a new context. As a best practice, refresh your contexts periodically to ensure that the right personalized experience is rendered for your shoppers.
Authentication & Authorization
The Shopper Context API requires a shopper access token from the Shopper Login and API Access Service (SLAS).
You must include sfcc.shopper-context.rw in the client ID used to generate the SLAS token. For a full list of permissions, see the Authorization Scopes Catalog.
For details on how to request a shopper access token from SLAS, see the guest user flows for public clients and private clients in the SLAS guides.
For more information, see Authorization for Shopper APIs in the Get Started guides.
Warning: As with all APIs, never store access tokens in the browser because this creates a security vulnerability.
Use Cases
For detailed usage information, see the Shopper Context guides.
Let us know so we can improve!