Use this endpoint whenever a fully calculated and paid or authorized order is created in any third-party system.
The endpoint can create an order on-the-fly in the Commerce Cloud platform by passing the order as JSON payload in the body of the POST request.
Other than the Basket API, this endpoint decouples any relation to other system domains, such as:
The order isn't treated differently than any other orders in the Commerce Cloud platform, and any status updates or order exports behave the same.
Note*: For the custom attribute to be available for orders, configure it in Business Manager for both Basket and Order objects.
Important*: This endpoint uses the ShopperTokenTsob
security scheme. Always check the Security section of the endpoint documentation, which is hidden by default.
The checkout must happen before making a request to this endpoint. That means that all sanity checks are applied, the inventory is reserved, the payment is authorized, and the Basket is fully calculated (including all promotions).
When meeting these conditions, it's possible to create the order in the Commerce Cloud platform.
This endpoint can create an order with unknown products, with different pricing for known products, any unplanned price-adjustments (unrelated to the system's configured promotions), passing unknown payment, and shipping methods.
Note*: There's no lookup or calculation, even if the passed object is configured in the platform.
The endpoint is still coupled to the following:
There's no multiplying or dividing operations performed by the platform on this order.
The following fields are summed up during runtime on the platform:
Order Level*
adjustedMerchandizeTotalTax
adjustedShippingTotalTax
merchandizeTotalTax
adjustedTax
productSubTotal
productTotal
shippingTotalTax
orderTotal
taxTotal
Line Item Level*
priceAfterItemDiscount
priceAfterOrderDiscount
adjustedTax
Shipment*
merchandizeTotalTax
productSubTotal
productTotal
shippingTotalTax
To make sure the fields are summed up correctly, the passed orderTotal
and taxTotal
are compared to the platform's summed up orderTotal
and taxTotal
.
An InvalidOrderTotalException
or InvalidTaxTotalException
is thrown if the calculation doesn't match.
The orderTotal
and taxTotal
are calculated as follows:
orderTotal
= sum(ProductLineItems.grossPrice
) + sum(Shipments.shipmentTotal
) - sum(ProductLineItems.PriceAdjustments.grossPrice
+ Order.PriceAdjustments.grossPrice
)taxTotal
= sum (ProductLineItems.tax
) + sum(Shipments.taxTotal
) - sum(ProductLineItems.PriceAdjustments.tax
+ Order.PriceAdjustments.tax
)The order is automatically placed after creation.
The payment status can be set via payload.
All other status can be set via PATCH orders/\{orderNo\}/status
.
If you would like to get a raw Response object use the other createOrders function.
An object containing the options for this method.
A promise of type void.
Use this endpoint whenever a fully calculated and paid or authorized order is created in any third-party system.
The endpoint can create an order on-the-fly in the Commerce Cloud platform by passing the order as JSON payload in the body of the POST request.
Other than the Basket API, this endpoint decouples any relation to other system domains, such as:
The order isn't treated differently than any other orders in the Commerce Cloud platform, and any status updates or order exports behave the same.
Note*: For the custom attribute to be available for orders, configure it in Business Manager for both Basket and Order objects.
Important*: This endpoint uses the ShopperTokenTsob
security scheme. Always check the Security section of the endpoint documentation, which is hidden by default.
The checkout must happen before making a request to this endpoint. That means that all sanity checks are applied, the inventory is reserved, the payment is authorized, and the Basket is fully calculated (including all promotions).
When meeting these conditions, it's possible to create the order in the Commerce Cloud platform.
This endpoint can create an order with unknown products, with different pricing for known products, any unplanned price-adjustments (unrelated to the system's configured promotions), passing unknown payment, and shipping methods.
Note*: There's no lookup or calculation, even if the passed object is configured in the platform.
The endpoint is still coupled to the following:
There's no multiplying or dividing operations performed by the platform on this order.
The following fields are summed up during runtime on the platform:
Order Level*
adjustedMerchandizeTotalTax
adjustedShippingTotalTax
merchandizeTotalTax
adjustedTax
productSubTotal
productTotal
shippingTotalTax
orderTotal
taxTotal
Line Item Level*
priceAfterItemDiscount
priceAfterOrderDiscount
adjustedTax
Shipment*
merchandizeTotalTax
productSubTotal
productTotal
shippingTotalTax
To make sure the fields are summed up correctly, the passed orderTotal
and taxTotal
are compared to the platform's summed up orderTotal
and taxTotal
.
An InvalidOrderTotalException
or InvalidTaxTotalException
is thrown if the calculation doesn't match.
The orderTotal
and taxTotal
are calculated as follows:
orderTotal
= sum(ProductLineItems.grossPrice
) + sum(Shipments.shipmentTotal
) - sum(ProductLineItems.PriceAdjustments.grossPrice
+ Order.PriceAdjustments.grossPrice
)taxTotal
= sum (ProductLineItems.tax
) + sum(Shipments.taxTotal
) - sum(ProductLineItems.PriceAdjustments.tax
+ Order.PriceAdjustments.tax
)The order is automatically placed after creation.
The payment status can be set via payload.
All other status can be set via PATCH orders/\{orderNo\}/status
.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
Returns the details of the order with the specified order number.
If you would like to get a raw Response object use the other getOrder function.
An object containing the options for this method.
A promise of type Orders.Order.
Returns the details of the order with the specified order number.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type Orders.Order otherwise.
Returns the details of orders that match the query filters. By default, calling this API with no filter returns the 100 most recently created orders. To return up to 200 orders, use the limit parameter. To return a page of results past the first page, use a resource offset. Note : The sum of the offset and limit parameters cannot be greater than 10000.
If you would like to get a raw Response object use the other getOrders function.
An object containing the options for this method.
A promise of type Orders.OrdersResponse.
Returns the details of orders that match the query filters. By default, calling this API with no filter returns the 100 most recently created orders. To return up to 200 orders, use the limit parameter. To return a page of results past the first page, use a resource offset. Note : The sum of the offset and limit parameters cannot be greater than 10000.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type Orders.OrdersResponse otherwise.
Updates the order.
If you would like to get a raw Response object use the other updateOrder function.
An object containing the options for this method.
A promise of type void.
Updates the order.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
Updates the order confirmation status.
If you would like to get a raw Response object use the other updateOrderConfirmationStatus function.
An object containing the options for this method.
A promise of type void.
Updates the order confirmation status.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
Updates the order export status. If on-order inventory is turned on for the associated inventory list, then setting the export status to EXPORTED finalizes on-order inventory transactions for this order by changing their type from on-order to final.
If you would like to get a raw Response object use the other updateOrderExportStatus function.
An object containing the options for this method.
A promise of type void.
Updates the order export status. If on-order inventory is turned on for the associated inventory list, then setting the export status to EXPORTED finalizes on-order inventory transactions for this order by changing their type from on-order to final.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
Updates the order external status.
If you would like to get a raw Response object use the other updateOrderExternalStatus function.
An object containing the options for this method.
A promise of type void.
Updates the order external status.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
Updates the payment instrument of an order.
If you would like to get a raw Response object use the other updateOrderPaymentInstrument function.
An object containing the options for this method.
A promise of type void.
Updates the payment instrument of an order.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
Updates the order payment status.
If you would like to get a raw Response object use the other updateOrderPaymentStatus function.
An object containing the options for this method.
A promise of type void.
Updates the order payment status.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
Updates the transaction of an order payment instrument.
If you would like to get a raw Response object use the other updateOrderPaymentTransaction function.
An object containing the options for this method.
A promise of type void.
Updates the transaction of an order payment instrument.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
Creates or replaces the shipping address.
If you would like to get a raw Response object use the other updateOrderShippingAddress function.
An object containing the options for this method.
A promise of type void.
Creates or replaces the shipping address.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
Updates the order shipping status.
If you would like to get a raw Response object use the other updateOrderShippingStatus function.
An object containing the options for this method.
A promise of type void.
Updates the order shipping status.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void otherwise.
Updates the order status. Orders in status NEW, COMPLETED or CANCELLED can't be changed to status CREATED or FAILED.
Changing the status processes different actions on inventory, coupons, wishlists and the order itself. Here are the supported actions:
Actions can fail for example when inventory is not available anymore.
If you would like to get a raw Response object use the other updateOrderStatus function.
An object containing the options for this method.
A promise of type void | void.
Updates the order status. Orders in status NEW, COMPLETED or CANCELLED can't be changed to status CREATED or FAILED.
Changing the status processes different actions on inventory, coupons, wishlists and the order itself. Here are the supported actions:
Actions can fail for example when inventory is not available anymore.
An object containing the options for this method.
Set to true to return entire Response object instead of DTO.
A promise of type Response if rawResponse is true, a promise of type void | void otherwise.
Generated using TypeDoc
Orders
Manage order and order payment status.
For instructions on how to retrieve access token for admin APIs: https://developer.salesforce.com/docs/commerce/commerce-api/guide/authorization-for-admin-apis.html
Example with admin auth
API Version: 1.4.4import { Checkout, ClientConfig } from "commerce-sdk"; // or const { Checkout, ClientConfig } = require("commerce-sdk"); const clientConfig: ClientConfig = { parameters: { clientId: "XXXXXX", organizationId: "XXXX", shortCode: "XXX", siteId: "XX" } }; token = { access_token: 'INSERT_ACCESS_TOKEN_HERE' }; clientConfig.headers['authorization'] = `Bearer ${token.access_token}`; const ordersClient = new Checkout.Orders(clientConfig);
Last Updated: