Setup

To use the Orders API, install the @wix/ecom package using npm or Yarn:

Copy
1
npm install @wix/ecom

or

Copy
1
yarn add @wix/ecom

Then import { orders } from @wix/ecom:

Copy
1
import { orders } from '@wix/ecom'
Was this helpful?
Yes
No

cancelOrder( )

Cancels an order.

The cancelOrder() function returns a Promise that resolves when the specified order is canceled and the order.status field changes to CANCELED.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about permission scopes.
Copy
function cancelOrder(_id: string, options: CancelOrderOptions): Promise<CancelOrderResponse>
Method Parameters
_idstringRequired

Order ID.


optionsCancelOrderOptions
Returns
Return Type:Promise<CancelOrderResponse>
Was this helpful?
Yes
No

createOrder( )

Creates an order.

The createOrder() function returns a Promise that resolves when the order is created.

Notes:

  • If an item is digital - lineItems[i].itemType.preset: DIGITAL - then lineItems[i].digitalFile must be provided.
  • If lineItems[i].id is passed, it must be either a valid GUID, or empty.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about permission scopes.
Copy
function createOrder(order: Order): Promise<Order>
Method Parameters
orderOrderRequired

Order info.

Returns
Return Type:Promise<Order>
Was this helpful?
Yes
No

getOrder( )

Retrieves an order.

The getOrder() function returns a Promise that resolves when the specified order is retrieved.

To retrieve an order's payment and refund details, including amounts, payment methods, and payment statuses, pass the order ID to listTransactionsForSingleOrder( ).

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Read eCommerce - all read permissions
Read Orders
Read Stores - all read permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about permission scopes.
Copy
function getOrder(_id: string): Promise<Order>
Method Parameters
_idstringRequired

ID of the order to retrieve.

Returns
Return Type:Promise<Order>
Was this helpful?
Yes
No

searchOrders( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Retrieves a list of orders, given the provided paging, filtering, and sorting.

Search Orders runs with these defaults, which you can override:

  • createdDate is sorted in DESC order
  • cursorPaging.limit is 100
  • filter: {"status": {"$ne": "INITIALIZED"}} - other order statuses can be queried, but orders with status: "INITIALIZED" are never returned

For field support for filters and sorting, see Orders: Supported Filters and Sorting.

To learn about working with Search endpoints, see API Query Language, and Sorting and Paging.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Read eCommerce - all read permissions
Read Orders
Read Stores - all read permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about permission scopes.
Copy
function searchOrders(options: SearchOrdersOptions): Promise<SearchOrdersResponse>
Method Parameters
optionsSearchOrdersOptions
Returns
Return Type:Promise<SearchOrdersResponse>
Was this helpful?
Yes
No

updateOrder( )

Updates an order.

The updateOrder() function returns a Promise that resolves when the specified order's information is updated.

Currently, the following fields can be updated:

  • order.buyerInfo.email
  • order.recipientInfo.address
  • order.recipientInfo.contactDetails
  • order.shippingInfo.logistics.shippingDestination.address
  • order.shippingInfo.logistics.shippingDestination.contactDetails

To update a field's value, include the new value in the order object in the body params. To remove a field's value, pass null.

Note: Removing buyerInfo or contactDetails fields results in an error.

To update an order's payment status, use updatePaymentStatus( ).

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Manage eCommerce - all permissions
Manage Orders
Learn more about permission scopes.
Copy
function updateOrder(_id: string, order: UpdateOrder): Promise<Order>
Method Parameters
_idstringRequired

Order ID.


orderUpdateOrderRequired
Returns
Return Type:Promise<Order>
Was this helpful?
Yes
No