Setup
To use the Orders API, install the @wix/ecom
package using npm or Yarn:
1npm install @wix/ecom
or
1yarn add @wix/ecom
Then import { orders }
from @wix/ecom
:
1import { orders } from '@wix/ecom'
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:function cancelOrder(_id: string, options: CancelOrderOptions): Promise<CancelOrderResponse>
Order ID.
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
- thenlineItems[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:function createOrder(order: Order): Promise<Order>
Order info.
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:function getOrder(_id: string): Promise<Order>
ID of the order to retrieve.
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 inDESC
ordercursorPaging.limit
is100
filter: {"status": {"$ne": "INITIALIZED"}}
- other order statuses can be queried, but orders withstatus: "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:function searchOrders(options: SearchOrdersOptions): Promise<SearchOrdersResponse>
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:function updateOrder(_id: string, order: UpdateOrder): Promise<Order>
Order ID.