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
confirmRequest
Verify the claim order token provided to the customer when they request ownership of an order.
Example
Parameters
The claim order to verify.
customHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromiseRequiredlookupOrder
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.
customHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<StoreOrdersRes>RequiredResolves to the details of the order.
ResponsePromiseResponsePromise<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.
customHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromiseRequiredretrieve
Retrieve an Order's details.
Example
Parameters
idstringRequiredcustomHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<StoreOrdersRes>RequiredResolves to the details of the order.
ResponsePromiseResponsePromise<StoreOrdersRes>RequiredretrieveByCartId
Retrieve an order's details by the ID of the cart that was used to create the order.
Example
Parameters
cart_idstringRequiredcustomHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<StoreOrdersRes>RequiredResolves to the details of the order.
ResponsePromiseResponsePromise<StoreOrdersRes>Required