If you would like to get a raw Response object use the other createCustomerAddress function.
An object containing the options for this method.
A promise of type CustomerAddress.
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 CustomerAddress otherwise.
If you would like to get a raw Response object use the other createCustomerPaymentInstrument function.
An object containing the options for this method.
A promise of type CustomerPaymentInstrument.
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 CustomerPaymentInstrument otherwise.
If you would like to get a raw Response object use the other createCustomerProductList function.
An object containing the options for this method.
A promise of type CustomerProductList.
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 CustomerProductList otherwise.
This endpoint accepts a registered customer ShopperToken (JWT) or a guest customer ShopperToken.
Considered values from the request body are:
type
→ The item type to be added to the customer's product. This value is required and must be a valid type.
list.priority
→ The priority of the item to be added to the customer's product list.public
→ The flag that determines whether the item to be added to the customer's product list is public.product_id
→ The ID (SKU) of the product related to the item to be added to the customer's product list. Required when item type is product
, and must be a valid product ID and only used for product item type. Otherwise, a ProductListProductIdMissingException
or ProductListProductNotFoundException
is thrown.quantity
→ Only used for product item type. This is the quantity of the item to be added to the customer's product list.You can also use a custom property of the form c_<CUSTOM_NAME>
. The custom property must correspond to a custom attribute (<CUSTOM_NAME>
) that is defined for ProductListItem
. The value of this property must be valid for the type of custom attribute defined for ProductListItem
.
If you would like to get a raw Response object use the other createCustomerProductListItem function.
An object containing the options for this method.
A promise of type CustomerProductListItem.
This endpoint accepts a registered customer ShopperToken (JWT) or a guest customer ShopperToken.
Considered values from the request body are:
type
→ The item type to be added to the customer's product. This value is required and must be a valid type.
list.priority
→ The priority of the item to be added to the customer's product list.public
→ The flag that determines whether the item to be added to the customer's product list is public.product_id
→ The ID (SKU) of the product related to the item to be added to the customer's product list. Required when item type is product
, and must be a valid product ID and only used for product item type. Otherwise, a ProductListProductIdMissingException
or ProductListProductNotFoundException
is thrown.quantity
→ Only used for product item type. This is the quantity of the item to be added to the customer's product list.You can also use a custom property of the form c_<CUSTOM_NAME>
. The custom property must correspond to a custom attribute (<CUSTOM_NAME>
) that is defined for ProductListItem
. The value of this property must be valid for the type of custom attribute defined for ProductListItem
.
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 CustomerProductListItem otherwise.
If you would like to get a raw Response object use the other deleteCustomerPaymentInstrument function.
An object containing the options for this method.
A promise of type void.
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 void otherwise.
Delete a customer product list. This endpoint accepts a registered customer ShopperToken (JWT) or a guest customer ShopperToken.
If you would like to get a raw Response object use the other deleteCustomerProductList function.
An object containing the options for this method.
A promise of type void.
Delete a customer product list. This endpoint accepts a registered customer ShopperToken (JWT) or a guest customer ShopperToken.
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 void otherwise.
If you would like to get a raw Response object use the other deleteCustomerProductListItem function.
An object containing the options for this method.
A promise of type void.
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 void otherwise.
If you would like to get a raw Response object use the other getCustomer function.
An object containing the options for this method.
A promise of type Customer.
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 Customer otherwise.
If you would like to get a raw Response object use the other getCustomerAddress function.
An object containing the options for this method.
A promise of type CustomerAddress.
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 CustomerAddress otherwise.
If you would like to get a raw Response object use the other getCustomerBaskets function.
An object containing the options for this method.
A promise of type BasketsResult.
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 BasketsResult otherwise.
If you would like to get a raw Response object use the other getCustomerOrders function.
An object containing the options for this method.
A promise of type CustomerOrderResult.
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 CustomerOrderResult otherwise.
If you would like to get a raw Response object use the other getCustomerPaymentInstrument function.
An object containing the options for this method.
A promise of type CustomerPaymentInstrument.
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 CustomerPaymentInstrument otherwise.
If you would like to get a raw Response object use the other getCustomerProductList function.
An object containing the options for this method.
A promise of type CustomerProductList.
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 CustomerProductList otherwise.
If you would like to get a raw Response object use the other getCustomerProductListItem function.
An object containing the options for this method.
A promise of type CustomerProductListItem.
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 CustomerProductListItem otherwise.
If you would like to get a raw Response object use the other getCustomerProductLists function.
An object containing the options for this method.
A promise of type CustomerProductListResult.
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 CustomerProductListResult otherwise.
If you would like to get a raw Response object use the other getExternalProfile function.
An object containing the options for this method.
A promise of type CustomerExternalProfile.
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 CustomerExternalProfile otherwise.
If you would like to get a raw Response object use the other getProductListItem function.
An object containing the options for this method.
A promise of type PublicProductListItem.
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 PublicProductListItem otherwise.
If you would like to get a raw Response object use the other getPublicProductList function.
An object containing the options for this method.
A promise of type PublicProductList.
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 PublicProductList otherwise.
If you would like to get a raw Response object use the other getPublicProductListsBySearchTerm function.
An object containing the options for this method.
A promise of type PublicProductListResult.
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 PublicProductListResult otherwise.
This is the first step in the reset customer password flow, in which a password reset token is requested for future use to reset a customer password. This call should be followed by a call to the /reset endpoint.
If you would like to get a raw Response object use the other getResetPasswordToken function.
An object containing the options for this method.
A promise of type ResetPasswordToken.
This is the first step in the reset customer password flow, in which a password reset token is requested for future use to reset a customer password. This call should be followed by a call to the /reset endpoint.
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 ResetPasswordToken otherwise.
Mandatory data includes the credentials, profile last name, and email. This requires a JSON Web Token (JWT) which needs to be obtained using the POST /customers/auth API with type "guest", or from the Shopper Login (SLAS) API. The return type object for this endpoint is a common customer object shared by multiple Shopper Customer endpoints. In this case, all customer object details are returned, but attributes that are not included in the response, although they might be part of the customer object, are ignored. For example, although address information is included in the customer object, it is not displayed in the response for this endpoint and is ignored.
If you would like to get a raw Response object use the other registerCustomer function.
An object containing the options for this method.
A promise of type Customer.
Mandatory data includes the credentials, profile last name, and email. This requires a JSON Web Token (JWT) which needs to be obtained using the POST /customers/auth API with type "guest", or from the Shopper Login (SLAS) API. The return type object for this endpoint is a common customer object shared by multiple Shopper Customer endpoints. In this case, all customer object details are returned, but attributes that are not included in the response, although they might be part of the customer object, are ignored. For example, although address information is included in the customer object, it is not displayed in the response for this endpoint and is ignored.
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 Customer otherwise.
If you would like to get a raw Response object use the other registerExternalProfile function.
An object containing the options for this method.
A promise of type CustomerExternalProfile.
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 CustomerExternalProfile otherwise.
If you would like to get a raw Response object use the other removeCustomerAddress function.
An object containing the options for this method.
A promise of type void.
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 void otherwise.
This is the second step in the reset customer password flow, in which a customer password is reset by providing new credentials along with a reset token. This call should be preceded by a call to the /create-reset-token endpoint.
If you would like to get a raw Response object use the other resetPassword function.
An object containing the options for this method.
A promise of type void.
This is the second step in the reset customer password flow, in which a customer password is reset by providing new credentials along with a reset token. This call should be preceded by a call to the /create-reset-token endpoint.
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 void otherwise.
If you would like to get a raw Response object use the other updateCustomer function.
An object containing the options for this method.
A promise of type Customer.
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 Customer otherwise.
If you would like to get a raw Response object use the other updateCustomerAddress function.
An object containing the options for this method.
A promise of type CustomerAddress.
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 CustomerAddress otherwise.
If you would like to get a raw Response object use the other updateCustomerPassword function.
An object containing the options for this method.
A promise of type void.
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 void otherwise.
If you would like to get a raw Response object use the other updateCustomerProductList function.
An object containing the options for this method.
A promise of type CustomerProductList.
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 CustomerProductList otherwise.
This endpoint accepts a registered customer ShopperToken (JWT) or a guest customer ShopperToken. Considered values from the request body are:
priority: The priority of the customer's product list item.
public: The flag that indicates if the customer's product list item is public.
quantity: The quantity of
the customer's product list item. Onlyl used for product item type.
custom properties in the form c_
If you would like to get a raw Response object use the other updateCustomerProductListItem function.
An object containing the options for this method.
A promise of type CustomerProductListItem.
This endpoint accepts a registered customer ShopperToken (JWT) or a guest customer ShopperToken. Considered values from the request body are:
priority: The priority of the customer's product list item.
public: The flag that indicates if the customer's product list item is public.
quantity: The quantity of
the customer's product list item. Onlyl used for product item type.
custom properties in the form c_
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 CustomerProductListItem otherwise.
Generated using TypeDoc
Shopper Customers
*# API Overview
The Shopper Customers API enables you to develop functionality that lets customers log in, and manage their profiles and product lists. Profile management includes ability for shoppers to add or modify addresses and payment methods, and add or modify products to wishlists or favorites. Commerce Cloud provides a rich set of Authentication APIs that include logging in guest shoppers, registered shoppers, agents on behalf of customers and a trusted system authentication on behalf of customers. In all authentication scenarios involving customers, a JSON Web Token (JWT) is generated in Commerce Cloud. Using the JWT, customers can access other Shopper API resources like Orders and Baskets. The application must refresh the JWT every 30 minutes to save the shopper activity (for example, retain products in a shopper's cart) for prolonged periods of time.
Authentication & Authorization
The client requesting the customer information must have access to the Customer and Product List resources. The API requests pass a system-to-system bearer token in the header of the request. For the trusted system API, the trusted client must first authenticate against Account manager to log in on behalf of a customer.
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.
You must include the relevant scope(s) in the client ID used to generate the SLAS token. For details, see the Authorization Scopes Catalog.
Use Cases
Register a New Customer
In this use case, a customer who is browsing on a commerce shopping app built using B2C Commerce APIs would like to create a customer profile, so that they can track their order when logged in on the next visit.
The API flow is shown in the following diagram:
Authenticate a Trusted System on Behalf of a Customer
In this cross-cloud use case, a Experience Cloud user places an order on Commerce Cloud from the Experience Cloud using the platform APIs. The Experience Cloud app is a trusted system that has a trusted relationship with Commerce Cloud using the OAuth client credentials grant against the Commerce Cloud Account Manager. The Experience Cloud user logs in with a redirect to Salesforce IDM and after successful login, the client application is able to call B2C Commerce APIs on behalf of the customer. Commerce Cloud returns a JWT for the Experience Cloud user and the Experience Cloud user is able to place orders on Commerce Cloud.
The API flow is shown in the following diagram:
Reset Customer Password
In this use case, a shopper who is browsing on a commerce shopping app, built using B2C Commerce APIs, requests to reset their password. The app verifies the shopper's credentials and returns a 404 if verification fails. Otherwise, when the shopper requests their password to be reset, the app first creates a password reset token using the shopper’s login ID, and an account manager token (obtained using the client credentials grant). After the app has the password reset token, the app can prompt the shopper for new password. Any app-level customization, such as sending a password reset email, can be done at this step. Finally, the app calls the reset endpoint to reset the customer’s password.
Update Shopper LoginId
In this use case, in order to update a shopper's loginId, the PATCH /customers/{customerId} call can be used starting B2C Commerce Cloud GA release 24.7. The new field in the request called
currentPassword
is mandatory and needs to match the shopper's existing password. If this field is not provided or does not match the existing shopper password when trying to update loginId, a HTTP 400 rsponse will be returned. If the loginId field is not sent in the PATCH request body, thecurrentPassword
field is not required. *Note: After theloginId
is updated, a new SLAS token must be fetched for the shopper for subsequent calls.Use Hooks
For details working with hooks, see Extensibility with Hooks.*
Simple example:
API Version: 0.0.33import { ShopperCustomers } from "commerce-sdk-isomorphic"; const clientConfig = { parameters: { clientId: "XXXXXX", organizationId: "XXXX", shortCode: "XXX", siteId: "XX" } }; const shopperCustomersClient = new ShopperCustomers(clientConfig);
Last Updated: