dist/codex/salesforce-commerce/skills/sf-b2c-scapi/SKILL.md
"Build with Salesforce Commerce API (SCAPI) — Shopper APIs (Products, Search, Baskets, Orders, Customers), SLAS authentication, Commerce SDK for Node.js, rate limiting, pagination, and headless commerce patterns. This is the primary B2C API. Use when building headless storefronts or API integrations."
npx skillsauth add orcaqubits/agentic-commerce-claude-plugins sf-b2c-scapiInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Build headless commerce experiences and API integrations with Salesforce Commerce API (SCAPI).
Fetch live documentation FIRST:
developer.salesforce.com/docs/commerce/commerce-api/references (SCAPI API reference)developer.salesforce.com/docs/commerce/commerce-api/guide/slas.html (SLAS auth guide)github.com/SalesforceCommerceCloud/commerce-sdk (Commerce SDK repo)Why: SCAPI is the modern API replacing OCAPI. Endpoints, authentication flows, rate limits, and SDK versions change frequently. Always verify current specs before implementing.
| Family | Scope | Examples | |--------|-------|---------| | Shopper Products | Product data for storefront | Product details, images, prices, variations | | Shopper Search | Product discovery | Keyword search, refinements, facets, suggestions | | Shopper Baskets | Cart operations | Create basket, add/remove items, shipping, payment | | Shopper Orders | Order lifecycle | Create order from basket, order history, status | | Shopper Customers | Customer identity | Registration, profile, addresses, payment methods | | Shopper Promotions | Pricing incentives | Active promotions, promotion details | | Shopper Gift Certificates | Gift cards | Balance check, redemption | | Einstein | AI recommendations | Product and search recommendations | | Pricing / Inventory | Admin data | Price books, multi-location inventory |
SCAPI uses SLAS (Shopper Login and API Access Service) for OAuth 2.0 authentication. Two primary flows exist:
| Flow | Client Type | Use Case | |------|------------|----------| | Authorization Code + PKCE | Public (browser/mobile) | Guest and registered shoppers in frontend apps | | Client Credentials | Private/confidential (server) | Server-to-server integrations, back-office tools |
hint=guest -- this is NOT client_credentialsWhen transitioning a guest user to a registered session (login during checkout), SCAPI supports session bridging to preserve the guest basket. The guest token is exchanged for a registered token via the SLAS token endpoint, and the basket is merged server-side. Fetch live docs for the exact merge behavior and conflict resolution rules.
| Aspect | Detail |
|--------|--------|
| Scope | Per client ID, per endpoint |
| Typical range | 1,000 -- 10,000 requests/min (varies by API) |
| Burst | Short burst allowances above sustained rate |
| Headers | X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset |
| On 429 | Exponential backoff; respect Retry-After header |
SCAPI uses offset-based pagination with limit and offset parameters. Responses include total count and a next link. Avoid deep pagination on large result sets -- use refinements to narrow results instead.
Two SDK packages exist:
| Package | Environment | Notes |
|---------|------------|-------|
| commerce-sdk | Node.js only | Server-side integrations |
| commerce-sdk-isomorphic | Browser + Node.js | PWA Kit and universal apps |
// Pattern: SDK initialization
// Fetch live docs for current config shape
import { ShopperProducts } from 'commerce-sdk-isomorphic';
const client = new ShopperProducts(config);
// Pattern: Search with refinements
// Fetch live docs for refinement syntax
const results = await searchClient.productSearch({
parameters: { q, limit, offset, refine, sort }
});
| Syntax | Meaning |
|--------|---------|
| attribute=value | Exact match |
| attribute=(min..max) | Range filter |
| attribute=val1\|val2 | OR condition |
| cgid=category-id | Category refinement |
If-None-Match)Fetch the SCAPI API reference, Commerce SDK README, and SLAS guide for exact endpoint paths, request/response shapes, and SDK configuration before implementing.
development
Build with Spree's headless Next.js storefront — the official `spree/storefront` repo (Next.js 16 App Router with Server Actions and Turbopack, React 19 Server Components, Tailwind CSS 4, TypeScript 5, `@spree/sdk`, Sentry), server-only auth (httpOnly JWT cookies + publishable key), MeiliSearch faceted catalog, one-page checkout with Apple/Google Pay/Klarna/Affirm/SEPA, multi-region market routing, GA4 + JSON-LD SEO, and Vercel/Docker deployment. Use when forking or customizing the storefront, or evaluating headless adoption.
tools
Build Spree extensions as Rails engines — gem scaffolding, `bin/rails g spree:extension`, mounting routes/migrations/assets, the modern `prepend` decorator pattern (`*_decorator.rb` with `self.prepended(base)`), generators (`spree:model_decorator`, `spree:controller_decorator`), the four customization surfaces in preference order (Events > Webhooks > Dependencies > Decorators), Spree::Dependencies for swapping service objects, gem release/versioning, and the deprecated Deface engine. Use when building a reusable Spree extension or adding non-trivial customization to an app.
development
Build with Spree's event bus and Webhooks 2.0 — `Spree::Events` publication, `Spree::Subscriber` DSL with `subscribes_to` and `on`, wildcard matching, lifecycle events (`{model}.created/.updated/.deleted` via `publishes_lifecycle_events`), the canonical event catalog (order.*, payment.*, shipment.*, product.*), Webhooks 2.0 endpoints, HMAC-SHA256 signing (`X-Spree-Webhook-Signature`), exponential-backoff retries, and Sidekiq job orchestration. Use when wiring event-driven business logic, building webhook consumers, or replacing ActiveSupport callback chains.
tools
Cross-cutting Spree development patterns — the customization preference hierarchy (Events > Webhooks > Dependencies > Decorators), `Spree::Dependencies` service-object swapping, the `_decorator.rb` + `prepend` + `self.prepended` idiom, idempotent subscribers and webhook receivers, multi-store scoping discipline, prefixed IDs, calculator polymorphism (shipping/promotion/tax share the base), service-object composition with `dry-monads` or simple results, why to avoid `class_eval` reopening and Deface, and Spree-on-Rails idioms (Hotwire/Turbo Stimulus, ActiveStorage, Action Cable, Sidekiq). Use when designing the architecture of a Spree extension or solving cross-cutting concerns.