b2c-ordering

Manage B2C order lifecycles using the SFCC OrderMgr API.

51|16|Updated Oct 31, 2025
One-click install
npx skills add https://github.com/SalesforceCommerceCloud/b2c-developer-tooling --skill b2c-ordering
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: b2c-ordering
Source: https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/tree/main/skills/b2c/skills/b2c-ordering
Command: npx skills add https://github.com/SalesforceCommerceCloud/b2c-developer-tooling --skill b2c-ordering

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill simplifies implementing and managing the B2C order lifecycle by guiding developers on creating, placing, and updating orders using the SFCC OrderMgr API.

Core Features & Use Cases

  • Order creation from basket with auto-generated or custom numbers using OrderMgr.createOrder and related APIs.
  • Order lifecycle management: transition statuses (CREATED → NEW → OPEN → COMPLETED/CANCELLED/FAILED) with transactional safety.
  • Place and confirm an order after payment authorization, and handle failures with failOrder(order, true) to reopen the basket for retry.
  • SCAPI/headless patterns: support creating orders before payment and subsequent placement/updating via Script API.
  • Use cases: convert a checkout basket into an order, manage retries after payment failures, and query or update orders programmatically.

Quick Start

Use this skill to create an order from a basket, then place it after payment authorization, and reopen the basket if the payment fails.

Frequently Asked Questions about b2c-ordering

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create an order from a basket in SFCC using OrderMgr?

To create an order from a basket in SFCC, use the OrderMgr.createOrder Script API, which supports auto-generated or custom order numbers and requires Transaction wrapping for transactional integrity. This converts checkout baskets into orders programmatically.

What is the best way to handle SFCC payment failures and reopen the basket?

The best way to handle SFCC payment failures is to call failOrder(order, true), which transitions the order to a FAILED status and reopens the basket for retry. This ensures transactional safety while allowing customers to attempt payment again.

How does the SFCC order lifecycle status transition work?

The SFCC order lifecycle transitions through statuses from CREATED to NEW, then OPEN, and finally to COMPLETED, CANCELLED, or FAILED. These transitions are managed with transactional safety using the OrderMgr API to ensure data integrity.

Can I create orders before payment authorization in a headless SFCC flow?

Yes, you can create orders before payment authorization in headless SFCC flows using SCAPI patterns. The Script API subsequently supports placing and updating the order after payment authorization is confirmed.

Does SFCC OrderMgr support idempotent order creation?

Yes, SFCC OrderMgr supports idempotent order creation to prevent duplicate orders during retries. This requires Script API access to OrderMgr and Transaction methods to maintain transactional integrity across standard and headless flows.

Why should I use undoCancelOrder instead of creating a new order in SFCC?

Use undoCancelOrder to restore a previously cancelled order to its prior state without generating a duplicate record. This maintains the original order number and lifecycle history while preserving transactional integrity within the SFCC OrderMgr API.