b2c-ordering_skill
- TypeScript
20
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 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 veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill salesforcecommercecloud/b2c-developer-tooling --skill b2c-ordering- SKILL.md10.7 KB
Overview
This skill helps you manage order lifecycle and operations in Salesforce B2C Commerce using the OrderMgr API. It covers creating orders (sync and async), status transitions, failure handling, querying, and common patterns for checkout and order processing. Use it to implement robust, idempotent checkout flows and server-side order management.
How this skill works
The skill wraps the OrderMgr API patterns for creating orders from baskets, placing orders, failing or cancelling orders, and querying orders by number or criteria. It explains synchronous flows (create → authorize → place) and async/SCAPI flows (create before payment, place after payment). It also documents important status rules (CREATED → NEW → OPEN → COMPLETED/CANCELLED/FAILED) and how to reopen baskets after failures.
When to use it
- Implementing checkout flows that create and place orders from baskets
- Building headless/SCAPI patterns where order is created before payment authorization
- Handling payment failures and reopening the basket for retries
- Automating order queries, reporting, or batch processing by date/status
- Cancelling or undoing cancelled orders during order management operations
Best practices
- Always wrap OrderMgr operations inside Transaction.wrap to ensure atomic changes
- Validate basket (items, addresses, payment instruments) before createOrder()
- Implement idempotent order creation by supplying a specific order number when needed
- Check current order.status before calling status-transition methods
- Close iterators returned by searchOrders() to avoid resource leaks
- Use failOrder(order, true) to reopen baskets when payment fails; FAILED orders cannot be reopened
Example use cases
- Standard synchronous checkout: create order, authorize payment, place order and set confirmation status
- Headless checkout (SCAPI): create order with client-supplied orderNo, authorize externally, then place order server-side
- Recover from payment decline by failing the order and reopening the basket for retry
- Search for NEW orders created in the last 7 days for fulfillment processing
- Cancel OPEN or NEW orders from an admin tool, and optionally undo cancellations when needed
FAQ
No. Once an order is in FAILED status it cannot be reopened. To allow a customer retry, call failOrder(order, true) at failure time to reopen the basket instead.
When should I create orders with a specific order number?
Provide a specific orderNo for idempotency in async/headless flows or when integrating external systems that require predictable order numbers.
What statuses can be cancelled or undone?
You can cancel orders in NEW or OPEN states. Cancelled orders can be reverted to NEW using undoCancelOrder().