import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.return.retrieve("return_123")
.then(({ return }) => {
console.log(return)
}){
"return": {
"id": "<string>",
"order_id": "<string>",
"items": [
{
"id": "<string>",
"quantity": 123,
"received_quantity": 123,
"damaged_quantity": 123,
"item_id": "<string>",
"return_id": "<string>",
"reason_id": "<string>",
"note": "<string>",
"metadata": {}
}
],
"created_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"order_version": 123,
"display_id": 123,
"received_at": "<string>",
"status": "canceled",
"refund_amount": 123,
"exchange_id": "<string>",
"location_id": "<string>",
"claim_id": "<string>",
"no_notification": true
}
}Retrieve a return by its ID. You can expand the return’s relations or select the fields that should be returned.
import Switchyard from "@switchyard/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.return.retrieve("return_123")
.then(({ return }) => {
console.log(return)
}){
"return": {
"id": "<string>",
"order_id": "<string>",
"items": [
{
"id": "<string>",
"quantity": 123,
"received_quantity": 123,
"damaged_quantity": 123,
"item_id": "<string>",
"return_id": "<string>",
"reason_id": "<string>",
"note": "<string>",
"metadata": {}
}
],
"created_at": "2023-11-07T05:31:56Z",
"canceled_at": "2023-11-07T05:31:56Z",
"order_version": 123,
"display_id": 123,
"received_at": "<string>",
"status": "canceled",
"refund_amount": 123,
"exchange_id": "<string>",
"location_id": "<string>",
"claim_id": "<string>",
"no_notification": true
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The return's ID.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
OK
The return's details.
The return's details.
Show child attributes
The return's ID.
The ID of the associated order.
The return's items.
Show child attributes
The return item's ID.
The return item's quantity.
The received quantity of the item. This quantity is added to the stocked inventory quantity of the item.
The received damaged quantity of the item, which isn't added to the stocked inventory quantity of the item.
The ID of the associated order item.
The ID of the return this return item belongs to.
The ID of the return reason associated with the item.
A note about why the item was returned.
The return item's metadata, can hold custom key-value pairs.
The date the return was created.
The date the return was canceled.
The return's order version.
The return's display id.
The date the return was received.
The return's status.
canceled, requested, received, partially_received The amount refunded by this return.
The return's exchange id.
The return's location id.
The return's claim id.
Whether the customer should receive notifications about the return's updates.