Call Shopper Commerce APIs (SCAPI) from headless storefronts and composable commerce apps. Use this skill whenever the user is building with PWA Kit, Storefront Next (SFNext), or a headless frontend and needs to search products, manage baskets, submit orders, access customer data, or set shopper context. Also use when they ask about Shopper API authentication, checkout flows from a frontend app, or performance optimization for API calls — even if they just say "search products from my PWA" or "build a headless checkout".
Call Shopper Commerce APIs (SCAPI) from headless storefronts and composable commerce apps. Use this skill whenever the user is building with PWA Kit, Storefront Next (SFNext), or a headless frontend and needs to search products, manage baskets, submit orders, access customer data, or set shopper context. Also use when they ask about Shopper API authentication, checkout flows from a frontend app, or performance optimization for API calls — even if they just say "search products from my PWA" or "build a headless checkout".
Shopper Commerce APIs (SCAPI)
This skill guides you through consuming standard Shopper APIs for building headless commerce experiences. Shopper APIs are RESTful endpoints designed for customer-facing storefronts.
Note: For creating custom API endpoints, see b2c-custom-api-development. This skill focuses on consuming standard Shopper APIs.
Scope & grounding
This skill provides quick-start patterns and examples for B2C Commerce Shopper APIs (SCAPI) used in headless storefronts — authentication, checkout, product APIs, and Shopper Context. The examples are version-agnostic and illustrative. Before answering questions that reference specific API versions, authentication flows, quota limits, default scopes, or before emitting code the user will run, confirm current details via b2c docs search/b2c docs read (CLI) or the docs_search/docs_read MCP tools. The official Commerce API documentation at developer.salesforce.com is the authoritative source for API specifications, current authentication patterns, and version-specific behavior.
Canonical docs:
commerce-api/work-with-baskets-orders - Build Baskets and Place Orders guide
commerce-api/shopper-context-api - Shopper Context API reference
commerce-api/shopper-context-best-practices - Shopper Context best practices
Note: Shopper Baskets API supports both v1 and v2. See Shopper Baskets API reference or b2c docs read commerce-api/work-with-baskets-orders for current version guidance.
Configuration Values
Value
Description
Example
shortCode
8-character API routing code
kv7kzm78
organizationId
Instance identifier
f_ecom_zzte_053
siteId
Site/channel name
RefArchGlobal
Find these in Business Manager: Administration > Site Development > Salesforce Commerce API Settings
Illustrative of the flow; confirm current SLAS authentication patterns (guest/registered, public/private client, PKCE) with b2c docs read commerce-api/slas.
// Create order from basketconst order = awaitfetch(
`https://${shortCode}.api.commercecloud.salesforce.com/checkout/shopper-orders/v1/organizations/${orgId}/orders?siteId=${siteId}`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
basketId: basket.basketId
})
}
).then(r => r.json());
The POST does not finish the order. SCAPI creates the order in CREATED status — payment is not authorized and the order is not placed by this call. A server-side dw.ocapi.shop.order.afterPOST hook is responsible for authorizing payment and advancing the order to NEW (OrderMgr.placeOrder) or FAILED (OrderMgr.failOrder). Without that hook the order is stranded in CREATED. If your headless checkout "succeeds" but the order never appears as placed (or never fails visibly), this is almost always the missing piece — see the canonical example in b2c-hooks › Order afterPOST and the order lifecycle in b2c-ordering. Confirm current hook details with b2c docs read commerce-api/hook-method-details.
Shopper Customers
Customer registration, login, and account management.
Maintain personalization state across requests using the Shopper Context API. The siteId query parameter is required for all Shopper Context operations.