Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ShopperOrders<ConfigParameters>

*Download API specification

API Overview

The Shopper Orders API enables you to:

  • Create orders based on baskets prepared using the Shopper Baskets API.
  • Add a customer's payment instrument to an order.

You can choose to supply the full payment information or supply only a customer payment instrument ID and amount. If the customer payment instrument ID is set, all the other properties (except amount) are ignored and the payment data is resolved from the stored customer payment information.

Note:* The API doesn’t allow the storage of credit card numbers. The endpoint provides the storage of masked credit card numbers only.

To update the payment status, use the Orders API.

Responses from this API are not cached because order data is transactional and unique to each shopper.

For additional guidance when working with baskets, see Build Baskets and Place Orders.

Authentication & Authorization

The client requesting order information must have access to the Orders resource. The Shopper Orders API requires a shopper access token from the Shopper Login and API Access Service (SLAS).

For details on how to request a shopper access token from SLAS, see the guest user flows for public clients and private clients in the SLAS guides.

You must include sfcc.shopper-baskets-orders or sfcc.shopper-baskets-orders.rw in the client ID used to generate the SLAS token. For a full list of permissions, see the Authorization Scopes Catalog.

Customization

Custom Properties

This API supports custom properties (prefixed with c_). For details, see Custom Properties.

Hooks

For details on working with hooks, see Extensibility with Hooks.

Response Details

Personalization

Responses from this API are not personalized via the Shopper Context API.

Caching

Responses from this API are not cached. Order data is transactional and unique to each shopper.

Timeouts

Shopper API requests must respond within 10 seconds, including any hook execution. If a response exceeds this threshold, an HTTP 504 status code is returned. For details, see Timeouts and Limits.

Error Handling

Error responses follow the RFC 7807 problem detail format. To trace errors, include a correlation-id header in your request — the response returns it as x-correlation-id. For details, see HTTP Status Codes and Errors.

Use Cases

Create an Order from a Basket

Place an order by providing a basket ID. The basket must have a valid shipping address, shipping method, billing address, and payment instrument.

curl "https://{shortCode}.api.commercecloud.salesforce.com/checkout/shopper-orders/v1/organizations/{organizationId}/orders?siteId=RefArch" \
-X POST \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{ "basketId": "{basketId}" }'

Related APIs

  • Orders (Admin) — Update order status, payment status, and shipping addresses.
  • Shopper Baskets — Build and manage baskets before placing an order.*

Simple example:

  import { ShopperOrders } from "commerce-sdk-isomorphic";

  const clientConfig = {
    parameters: {
      clientId: "XXXXXX",
      organizationId: "XXXX",
      shortCode: "XXX",
      siteId: "XX"
    }
  };
  const shopperOrdersClient = new ShopperOrders(clientConfig);
API Version: 0.0.33
Last Updated:

Type parameters

Hierarchy

  • ShopperOrders

Index

Constructors

constructor

Properties

clientConfig

clientConfig: ClientConfig<ConfigParameters> & { baseUri: string }

Static Readonly defaultBaseUri

defaultBaseUri: "https://{shortCode}.api.commercecloud.salesforce.com/checkout/shopper-orders/v1" = currentBaseUri

Static Readonly paramKeys

paramKeys: { cancelOmsOrder: ["organizationId", "orderNo", "siteId", "locale"]; cancelOmsOrderRequired: ["organizationId", "orderNo", "siteId"]; createOrder: ["organizationId", "siteId", "locale"]; createOrderRequired: ["organizationId", "siteId"]; createPaymentInstrumentForOrder: ["organizationId", "orderNo", "siteId", "locale"]; createPaymentInstrumentForOrderRequired: ["organizationId", "orderNo", "siteId"]; failOrder: ["organizationId", "orderNo", "siteId", "locale", "reopenBasket"]; failOrderRequired: ["organizationId", "orderNo", "siteId"]; getOmsMetaData: ["organizationId", "siteId"]; getOmsMetaDataRequired: ["organizationId", "siteId"]; getOrder: ["orderNo", "organizationId", "siteId", "locale", "expand"]; getOrderRequired: ["orderNo", "organizationId", "siteId"]; getPaymentMethodsForOrder: ["organizationId", "orderNo", "siteId", "locale"]; getPaymentMethodsForOrderRequired: ["organizationId", "orderNo", "siteId"]; getTaxesFromOrder: ["organizationId", "orderNo", "siteId"]; getTaxesFromOrderRequired: ["organizationId", "orderNo", "siteId"]; guestOrderLookup: ["organizationId", "orderNo", "siteId", "locale", "expand"]; guestOrderLookupRequired: ["organizationId", "orderNo", "siteId"]; removePaymentInstrumentFromOrder: ["paymentInstrumentId", "organizationId", "orderNo", "siteId", "locale"]; removePaymentInstrumentFromOrderRequired: ["paymentInstrumentId", "organizationId", "orderNo", "siteId"]; returnOmsOrder: ["organizationId", "orderNo", "siteId", "locale"]; returnOmsOrderRequired: ["organizationId", "orderNo", "siteId"]; updatePaymentInstrumentForOrder: ["paymentInstrumentId", "organizationId", "orderNo", "siteId", "locale"]; updatePaymentInstrumentForOrderRequired: ["paymentInstrumentId", "organizationId", "orderNo", "siteId"] } = {cancelOmsOrder: ['organizationId','orderNo','siteId','locale',],cancelOmsOrderRequired: ['organizationId','orderNo','siteId',],createOrder: ['organizationId','siteId','locale',],createOrderRequired: ['organizationId','siteId',],createPaymentInstrumentForOrder: ['organizationId','orderNo','siteId','locale',],createPaymentInstrumentForOrderRequired: ['organizationId','orderNo','siteId',],failOrder: ['organizationId','orderNo','siteId','locale','reopenBasket',],failOrderRequired: ['organizationId','orderNo','siteId',],getOmsMetaData: ['organizationId','siteId',],getOmsMetaDataRequired: ['organizationId','siteId',],getOrder: ['orderNo','organizationId','siteId','locale','expand',],getOrderRequired: ['orderNo','organizationId','siteId',],getPaymentMethodsForOrder: ['organizationId','orderNo','siteId','locale',],getPaymentMethodsForOrderRequired: ['organizationId','orderNo','siteId',],getTaxesFromOrder: ['organizationId','orderNo','siteId',],getTaxesFromOrderRequired: ['organizationId','orderNo','siteId',],guestOrderLookup: ['organizationId','orderNo','siteId','locale','expand',],guestOrderLookupRequired: ['organizationId','orderNo','siteId',],removePaymentInstrumentFromOrder: ['paymentInstrumentId','organizationId','orderNo','siteId','locale',],removePaymentInstrumentFromOrderRequired: ['paymentInstrumentId','organizationId','orderNo','siteId',],returnOmsOrder: ['organizationId','orderNo','siteId','locale',],returnOmsOrderRequired: ['organizationId','orderNo','siteId',],updatePaymentInstrumentForOrder: ['paymentInstrumentId','organizationId','orderNo','siteId','locale',],updatePaymentInstrumentForOrderRequired: ['paymentInstrumentId','organizationId','orderNo','siteId',],} as const

Type declaration

  • cancelOmsOrder: ["organizationId", "orderNo", "siteId", "locale"]
  • cancelOmsOrderRequired: ["organizationId", "orderNo", "siteId"]
  • createOrder: ["organizationId", "siteId", "locale"]
  • createOrderRequired: ["organizationId", "siteId"]
  • createPaymentInstrumentForOrder: ["organizationId", "orderNo", "siteId", "locale"]
  • createPaymentInstrumentForOrderRequired: ["organizationId", "orderNo", "siteId"]
  • failOrder: ["organizationId", "orderNo", "siteId", "locale", "reopenBasket"]
  • failOrderRequired: ["organizationId", "orderNo", "siteId"]
  • getOmsMetaData: ["organizationId", "siteId"]
  • getOmsMetaDataRequired: ["organizationId", "siteId"]
  • getOrder: ["orderNo", "organizationId", "siteId", "locale", "expand"]
  • getOrderRequired: ["orderNo", "organizationId", "siteId"]
  • getPaymentMethodsForOrder: ["organizationId", "orderNo", "siteId", "locale"]
  • getPaymentMethodsForOrderRequired: ["organizationId", "orderNo", "siteId"]
  • getTaxesFromOrder: ["organizationId", "orderNo", "siteId"]
  • getTaxesFromOrderRequired: ["organizationId", "orderNo", "siteId"]
  • guestOrderLookup: ["organizationId", "orderNo", "siteId", "locale", "expand"]
  • guestOrderLookupRequired: ["organizationId", "orderNo", "siteId"]
  • removePaymentInstrumentFromOrder: ["paymentInstrumentId", "organizationId", "orderNo", "siteId", "locale"]
  • removePaymentInstrumentFromOrderRequired: ["paymentInstrumentId", "organizationId", "orderNo", "siteId"]
  • returnOmsOrder: ["organizationId", "orderNo", "siteId", "locale"]
  • returnOmsOrderRequired: ["organizationId", "orderNo", "siteId"]
  • updatePaymentInstrumentForOrder: ["paymentInstrumentId", "organizationId", "orderNo", "siteId", "locale"]
  • updatePaymentInstrumentForOrderRequired: ["paymentInstrumentId", "organizationId", "orderNo", "siteId"]

Methods

cancelOmsOrder

  • Cancels an order that is integrated with Order Management (OMS). The cancellation always applies to the entire order; partial cancellations are not supported.

    If you would like to get a raw Response object use the other cancelOmsOrder function.

    Parameters

    Returns Promise<Order>

    A promise of type Order.

  • Cancels an order that is integrated with Order Management (OMS). The cancellation always applies to the entire order; partial cancellations are not supported.

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : Order>

    A promise of type Response if rawResponse is true, a promise of type Order otherwise.

createOrder

  • Submits an order based on a prepared basket. The only considered value from the request body is basketId.

    If you would like to get a raw Response object use the other createOrder function.

    Parameters

    Returns Promise<Order>

    A promise of type Order.

  • Submits an order based on a prepared basket. The only considered value from the request body is basketId.

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : Order>

    A promise of type Response if rawResponse is true, a promise of type Order otherwise.

createPaymentInstrumentForOrder

  • Adds a payment instrument to an order.

    Details:

    The payment instrument is added with the provided details. The payment method must be applicable for the order see GET /baskets/{basketId}/payment-methods, if the payment method is 'CREDIT_CARD' a paymentCard must be specified in the request.

    If you would like to get a raw Response object use the other createPaymentInstrumentForOrder function.

    Parameters

    Returns Promise<Order>

    A promise of type Order.

  • Adds a payment instrument to an order.

    Details:

    The payment instrument is added with the provided details. The payment method must be applicable for the order see GET /baskets/{basketId}/payment-methods, if the payment method is 'CREDIT_CARD' a paymentCard must be specified in the request.

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : Order>

    A promise of type Response if rawResponse is true, a promise of type Order otherwise.

failOrder

  • Fails an unplaced order and optionally reopens the basket when indicated. Creates a HistoryEntry in the failed Order with provided reasonCode.

    If you would like to get a raw Response object use the other failOrder function.

    Parameters

    Returns Promise<void>

    A promise of type void.

  • Fails an unplaced order and optionally reopens the basket when indicated. Creates a HistoryEntry in the failed Order with provided reasonCode.

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : void>

    A promise of type Response if rawResponse is true, a promise of type void otherwise.

getOmsMetaData

  • Retrieves configuration data from Order Management (OMS) required by the storefront to render cancel and return experiences. The response contains the reason codes configured in OMS for cancelling an order and for returning order items. Each reason code carries a default flag. When the caller omits a reason, the cancel and return endpoints (cancelOmsOrder, returnOmsOrder) apply the reason marked as default for that flow.

    If you would like to get a raw Response object use the other getOmsMetaData function.

    Parameters

    Returns Promise<OmsMetaData>

    A promise of type OmsMetaData.

  • Retrieves configuration data from Order Management (OMS) required by the storefront to render cancel and return experiences. The response contains the reason codes configured in OMS for cancelling an order and for returning order items. Each reason code carries a default flag. When the caller omits a reason, the cancel and return endpoints (cancelOmsOrder, returnOmsOrder) apply the reason marked as default for that flow.

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : OmsMetaData>

    A promise of type Response if rawResponse is true, a promise of type OmsMetaData otherwise.

getOrder

  • Gets information for an order.

    If you would like to get a raw Response object use the other getOrder function.

    Parameters

    Returns Promise<Order>

    A promise of type Order.

  • Gets information for an order.

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : Order>

    A promise of type Response if rawResponse is true, a promise of type Order otherwise.

getPaymentMethodsForOrder

  • Gets the applicable payment methods for an existing order considering the open payment amount only.

    If you would like to get a raw Response object use the other getPaymentMethodsForOrder function.

    Parameters

    Returns Promise<PaymentMethodResult>

    A promise of type PaymentMethodResult.

  • Gets the applicable payment methods for an existing order considering the open payment amount only.

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : PaymentMethodResult>

    A promise of type Response if rawResponse is true, a promise of type PaymentMethodResult otherwise.

getTaxesFromOrder

  • This method gives you the external taxation data of the order transferred from the basket during order creation. This endpoint can be called only if external taxation was used. See POST /baskets for more information.

    If you would like to get a raw Response object use the other getTaxesFromOrder function.

    Parameters

    Returns Promise<Taxes>

    A promise of type Taxes.

  • This method gives you the external taxation data of the order transferred from the basket during order creation. This endpoint can be called only if external taxation was used. See POST /baskets for more information.

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : Taxes>

    A promise of type Response if rawResponse is true, a promise of type Taxes otherwise.

guestOrderLookup

  • Retrieve order details using non-token identifiers or an authenticated shopper session.

    The endpoint distinguishes between two levels of access:

    • Full access: Granted using shopper authentication or an OrderViewCode paired with email or phone information. Returns the complete order graph.
    • Partial access: Granted using a billing PostalCode paired with email or phone information. Filters sensitive data and Personally Identifiable Information (PII).

    If you would like to get a raw Response object use the other guestOrderLookup function.

    Parameters

    Returns Promise<Order>

    A promise of type Order.

  • Retrieve order details using non-token identifiers or an authenticated shopper session.

    The endpoint distinguishes between two levels of access:

    • Full access: Granted using shopper authentication or an OrderViewCode paired with email or phone information. Returns the complete order graph.
    • Partial access: Granted using a billing PostalCode paired with email or phone information. Filters sensitive data and Personally Identifiable Information (PII).

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : Order>

    A promise of type Response if rawResponse is true, a promise of type Order otherwise.

removePaymentInstrumentFromOrder

  • Removes a payment instrument of an order.

    If you would like to get a raw Response object use the other removePaymentInstrumentFromOrder function.

    Parameters

    Returns Promise<Order>

    A promise of type Order.

  • Removes a payment instrument of an order.

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : Order>

    A promise of type Response if rawResponse is true, a promise of type Order otherwise.

returnOmsOrder

  • Initiates the return of one or more items of an order that is integrated with Order Management (OMS).

    If you would like to get a raw Response object use the other returnOmsOrder function.

    Parameters

    Returns Promise<Order>

    A promise of type Order.

  • Initiates the return of one or more items of an order that is integrated with Order Management (OMS).

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : Order>

    A promise of type Response if rawResponse is true, a promise of type Order otherwise.

updatePaymentInstrumentForOrder

  • Updates a payment instrument of an order.

    Details:

    The payment instrument is updated with the provided details. The payment method must be applicable for the order see GET /baskets/{basketId}/payment-methods, if the payment method is 'CREDIT_CARD' a paymentCard must be specified in the request.

    If you would like to get a raw Response object use the other updatePaymentInstrumentForOrder function.

    Parameters

    Returns Promise<Order>

    A promise of type Order.

  • Updates a payment instrument of an order.

    Details:

    The payment instrument is updated with the provided details. The payment method must be applicable for the order see GET /baskets/{basketId}/payment-methods, if the payment method is 'CREDIT_CARD' a paymentCard must be specified in the request.

    Type parameters

    • T: boolean

    Parameters

    Returns Promise<T extends true ? Response : Order>

    A promise of type Response if rawResponse is true, a promise of type Order otherwise.

Object literals

Static Readonly apiPaths

apiPaths: object

cancelOmsOrder

cancelOmsOrder: string = "/organizations/{organizationId}/orders/{orderNo}/actions/oms-cancel-order"

createOrder

createOrder: string = "/organizations/{organizationId}/orders"

createPaymentInstrumentForOrder

createPaymentInstrumentForOrder: string = "/organizations/{organizationId}/orders/{orderNo}/payment-instruments"

failOrder

failOrder: string = "/organizations/{organizationId}/orders/{orderNo}/actions/fail"

getOmsMetaData

getOmsMetaData: string = "/organizations/{organizationId}/orders/oms-meta-data"

getOrder

getOrder: string = "/organizations/{organizationId}/orders/{orderNo}"

getPaymentMethodsForOrder

getPaymentMethodsForOrder: string = "/organizations/{organizationId}/orders/{orderNo}/payment-methods"

getTaxesFromOrder

getTaxesFromOrder: string = "/organizations/{organizationId}/orders/{orderNo}/taxes"

guestOrderLookup

guestOrderLookup: string = "/organizations/{organizationId}/orders/{orderNo}/lookup"

removePaymentInstrumentFromOrder

removePaymentInstrumentFromOrder: string = "/organizations/{organizationId}/orders/{orderNo}/payment-instruments/{paymentInstrumentId}"

returnOmsOrder

returnOmsOrder: string = "/organizations/{organizationId}/orders/{orderNo}/actions/oms-return-order"

updatePaymentInstrumentForOrder

updatePaymentInstrumentForOrder: string = "/organizations/{organizationId}/orders/{orderNo}/payment-instruments/{paymentInstrumentId}"

Generated using TypeDoc