Alokai
You are reading the documentation for v7.x and earlier, which is no longer the latest version. Switch to v8.x

placeOrder

Method authorizing a cart and placing an order in SAP Commerce Cloud.

This method sends a POST request to the placeOrder endpoint of the Alokai Middleware. In turn, it exchanges data with the placeOrder endpoint exposed by the SAP OCC API Orders Controller.

This method will only work for either a current user cart or a guest cart (i.e. cart with an email added to it). It will not work with an anonymous cart. In case of a guest cart, remember to pass cart guid as the cartId param. In case of a current user cart, pass cart code instead.

Signature

export declare function placeOrder<Res extends Order = Order,
	Props extends PlaceOrderProps = PlaceOrderProps>(
	props: Props,
	options?: MethodOptions
): Promise<Res>;

Parameters

NameRequiredTypeDescription
propsRequiredPropsParameter object which can be used with this method. Refer to its type definition to learn about possible properties.
optionsOptionalMethodOptionsOptions that can be passed to additionally configure the request or customize the logic in a plugin.

Returns

Returns a representation of an Order.

Referenced Types

Examples

Placing an order from a cart.

import { sdk } from '~/sdk';

const order = await sdk.commerce.placeOrder({ cartId: '00035084' });

Placing an order from a cart and selecting response fields.

import { sdk } from '~/sdk';

const order = await sdk.commerce.placeOrder({ cartId: '00035084', fields: 'code,guid,deliveryStatus' });

On this page