Typescript SDK Type Docs
    Preparing search index...

    Class ByProjectKeyMeOrdersRequestBuilder

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    args: {
        baseUri?: string;
        executeRequest: executeRequest;
        pathArgs: { projectKey: string };
    }

    Methods

    • Retrieves Orders for the authenticated Customer or anonymous user.

      A [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned in the following scenarios:
      
      - If no Orders exist for the provided query predicate.
      - If an Order exists but does not have a `customerId` that matches the [customer:{id}](/scopes#composable-commerce-oauth) scope, or `anonymousId` that matches the [anonymous_id:{id}](/scopes#composable-commerce-oauth) scope.
      

      Parameters

      • OptionalmethodArgs: {
            headers?: { [key: string]: string | string[] };
            queryArgs?: {
                expand?: string | string[];
                limit?: number;
                offset?: number;
                sort?: string | string[];
                where?: string | string[];
                withTotal?: boolean;
                [key: string]: QueryParam;
            };
        }

      Returns ApiRequest<OrderPagedQueryResponse>

    • Checks if one or more Orders exist for the provided query predicate for the authenticated Customer or anonymous user. Returns a 200 status if successful.

      A [Not Found](/../api/errors#404-not-found) error is returned in the following scenarios:
      
      - If no Orders exist that match the provided query predicate.
      - If one or more Orders exist but don't have either a `customerId` that matches the [customer:{id}](/scopes#composable-commerce-oauth) scope, or an `anonymousId` that matches the [anonymous_id:{id}](/scopes#composable-commerce-oauth) scope.
      

      Parameters

      • OptionalmethodArgs: {
            headers?: { [key: string]: string | string[] };
            queryArgs?: { where?: string | string[]; [key: string]: QueryParam };
        }

      Returns ApiRequest<void>

    post

    • post(
          methodArgs: {
              body: MyOrderFromCartDraft;
              headers?: { [key: string]: string | string[] };
              queryArgs?: { expand?: string | string[]; [key: string]: QueryParam };
          },
      ): ApiRequest<Order>

      Creates an Order from a Cart for the Customer or anonymous user. The customerId or anonymousId field on the Order is automatically set based on the customer:{id} or anonymous_id:{id} scope.

      The Cart must have a shipping address and an active Shipping Method set. When creating [B2B Orders](/associates-overview#b2b-resources), the Customer must have the `CreateMyOrdersFromMyCarts` [Permission](ctp:api:type:Permission).
      
      If the Cart's `customerId` does not match the [customer:{id}](/scopes#composable-commerce-oauth) scope, or the `anonymousId` does not match the [anonymous_id:{id}](/scopes#composable-commerce-oauth) scope, a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error is returned.
      
      Creating an Order produces the [OrderCreated](ctp:api:type:OrderCreatedMessage) Message.
      
      If a server-side problem occurs, indicated by a 500 Internal Server Error HTTP response, the Order creation may still successfully complete after the error is returned.
      If you receive this error, you should verify the status of the Order by querying a unique identifier supplied during the creation request, such as the Order number.
      
      Specific Error Codes:
      
      - [AssociateMissingPermission](ctp:api:type:AssociateMissingPermissionError)
      - [DiscountCodeNonApplicable](ctp:api:type:DiscountCodeNonApplicableError)
      - [InvalidItemShippingDetails](ctp:api:type:InvalidItemShippingDetailsError)
      - [OutOfStock](ctp:api:type:OutOfStockError)
      - [PriceChanged](ctp:api:type:PriceChangedError)
      - [ShippingMethodDoesNotMatchCart](ctp:api:type:ShippingMethodDoesNotMatchCartError)
      - [MatchingPriceNotFound](ctp:api:type:MatchingPriceNotFoundError)
      - [MissingTaxRateForCountry](ctp:api:type:MissingTaxRateForCountryError)
      

      Parameters

      • methodArgs: {
            body: MyOrderFromCartDraft;
            headers?: { [key: string]: string | string[] };
            queryArgs?: { expand?: string | string[]; [key: string]: QueryParam };
        }

      Returns ApiRequest<Order>