OrdersResource
This class is used to send requests to Store Order API Routes. All its method
are available in the JS Client under the medusa.orders
property.
Orders are purchases made by customers, typically through a storefront. Orders are placed and created using CartsResource. The methods in this class allow retrieving and claiming orders.
Related Guide: How to retrieve order details in a storefront.
Methods
retrieve
Retrieve an Order's details.
Example
Parameters
id
stringRequiredcustomHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<StoreOrdersRes>RequiredResolves to the details of the order.
ResponsePromise
ResponsePromise<StoreOrdersRes>RequiredretrieveByCartId
Retrieve an order's details by the ID of the cart that was used to create the order.
Example
Parameters
cart_id
stringRequiredcustomHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<StoreOrdersRes>RequiredResolves to the details of the order.
ResponsePromise
ResponsePromise<StoreOrdersRes>RequiredlookupOrder
Look up an order using filters. If the filters don't narrow down the results to a single order, a 404
response is returned with no orders.
Example
Parameters
Filters used to retrieve the order.
customHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<StoreOrdersRes>RequiredResolves to the details of the order.
ResponsePromise
ResponsePromise<StoreOrdersRes>RequiredrequestCustomerOrders
Allow the logged-in customer to claim ownership of one or more orders. This generates a token that can be used later on to verify the claim using the confirmRequest method.
This also emits the event order-update-token.created
. So, if you have a notification provider installed that handles this event and sends the customer a notification, such as an email,
the customer should receive instructions on how to finalize their claim ownership.
Example
Parameters
The orders to claim.
customHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromiseRequiredconfirmRequest
Verify the claim order token provided to the customer when they request ownership of an order.
Example
Parameters
The claim order to verify.
customHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromiseRequired