Skip to main content
Skip to main content

ReturnsResource

This class is used to send requests to Store Return API Routes. All its method are available in the JS Client under the medusa.returns property.

A return can be created by a customer to return items in an order.

Related Guide: How to create a return in a storefront.

Methods

create

Create a return for an order. If a return shipping method is specified, the return is automatically fulfilled.

Example

import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
medusa.returns.create({
order_id,
items: [
{
item_id,
quantity: 1
}
]
})
.then((data) => {
console.log(data.return.id);
})

Parameters

payloadStorePostReturnsReqRequired
The data of the return to be created.
customHeadersRecord<string, any>Required
Custom headers to attach to the request.

Default: {}

Returns

ResponsePromiseResponsePromise<StoreReturnsRes>Required
Resolves to the return's details.
Was this section helpful?