Class ShopperOrders<ConfigParameters>

Shopper Orders

*# 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.

Caching is provided for the Shopper Products API. For details, see Server-Side Web-Tier Caching.

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

Authentication & Authorization

The client requesting the product information must have access to the Products resource. The Shopper Products 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 the relevant scope(s) in the client ID used to generate the SLAS token. For details, see the Authorization Scopes Catalog.

Use Cases

Use Hooks

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

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

Constructors

Methods

  • 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

    • options: RequireParametersUnlessAllAreOptional<{
          body: {
              adjustedMerchandizeTotalTax?: number;
              adjustedShippingTotalTax?: number;
              agentBasket?: boolean;
              basketId?: string;
              billingAddress?: OrderAddress$2;
              bonusDiscountLineItems?: BonusDiscountLineItem$2[];
              channelType?: BasketChannelTypeEnum$1;
              couponItems?: CouponItem$2[];
              creationDate?: string;
              currency?: string;
              customerInfo?: CustomerInfo$2;
              giftCertificateItems?: GiftCertificateItem$2[];
              groupedTaxItems?: GroupedTaxItem$1[];
              inventoryReservationExpiry?: string;
              lastModified?: string;
              merchandizeTotalTax?: number;
              orderPriceAdjustments?: PriceAdjustment$2[];
              orderTotal?: number;
              paymentInstruments?: OrderPaymentInstrument$2[];
              productItems?: ProductItem$2[];
              productSubTotal?: number;
              productTotal?: number;
              shipments?: Shipment$2[];
              shippingItems?: ShippingItem$2[];
              shippingTotal?: number;
              shippingTotalTax?: number;
              sourceCode?: string;
              taxRoundedAtGroup?: boolean;
              taxTotal?: number;
              taxation?: BasketTaxationEnum$1;
              temporaryBasket?: boolean;
          } & {
              [key: string]: any;
          } & CustomRequestBody;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Order$0>

    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 extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: {
              adjustedMerchandizeTotalTax?: number;
              adjustedShippingTotalTax?: number;
              agentBasket?: boolean;
              basketId?: string;
              billingAddress?: OrderAddress$2;
              bonusDiscountLineItems?: BonusDiscountLineItem$2[];
              channelType?: BasketChannelTypeEnum$1;
              couponItems?: CouponItem$2[];
              creationDate?: string;
              currency?: string;
              customerInfo?: CustomerInfo$2;
              giftCertificateItems?: GiftCertificateItem$2[];
              groupedTaxItems?: GroupedTaxItem$1[];
              inventoryReservationExpiry?: string;
              lastModified?: string;
              merchandizeTotalTax?: number;
              orderPriceAdjustments?: PriceAdjustment$2[];
              orderTotal?: number;
              paymentInstruments?: OrderPaymentInstrument$2[];
              productItems?: ProductItem$2[];
              productSubTotal?: number;
              productTotal?: number;
              shipments?: Shipment$2[];
              shippingItems?: ShippingItem$2[];
              shippingTotal?: number;
              shippingTotalTax?: number;
              sourceCode?: string;
              taxRoundedAtGroup?: boolean;
              taxTotal?: number;
              taxation?: BasketTaxationEnum$1;
              temporaryBasket?: boolean;
          } & {
              [key: string]: any;
          } & CustomRequestBody;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Order$0>

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

  • 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

    • options: RequireParametersUnlessAllAreOptional<{
          body: {
              amount?: number;
              bankRoutingNumber?: string;
              giftCertificateCode?: string;
              paymentCard?: OrderPaymentCardRequest$1;
              paymentMethodId?: string;
          } & {
              [key: string]: any;
          } & CustomRequestBody;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Order$0>

    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 extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: {
              amount?: number;
              bankRoutingNumber?: string;
              giftCertificateCode?: string;
              paymentCard?: OrderPaymentCardRequest$1;
              paymentMethodId?: string;
          } & {
              [key: string]: any;
          } & CustomRequestBody;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Order$0>

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

  • Gets information for an order.

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

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Order$0>

    A promise of type Order.

  • Gets information for an order.

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Order$0>

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

  • 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

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<PaymentMethodResult$1>

    A promise of type PaymentMethodResult.

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

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : PaymentMethodResult$1>

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

  • 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

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Taxes$1>

    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 extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Taxes$1>

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

  • Use this endpoint to lookup a guest order.

    Important*: This endpoint uses the ShopperTokenTsob security scheme. Always check the Security section of the endpoint documentation, which is hidden by default.

    The API uses the orderViewCode generated during the order creation and the email of the order customer to lookup a guest order. If email is not provided on the order, the field can be left blank in the lookup request. Note*: In the no email on order scenario, the custom implementation must include an additional verification of an order attribute. For example, a postal code or mobile number.

    This API can also be used for looking up an order for a registered customer. In addition to the verification steps used for guest order lookup, the API also verifies that the customer ID of the order matches with the customer ID supplied in the ShopperTokenTsob.

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

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: {
              email: string;
              orderViewCode: string;
          } & {
              [key: string]: any;
          } & CustomRequestBody;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Order$0>

    A promise of type Order.

  • Use this endpoint to lookup a guest order.

    Important*: This endpoint uses the ShopperTokenTsob security scheme. Always check the Security section of the endpoint documentation, which is hidden by default.

    The API uses the orderViewCode generated during the order creation and the email of the order customer to lookup a guest order. If email is not provided on the order, the field can be left blank in the lookup request. Note*: In the no email on order scenario, the custom implementation must include an additional verification of an order attribute. For example, a postal code or mobile number.

    This API can also be used for looking up an order for a registered customer. In addition to the verification steps used for guest order lookup, the API also verifies that the customer ID of the order matches with the customer ID supplied in the ShopperTokenTsob.

    Type Parameters

    • T extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: {
              email: string;
              orderViewCode: string;
          } & {
              [key: string]: any;
          } & CustomRequestBody;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Order$0>

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

  • Removes a payment instrument of an order.

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

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  paymentInstrumentId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  paymentInstrumentId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Order$0>

    A promise of type Order.

  • Removes a payment instrument of an order.

    Type Parameters

    • T extends boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  paymentInstrumentId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  paymentInstrumentId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Order$0>

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

  • 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

    • options: RequireParametersUnlessAllAreOptional<{
          body: {
              amount?: number;
              bankRoutingNumber?: string;
              giftCertificateCode?: string;
              paymentCard?: OrderPaymentCardRequest$1;
              paymentMethodId?: string;
          } & {
              [key: string]: any;
          } & CustomRequestBody;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  paymentInstrumentId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  paymentInstrumentId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    Returns Promise<Order$0>

    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 extends boolean

    Parameters

    • options: RequireParametersUnlessAllAreOptional<{
          body: {
              amount?: number;
              bankRoutingNumber?: string;
              giftCertificateCode?: string;
              paymentCard?: OrderPaymentCardRequest$1;
              paymentMethodId?: string;
          } & {
              [key: string]: any;
          } & CustomRequestBody;
          headers?: {
              [key: string]: string;
          };
          parameters?: {
              [K in string | number]: (Omit<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  paymentInstrumentId: string;
                  siteId: string;
              } & QueryParameters, keyof ConfigParameters> & Partial<{
                  locale?: string;
                  orderNo: string;
                  organizationId: string;
                  paymentInstrumentId: string;
                  siteId: string;
              } & QueryParameters>)[K]
          };
      }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true
        ? Response
        : Order$0>

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

Properties

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

Type declaration

  • baseUri: string
apiPaths: {
    createOrder: string;
    createPaymentInstrumentForOrder: string;
    getOrder: string;
    getPaymentMethodsForOrder: string;
    getTaxesFromOrder: string;
    guestOrderLookup: string;
    removePaymentInstrumentFromOrder: string;
    updatePaymentInstrumentForOrder: string;
}

Type declaration

  • createOrder: string
  • createPaymentInstrumentForOrder: string
  • getOrder: string
  • getPaymentMethodsForOrder: string
  • getTaxesFromOrder: string
  • guestOrderLookup: string
  • removePaymentInstrumentFromOrder: string
  • updatePaymentInstrumentForOrder: string
defaultBaseUri: "https://{shortCode}.api.commercecloud.salesforce.com/checkout/shopper-orders/v1" = "https://{shortCode}.api.commercecloud.salesforce.com/checkout/shopper-orders/v1"
paramKeys: {
    createOrder: readonly ["organizationId", "siteId", "locale"];
    createOrderRequired: readonly ["organizationId", "siteId"];
    createPaymentInstrumentForOrder: readonly ["organizationId", "orderNo", "siteId", "locale"];
    createPaymentInstrumentForOrderRequired: readonly ["organizationId", "orderNo", "siteId"];
    getOrder: readonly ["orderNo", "organizationId", "siteId", "locale"];
    getOrderRequired: readonly ["orderNo", "organizationId", "siteId"];
    getPaymentMethodsForOrder: readonly ["organizationId", "orderNo", "siteId", "locale"];
    getPaymentMethodsForOrderRequired: readonly ["organizationId", "orderNo", "siteId"];
    getTaxesFromOrder: readonly ["organizationId", "orderNo", "siteId"];
    getTaxesFromOrderRequired: readonly ["organizationId", "orderNo", "siteId"];
    guestOrderLookup: readonly ["organizationId", "orderNo", "siteId", "locale"];
    guestOrderLookupRequired: readonly ["organizationId", "orderNo", "siteId"];
    removePaymentInstrumentFromOrder: readonly ["paymentInstrumentId", "organizationId", "orderNo", "siteId", "locale"];
    removePaymentInstrumentFromOrderRequired: readonly ["paymentInstrumentId", "organizationId", "orderNo", "siteId"];
    updatePaymentInstrumentForOrder: readonly ["paymentInstrumentId", "organizationId", "orderNo", "siteId", "locale"];
    updatePaymentInstrumentForOrderRequired: readonly ["paymentInstrumentId", "organizationId", "orderNo", "siteId"];
}

Type declaration

  • Readonly createOrder: readonly ["organizationId", "siteId", "locale"]
  • Readonly createOrderRequired: readonly ["organizationId", "siteId"]
  • Readonly createPaymentInstrumentForOrder: readonly ["organizationId", "orderNo", "siteId", "locale"]
  • Readonly createPaymentInstrumentForOrderRequired: readonly ["organizationId", "orderNo", "siteId"]
  • Readonly getOrder: readonly ["orderNo", "organizationId", "siteId", "locale"]
  • Readonly getOrderRequired: readonly ["orderNo", "organizationId", "siteId"]
  • Readonly getPaymentMethodsForOrder: readonly ["organizationId", "orderNo", "siteId", "locale"]
  • Readonly getPaymentMethodsForOrderRequired: readonly ["organizationId", "orderNo", "siteId"]
  • Readonly getTaxesFromOrder: readonly ["organizationId", "orderNo", "siteId"]
  • Readonly getTaxesFromOrderRequired: readonly ["organizationId", "orderNo", "siteId"]
  • Readonly guestOrderLookup: readonly ["organizationId", "orderNo", "siteId", "locale"]
  • Readonly guestOrderLookupRequired: readonly ["organizationId", "orderNo", "siteId"]
  • Readonly removePaymentInstrumentFromOrder: readonly ["paymentInstrumentId", "organizationId", "orderNo", "siteId", "locale"]
  • Readonly removePaymentInstrumentFromOrderRequired: readonly ["paymentInstrumentId", "organizationId", "orderNo", "siteId"]
  • Readonly updatePaymentInstrumentForOrder: readonly ["paymentInstrumentId", "organizationId", "orderNo", "siteId", "locale"]
  • Readonly updatePaymentInstrumentForOrderRequired: readonly ["paymentInstrumentId", "organizationId", "orderNo", "siteId"]