b2c-scapi-shopper_skill

This skill guides you to consume Salesforce Shopper APIs efficiently, enabling product, search, baskets, orders, and context management for headless
  • TypeScript

20

GitHub Stars

1

Bundled Files

3 weeks ago

Catalog Refreshed

2 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstart where the catalogue uses aiagentskills.

npx veilstart add skill salesforcecommercecloud/b2c-developer-tooling --skill b2c-scapi-shopper

  • SKILL.md10.6 KB

Overview

This skill teaches how to consume Salesforce Shopper Commerce APIs (SCAPI) for headless storefronts and PWAs. It covers authentication with SLAS, core API families (products, search, baskets, orders, customers), Shopper Context usage, and performance and debugging techniques. The content focuses on practical patterns for building fast, secure storefront integrations.

How this skill works

The skill explains how to obtain SLAS tokens (guest and registered), call SCAPI endpoints using the standard base URL structure, and manage shopper state with the Shopper Context API. It shows common request examples for product lookup, search, basket management, order submission, and customer profile access. It also details performance knobs (select, expand, compression), CORS/BFF guidance, and correlation-id debugging.

When to use it

  • Building a PWA or composable storefront that calls backend commerce services directly
  • Implementing product detail pages, search, cart, checkout, or account features via REST APIs
  • Managing guest and registered shopper sessions using SLAS tokens
  • Maintaining personalization state across requests with Shopper Context API
  • Optimizing payloads and caches for mobile or bandwidth-sensitive clients

Best practices

  • Create and configure SLAS clients with the correct scopes; use private clients behind a BFF for sensitive flows
  • Set shopper context immediately after obtaining a token and reuse the USID to preserve continuity
  • Prefer the select parameter to retrieve only needed fields and avoid expensive expands when possible
  • Use v2 of the Baskets API for newer checkout features; perform server-side basket operations from a BFF
  • Enable HTTP compression and set appropriate cache TTLs for expanded data like availability

Example use cases

  • Fetch product details and prices for product pages using sfcc.shopper-products scope
  • Implement site search and autocomplete using shopper-search endpoints and limited result sets
  • Create and update baskets, add line items, then submit an order using shopper-baskets and shopper-orders
  • Migrate guest sessions to registered accounts by reusing SLAS USID and updating Shopper Context
  • Instrument requests with correlation-id and verbose headers to troubleshoot order failures

FAQ

No. SCAPI does not support CORS. Use a reverse proxy or a Backend-for-Frontend (BFF) to securely relay requests from the browser.

Which SLAS scopes do I need for checkout?

Use shopper-baskets-orders.rw for basket write operations and shopper-baskets-orders for order read/submit operations. Ensure your SLAS client has all required scopes before calling APIs.

When should I use Shopper Context?

Set context on initial visit or login, after token refresh, and when transitioning between guest and registered sessions. Use it to store personalization state with appropriate TTLs.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational