Skip to content

Salesforce Commerce (SFCC)

Complete Guide to Integrating Back-End Services with Salesforce Commerce (SFCC)

Section titled “Complete Guide to Integrating Back-End Services with Salesforce Commerce (SFCC)”

Salesforce B2C Commerce Cloud (SFCC) provides a robust set of APIs that enable seamless integration with back-end systems such as ERPs, OMS, PIM, and third-party fulfillment services.

This guide covers everything you need to know about integrating SFCC with your enterprise back-end, including catalog management, pricing, promotions, inventory, and order management flows.


1. Understanding the Salesforce Commerce API Landscape

Section titled “1. Understanding the Salesforce Commerce API Landscape”

Salesforce B2C Commerce Cloud provides two primary API frameworks that serve as the foundation for back-end integrations . Understanding their distinct purposes is critical for designing effective integration solutions.

OCAPI is the original integration workhorse behind Salesforce Commerce Cloud, in production for over a decade . It provides deep access to business logic and supports thousands of production storefronts.

AspectDescription
MaturityBattle-tested, stable, widely documented
API TypesShop API (customer-facing), Data API (admin/back-end), Meta API (discovery)
AuthenticationOAuth 2.0 Client Credentials flow
Use CasesLegacy integrations, deep customizations, complex business logic
FutureNo new feature development—bug fixes only

SCAPI is the modern, cloud-native API framework introduced in 2020 to support headless and composable commerce architectures .

AspectDescription
MaturityActive development; over 200 feature releases since 2021
API FamiliesShopper APIs (customer-facing), Admin APIs (back-end), Custom APIs
AuthenticationSLAS (Shopper Login and API Access Service) + OAuth 2.0
Use CasesNew headless storefronts, composable commerce, multi-channel experiences
FuturePrimary focus for Salesforce innovation
FeatureOCAPISCAPI
API StyleREST (Shop/Data/Meta)REST (Shopper/Admin)
Catalog ManagementYes (Data API)Yes (Admin API)
Pricing & PromotionsYesYes, with enhanced caching
InventoryYesYes (via Shopper Products API)
Order ManagementYes (Data API)Yes (Shopper Orders API)
Rate LimitsStandard throttlingHigher scalability claims
PersonalizationLimitedNative Shopper Context support
ScenarioRecommendation
New integration projectStart with SCAPI—it’s the future
Maintaining existing OCAPI integrationContinue using OCAPI while planning migration
Headless storefrontSCAPI Shopper APIs
Complex custom business logicOCAPI may still be required; check feature availability
Hybrid approachRun both APIs in parallel during migration

2. Authentication and Security Fundamentals

Section titled “2. Authentication and Security Fundamentals”

All SFCC API calls require OAuth 2.0 authentication. Understanding the authentication flow is essential for any integration.

This is the primary authentication method for server-to-server integrations .

Terminal window
# Step 1: Request an Access Token
curl -X POST \
https://account.demandware.com/dw/oauth2/access_token \
-H 'Content-Type: application/x-www-form-urlencoded' \
--user 'YOUR_CLIENT_ID:YOUR_CLIENT_SECRET' \
-d 'grant_type=client_credentials'

Successful response:

{
"access_token": "eyJhbGciOiJIUzI1NiJ9...",
"token_type": "Bearer",
"expires_in": 1799
}
StepDescription
1. Configure API ClientCreate API Client ID and Secret in Business Manager
2. Set PermissionsAssign granular permissions for each Client ID
3. Obtain TokenPOST credentials to OAuth 2.0 token endpoint
4. Use TokenInclude Authorization: Bearer {token} header in all API calls
5. Refresh TokenRequest new token before expiration (typically 30 minutes)
PracticeImplementation
Never hardcode credentialsUse AWS Secrets Manager, Azure Key Vault, or HashiCorp Vault
Use dedicated API ClientsCreate separate clients for each integration
Apply least privilegeGrant only necessary permissions per client
Enforce HTTPS/TLSAll API transactions must be encrypted
Rotate secrets regularlyImplement automated secret rotation
Monitor authentication failuresSet alerts for repeated failures

For SCAPI Shopper APIs, authentication uses the Shopper Login and API Access Service (SLAS) :

// Example SDK configuration
import { ShopperProducts } from "commerce-sdk-isomorphic";
const clientConfig = {
parameters: {
clientId: "YOUR_CLIENT_ID",
organizationId: "YOUR_ORG_ID",
shortCode: "YOUR_SHORT_CODE",
siteId: "YOUR_SITE_ID"
}
};
const shopperProductsClient = new ShopperProducts(clientConfig);

Catalog integration involves synchronizing product data between your back-end systems (PIM, ERP) and SFCC.

ComponentDescriptionAPI Access
ProductsCore product information (SKU, name, description)OCAPI Data API, SCAPI Shopper Products
CategoriesHierarchical product organizationBoth APIs support category retrieval
VariationsProduct variants (size, color, etc.)SCAPI includes variation support
Price BooksPricing data by customer group or regionSCAPI Admin API
Images & MediaProduct images, videos, documentsSCAPI includes image URLs

Performs comprehensive synchronization of all catalog data .

# Pseudo-code for full catalog sync
def full_catalog_sync():
# 1. Fetch all products from source system (PIM/ERP)
products = fetch_all_products_from_source()
# 2. Transform to SFCC format
transformed_products = transform_to_sfcc_format(products)
# 3. Batch upload to SFCC
for batch in chunk(transformed_products, 50):
upload_products_to_sfcc(batch)
# 4. Verify sync completion
verify_sync_status()

When to use: Initial implementation, periodic full refreshes, disaster recovery.

Pattern 2: Delta Sync (Incremental Updates)

Section titled “Pattern 2: Delta Sync (Incremental Updates)”

Synchronizes only changed products since the last sync .

# Pseudo-code for delta sync
def delta_sync(last_sync_timestamp):
# 1. Fetch changed products from source
changed_products = fetch_changed_products_since(last_sync_timestamp)
# 2. Process updates
for product in changed_products:
update_product_in_sfcc(product)
# 3. Handle deletions
deleted_products = fetch_deleted_products_since(last_sync_timestamp)
for product_id in deleted_products:
mark_product_offline_in_sfcc(product_id)

When to use: Ongoing maintenance, real-time updates, high-volume environments.

Sync specific products by SKU for urgent changes .

# Pseudo-code for targeted sync
def targeted_sync(sku_list):
for sku in sku_list:
product = fetch_product_by_sku(sku)
update_product_in_sfcc(product)

When to use: Price corrections, urgent product launches, error recovery.

Terminal window
# Using OCAPI Data API to retrieve product details
curl -X GET \
'https://your-instance.demandware.net/s/SiteGenesis/dw/data/v23_1/products/25595358M?select=(**)' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json'
// Using SCAPI Shopper Products SDK
const product = await shopperProductsClient.getProduct({
parameters: {
id: "25595358M",
siteId: "SiteGenesis"
}
});
console.log(product.name, product.price, product.availability);

For global deployments, manage localized product content :

Locale ConsiderationImplementation
Product namesSync localized versions from source
DescriptionsMaintain separate fields per locale
PricingDifferent price books per currency/region
AvailabilityRegion-specific inventory levels
CategoriesLocalized category names and structures

Integrating pricing and promotions requires careful coordination between back-end systems and SFCC.

ERP/PIM → Price Calculation → SFCC Price Book → Storefront Display
ComponentDescription
Price Book IDUnique identifier for pricing configuration
CurrencyCurrency of all prices in the book
AssignmentCustomer groups, sites, or regions
Price TablesProduct-to-price mappings
Terminal window
# Update product price using OCAPI Data API
curl -X PATCH \
'https://your-instance.demandware.net/s/SiteGenesis/dw/data/v23_1/price_books/standard-price-book/product_prices/25595358M' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"price": 29.99,
"currency": "USD"
}'

Promotions can be managed through OCAPI or SCAPI, with important considerations :

Key Promotion Behaviors:

Promotion TypeDisplay on PDP/PLPDisplay in Basket
Product-specific discountsYes (callout messages)Yes
Basket-level promotionsNo (requires basket context)Yes
Conditional promotionsPartialFull calculation
Shipping promotionsNoYes
PracticeDescription
Cache price dataReduce API calls by caching infrequently changed pricing
Use price books for segmentationSeparate price books by customer group or region
Sync price changes promptlyPrice updates should trigger delta syncs
Validate currency alignmentEnsure price book currency matches site currency
Monitor price sync failuresSet alerts for failed price updates

SCAPI supports shopper-contextual pricing based on device, location, or customer segment :

// Example: Personalized pricing based on shopper context
const product = await shopperProductsClient.getProduct({
parameters: {
id: "25595358M",
siteId: "SiteGenesis"
},
headers: {
'x-shopper-context': '{"device":"mobile"}'
}
});
// Mobile users may receive different pricing

Inventory integration ensures accurate stock availability across all sales channels.

ERP/WMS → Inventory Levels → SFCC Inventory → Storefront Display

Synchronize all inventory levels periodically (e.g., daily).

Push inventory changes as they occur (e.g., after order fulfillment).

Query back-end inventory in real-time when a customer views a product.

Use CaseOCAPISCAPI
Check product availabilityShop API (products)Shopper Products API
Update inventory levelsData APIAdmin API
Multi-location inventoryInventory ListsAdmin API

The Shopper Products API returns inventory availability as part of product responses :

const product = await shopperProductsClient.getProduct({
parameters: {
id: "PRODUCT_ID",
siteId: "SiteGenesis"
}
});
// Check availability
const inStock = product.availability.available;
const stockLevel = product.availability.atp; // Available to Promise
PracticeDescription
Define ATP logicEstablish Available-to-Promise rules in back-end
Implement safety stockMaintain buffer stock to prevent overselling
Set sync frequencyBalance freshness with API rate limits
Handle backordersDefine behavior when inventory is depleted
Monitor stock discrepanciesAlert when SFCC and back-end inventory diverge

Order management integration is critical for processing and fulfilling customer orders.

Order Created → Payment Authorized → Order Submitted → Fulfillment → Shipment → Order Complete
Terminal window
# 1. Create/Retrieve Basket
GET /dw/shop/v23_1/baskets/{basket_id}
# 2. Add Payment Instrument
POST /dw/shop/v23_1/baskets/{basket_id}/payment_instruments
# 3. Submit Order
POST /dw/shop/v23_1/orders
# 4. Retrieve Order Details
GET /dw/data/v23_1/orders/{order_no}

When an order is submitted in SFCC, immediately push to OMS/ERP.

Customer Checkout → SFCC Order Created → Webhook → Integration Service → OMS/ERP

Collect orders and process them in scheduled batches.

Orders Accumulate in SFCC → Scheduled Job → Export Orders → OMS Import

External systems periodically pull new orders from SFCC.

OMS Scheduler → Query SFCC for New Orders → Process Orders → Update Status
StatusDescriptionNext Actions
CreatedOrder submitted, awaiting processingSend to OMS
PaidPayment capturedBegin fulfillment
ShippedItems shippedUpdate customer, send tracking
CancelledOrder cancelledRefund payment
CompletedOrder fully processedArchive
Terminal window
# Fetch orders placed after specific date
curl -X GET \
'https://your-instance.demandware.net/s/SiteGenesis/dw/data/v23_1/order_search?query=creation_date:{"from":"2024-01-01T00:00:00Z"}&select=(order_no,creation_date,status,total)' \
-H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
// Using SCAPI to fetch customer orders
const orders = await shopperOrdersClient.getOrders({
parameters: {
siteId: "SiteGenesis"
}
});
PracticeDescription
Idempotent processingHandle duplicate order notifications gracefully
Implement retry logicRetry failed OMS pushes with exponential backoff
Monitor order failuresAlert on orders not synced within SLA
Track order statusMaintain status history for troubleshooting
Handle payment separatelyAuthorize before order submission, capture after fulfillment

Choose the right architecture pattern based on your requirements.

Back-End System → SFCC API (Direct Calls)

Pros: Simple, low latency, minimal infrastructure
Cons: Tight coupling, rate limit exposure, complex error handling

Back-End System → Integration Middleware → SFCC API

Pros: Decoupling, centralized monitoring, transformation capabilities
Cons: Additional infrastructure, potential latency

Common Middleware Options: MuleSoft, Celigo, Boomi, custom Node.js/Java services

SFCC Event → SNS/SQS → Integration Service → Back-End System

Pros: Loose coupling, resilience, scalability
Cons: Complexity, eventual consistency

For specific integration scenarios, pre-built connectors may accelerate development:

ConnectorPurposeSource
Adobe Commerce SFCC ConnectorCatalog and price syncAdobe App Builder
Custom SFCC CartridgesExtend SFCC with custom APIsSalesforce Developer

graph LR
    A[PIM System] -->|Product Data| B[Integration Service]
    B -->|Transform| C[SFCC API]
    C -->|Create Product| D[SFCC Catalog]
    D -->|Publish| E[Storefront]

Steps:

StepActionAPI
1Extract product from PIMPIM API
2Transform to SFCC schemaIntegration logic
3Create product in SFCCOCAPI Data / SCAPI Admin
4Assign to categoriesOCAPI Data / SCAPI Admin
5Set pricingPrice Book API
6Set inventoryInventory API
7Publish to siteSite Publishing API
graph LR
    A[Storefront] -->|Order| B[SFCC Order API]
    B -->|Webhook| C[Integration Service]
    C -->|Create| D[OMS]
    D -->|Fulfill| E[Warehouse]

Steps:

StepActionResponsible System
1Order submittedSFCC Storefront
2Order created in SFCCSFCC
3Webhook triggers integrationSFCC → Integration Service
4Order transformedIntegration Service
5Order pushed to OMSOMS
6OMS acknowledgesOMS → Integration Service
7Status updated in SFCCIntegration Service → SFCC
graph LR
    A[WMS] -->|Stock Update| B[Integration Service]
    B -->|Delta Sync| C[SFCC Inventory API]
    C -->|Update| D[Storefront Availability]

Steps:

StepActionTiming
1Inventory change in WMSReal-time
2WMS sends webhookImmediate
3Integration service validatesSynchronous
4SFCC inventory updatedSynchronous
5Storefront reflects availabilityImmediate

CodeMeaningHandling Strategy
200-299SuccessNormal processing
400Bad RequestLog, fix request format
401UnauthorizedRefresh token, retry
403ForbiddenCheck permissions
404Not FoundVerify resource exists
429Too Many RequestsExponential backoff, reduce rate
500-504Server ErrorRetry with backoff
def call_with_retry(api_call, max_retries=3):
for attempt in range(max_retries):
try:
return api_call()
except RateLimitException:
wait_time = (2 ** attempt) * 1000 # Exponential backoff (ms)
time.sleep(wait_time)
except ServerErrorException:
if attempt == max_retries - 1:
raise
time.sleep(1000 * (attempt + 1))

For asynchronous integrations, use DLQs to capture failed messages:

Failed Message → DLQ → Manual Review → Reprocess → Success

Ensure operations can be safely retried without duplication:

StrategyImplementation
Idempotency keysSend unique key with each request; SFCC deduplicates
Check before createQuery for existing resource before creation
Status trackingMaintain processing status in integration database

APITypical LimitsMitigation
OCAPIPer-client throttlingDistribute load across multiple clients
SCAPIHigher scalabilityUse caching, reduce request frequency
TechniqueDescriptionImpact
Field selectionUse select parameter to request only needed fieldsReduces payload size
BatchingBatch multiple operations in single API callReduces request count
CachingCache infrequently changed data (catalog, pricing)Reduces API calls
Long pollingFor SCAPI, use web-tier cachingImproves response time
Parallel processingProcess independent operations concurrentlyIncreases throughput
Terminal window
# Request only specific fields to reduce payload
curl -X GET \
'https://your-instance.demandware.net/s/SiteGenesis/dw/shop/v23_1/products/25595358M?select=(id,name,price,(price))' \
-H 'Authorization: Bearer TOKEN'
Terminal window
# Batch create products (pseudo-code)
POST /dw/data/v23_1/product_batch_jobs
{
"products": [
{"product_id": "SKU1", "name": "Product 1"},
{"product_id": "SKU2", "name": "Product 2"}
]
}

EnvironmentPurposeData
Development SandboxInitial developmentSynthetic/test data
Staging SandboxIntegration testingAnonymized production-like data
ProductionLive operationsReal customer data
ScenarioWhat to Test
Product syncCorrect mapping of all attributes, variations, categories
Price syncAccuracy of price books, currency handling
Inventory syncATP values, multi-location inventory
Order flowEnd-to-end order creation to fulfillment
Error recoveryRetry logic, DLQ handling, manual intervention
Rate limitingBehavior under high load
pre-production-validation:
catalog:
- All product IDs match source system
- Categories correctly mapped
- Images URLs are accessible
- Variations (size/color) correctly linked
pricing:
- Price books contain correct products
- Currency values are accurate
- Promotions apply correctly
inventory:
- ATP values match source system
- Multi-location inventory accurate
orders:
- Orders successfully push to OMS
- Status updates flow back to SFCC
- Cancellations processed correctly

Conduct load testing for high-traffic events like seasonal sales :

Test TypeGoalSuccess Criteria
BaselineEstablish normal performance< 200ms average response
PeakSimulate holiday trafficNo 429 errors
SustainedLong-duration high loadStable throughput
RecoverySystem recovers after overloadReturns to normal within 5 minutes

MetricDescriptionAlert Threshold
API response timeTime to complete API call> 1 second
Error ratePercentage of failed requests> 5% over 5 minutes
Rate limit usageProximity to API limits> 80%
Sync lagTime between source change and SFCC update> 15 minutes
Order sync failuresOrders failing to reach OMS> 0
ToolPurpose
Salesforce Commerce Cloud Log CenterSFCC-specific logs
CloudWatchIntegration service metrics
Datadog/New RelicEnd-to-end tracing
Custom dashboardsBusiness KPIs
{
"timestamp": "2024-01-15T10:30:00Z",
"level": "ERROR",
"service": "order-integration",
"operation": "push_order_to_oms",
"order_id": "ORD-12345",
"error_code": "OMS_TIMEOUT",
"retry_count": 2,
"correlation_id": "abc123-def456"
}
AlertConditionAction
High error rateErrors > 10% in 5 minutesPagerDuty notification
Sync stalledNo successful sync in 1 hourEmail to integration team
Rate limit approaching> 80% of limitSlack alert to capacity planning
Order backlog> 100 orders pending syncIncrease consumer instances

PrincipleApplication
Decouple systemsUse message queues or middleware
Design for idempotencySupport safe retries without duplication
Implement graceful degradationContinue core operations when integrations fail
Monitor everythingLog all API calls, errors, and performance metrics
Version proactivelyPlan for API version updates
NeedRecommendation
New projectsUse SCAPI exclusively where possible
Catalog syncSCAPI Admin API
Order managementSCAPI Shopper Orders API
Pricing & promotionsSCAPI with Shopper Context
Complex custom logicOCAPI (check feature availability first)
MigrationRun both APIs in parallel
StrategyImplementation
Transactional boundariesNo cross-API transactions—manage state in application
Compensating transactionsImplement rollback logic for failed multi-step operations
Audit trailsLog all data changes for reconciliation
Regular reconciliationCompare source and target systems periodically
PracticeBenefit
Implement cachingReduce API calls for catalog/pricing data
Use batch operationsUp to 10x reduction in API requests
Optimize field selectionReduce payload size and processing time
Distribute loadUse multiple API clients for high-volume operations
PracticeImplementation
Credential managementUse secrets manager, never hardcode
Network securityUse VPC endpoints where available
Audit loggingLog all authentication and authorization events
Regular reviewsQuarterly permission and access reviews
AreaRecommendation
Hooks for customizationUse before/after hooks to inject custom logic
Feature switchesEnable SCAPI hooks via Business Manager
Site selectionSpecify correct site ID in API calls
Locale managementHandle multi-locale data carefully in sync processes

This glossary includes key terms directly related to Salesforce Commerce Cloud integration.


Admin API SCAPI family for merchant-facing operations including catalog, inventory, price book, and customer management .

ATP (Available to Promise) Inventory metric indicating quantity available for immediate customer purchase.


Cartridge A deployable package of code and configuration that extends SFCC functionality. Custom cartridges can expose new APIs for integration .

Client Credentials Flow OAuth 2.0 authentication flow used for server-to-server integrations. Uses Client ID and Client Secret to obtain access tokens .

Composable Commerce Architectural approach that decouples front-end presentation from back-end commerce logic. SCAPI is built to support composable architectures .


Data API OCAPI family for administrator and system integration access. Used for managing catalog data, inventory, orders, and customers from back-end systems .

Dead-Letter Queue (DLQ) Storage for messages that failed processing after multiple retry attempts, enabling manual review and reprocessing.

Delta Sync Synchronization pattern that transfers only changed data since the last sync, rather than full data sets .


Exponential Backoff Retry strategy where wait time increases exponentially with each attempt (e.g., 1s, 2s, 4s, 8s). Recommended for handling rate limit responses .


Headless Commerce Architecture separating front-end presentation layer from back-end commerce functionality. SFCC supports headless via OCAPI and SCAPI .

Hook Custom server-side logic that executes before, after, or to modify responses for API requests. Available for Basket, Order, Customer, and other resources .


Idempotency Property ensuring that performing an operation multiple times has the same effect as performing it once. Critical for safe retries in order processing.


Meta API OCAPI family for discovering available API versions, resources, methods, and data structures for a given SFCC instance .

Middleware Integration layer that sits between back-end systems and SFCC, handling transformation, routing, monitoring, and error recovery .


OAuth 2.0 Industry-standard protocol for authorization. SFCC APIs use OAuth 2.0 Client Credentials flow for server-to-server authentication .

OCAPI (Open Commerce API) Legacy SFCC API framework with Shop, Data, and Meta API families. Stable but receiving no new feature development .

OMS (Order Management System) Back-end system responsible for order fulfillment, inventory management, and shipment processing.


PIM (Product Information Management) Back-end system managing master product data, including attributes, categories, media, and localization.

Price Book SFCC container for pricing information, organized by currency and customer segment .


Rate Limiting Throttling mechanism that limits API request frequency per client to protect platform stability. Returns HTTP 429 when exceeded .

Reconciliation Process of comparing data between source and target systems to identify and resolve discrepancies.


SCAPI (Salesforce Commerce API) Modern SFCC API framework introduced in 2020 for headless and composable commerce. Includes Shopper APIs and Admin APIs .

SFCC (Salesforce Commerce Cloud) Salesforce’s enterprise e-commerce platform (formerly Demandware). Provides OCAPI and SCAPI for integration .

Shop API OCAPI family for customer-facing operations including product browsing, basket management, checkout, and order submission .

Shopper API SCAPI family for customer-facing operations. Includes Shopper Products, Shopper Baskets, Shopper Orders, and Shopper Customers .

SLAS (Shopper Login and API Access Service) SCAPI authentication service providing OAuth 2.0 tokens for shopper API calls .


Throttling See Rate Limiting.


Integrating back-end services with Salesforce Commerce Cloud requires a solid understanding of the API landscape, authentication, data flows, and integration patterns. With OCAPI providing stability and SCAPI delivering modern capabilities, you can build robust integrations that scale with your business.

Key Takeaways:

  • API selection matters - Use SCAPI for new projects; maintain OCAPI for legacy while planning migration
  • OAuth 2.0 is required - All API calls must authenticate with access tokens
  • Understand API families - Shop vs. Data (OCAPI) and Shopper vs. Admin (SCAPI) serve different purposes
  • Plan for rate limits - Implement exponential backoff and use caching to reduce API calls
  • Design for idempotency - Ensure operations can be safely retried without duplication
  • Monitor everything - Log all API calls, errors, and performance metrics
  • Test thoroughly - Validate in sandbox environments before production deployment

Getting Started Recommendations:

  • Begin with SCAPI Shopper APIs for front-end integrations
  • Use Admin APIs for catalog, price, and inventory sync
  • Implement delta sync patterns for efficient catalog management
  • Set up dead-letter queues for failed message handling
  • Establish comprehensive monitoring before going live