> For the complete documentation index, see [llms.txt](https://eshop.gitbook.io/eshopbox-developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://eshop.gitbook.io/eshopbox-developers/order/returns/update-a-return.md).

# Complete a Return

API for Marking Return Process as Completed in Eshopbox

## Complete a Return

<mark style="color:blue;">`PUT`</mark> <https://return-dot-eshopbox-client-portal-prod.el.r.appspot.com/_ah/api/esb/v2/return-shipment/{returnTrackingId}>

This endpoint will be used to mark the return process as complete in Eshopbox.

#### Headers

| Name          | Value            |
| ------------- | ---------------- |
| Content-Type  | application/json |
| Authorization | Bearer \<token>  |

#### Query Parameters

| Name             | Type   | Description                                |
| ---------------- | ------ | ------------------------------------------ |
| returnTrackingId | string | Unique tracking ID for the return process. |

#### Body

| Field                | Type    | Description                                                                                      | Mandatory |
| -------------------- | ------- | ------------------------------------------------------------------------------------------------ | --------- |
| returnTrackingId     | String  | Unique tracking ID for the return process.                                                       | Yes       |
| salesChannel         | String  | Identifier for the sales channel from which the order originated.                                | No        |
| customerOrderNumber  | String  | Order number assigned to the customer’s order.                                                   | Yes       |
| allowToAddInventory  | boolean | Indicates whether returned items can be added back to inventory (true or false).                 | No        |
| location             | String  | Specifies the location where the return is processed.                                            | No        |
| workspace            | String  | Workspace associated with the return process.                                                    | No        |
| traceability         | String  | Specifies the level of tracking (e.g., Sku level).(Note - item level is not supported).          | No        |
| returnIdentification | String  | Indicates how the return has been identified.                                                    | No        |
| items                | Object  | A list of returned order items, each containing details about the product and its return status. | Yes       |

Items (Inside items array) - Each item represents a returned item with details.

| Field               | Type              | Description                                                                       | Mandatory |
| ------------------- | ----------------- | --------------------------------------------------------------------------------- | --------- |
| itemName            | String            | Name of the returned product.                                                     | No        |
| orderItemID         | String            | Unique identifier for the order item.                                             | No        |
| sku                 | String            | SKU (Stock Keeping Unit) of the product.                                          | Yes       |
| esin                | String            | ESIN (Electronic Standard Identification Number) of the product.                  | No        |
| ean                 | String            | EAN (European Article Number) of the physical product.                            | No        |
| returnItemCondition | String            | Condition of the returned item (e.g., Sellable, Non sellable).                    | Yes       |
| qcRejectionReasons  | Array             | List of reasons why the item was rejected during quality control.                 | No        |
| shelf               | String            | The shelf/storage location where the returned item is placed.                     | No        |
| returnStatus        | String            | Status of the returned item (e.g., damaged, restocked, quarantined).              | Yes       |
| otherItemInfo       | Object (Optional) | Additional details when a different item is received instead of the expected one. | No        |
| componentDetails    | Object (Optional) | List of physical items/components associated with this virtual product.           | No        |

Other Item Info (Inside otherItemInfo object) - Only req when other item is received

| Field                     | Type    | Description                                                                            | Mandatory(if other item is present) |
| ------------------------- | ------- | -------------------------------------------------------------------------------------- | ----------------------------------- |
| otherItemBrand            | String  | Brand of the incorrectly received item.                                                | Yes                                 |
| otherItemSku              | String  | SKU of the incorrectly received item.                                                  | Yes                                 |
| isProductTagMissing       | boolean | Indicates whether the product tag is missing (true or false).                          | Yes                                 |
| otherItemCondition        | String  | Condition of the incorrect item (e.g., Non sellable).                                  | Yes                                 |
| otherItemRejectionReasons | Array   | List of reasons why the incorrect item was rejected.                                   | No                                  |
| otherItemShelf            | String  | Shelf/storage location for the incorrect item (e.g., Default damaged, Not applicable). | No                                  |
| otherItemReturnStatus     | String  | Status of the incorrectly received item (e.g., damaged, quarantined).                  | Yes                                 |
| otherItemEsin             | String  | ESIN of the incorrect item.                                                            | No                                  |
| otherItemVertical         | String  | Product category or vertical (if available).                                           | No                                  |
| otherItemName             | String  | Name of the incorrect item.                                                            | No                                  |
| otherItemEan              | String  | EAN of the incorrect item (if available).                                              | No                                  |

Component Details (Inside componentDetails array) - only req for Virtual Kits products

| Field               | Type              | Description                                                                                                 | Mandatory(if component is present) |
| ------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| itemName            | String            | Name of the physical product.                                                                               | No                                 |
| sku                 | String            | SKU of the physical product.                                                                                | Yes                                |
| esin                | String            | ESIN of the physical product.                                                                               | No                                 |
| ean                 | String            | EAN (European Article Number) of the physical product.                                                      | No                                 |
| brand               | String            | Brand of the product.                                                                                       | No                                 |
| returnItemCondition | String            | Condition of the returned item (e.g., Sellable, Non sellable, Other item received, Item is missing).        | Yes                                |
| returnStatus        | String            | Status of the returned item (e.g., restocked, quarantined, lost).                                           | Yes                                |
| shelf               | String            | The shelf/storage location where the returned item is placed (e.g., Default sellable, Default quarantined). | No                                 |
| qcRejectionReasons  | Array             | List of reasons why an item was rejected during quality control (only applicable for Non sellable items).   | No                                 |
| otherItemInfo       | Object (Optional) | Additional details when a different item is received instead of the expected one.                           | No                                 |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```json
{
    "returnTrackingId": "6547665763",
    "customerOrderNumber": "SSRP-29",
    "allowToAddInventory": false,
    "items": [
        {
            "itemName": "Samsung Galaxy S23 Ultra 5G",
            "sku": "PHONE-01",
            "esin": "012TS3HWE3V",
            "ean": "43567809",
            "brand": "DummyBrand",
            "orderItemID": "SSRP-29-42553991",
            "returnItemCondition": "Sellable",
            "returnStatus": "restocked"
        },
        {
            "itemName": "Samsung Galaxy S23 Ultra 5G",
            "sku": "PHONE-01",
            "esin": "012TS3HWE3V",
            "ean": "43567809",
            "brand": "DummyBrand",
            "orderItemID": "SSRP-29-42553992",
            "returnItemCondition": "Non sellable",
            "qcRejectionReasons": [
                "Product is dirty"
            ],
            "returnStatus": "quarantined"
        }
    ],
    "location": "alternateworkflowmadhapursku",
    "workspace": "alternateworkflow"
}
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```json
{"error":{"errors":[{"domain":"global","reason":"badRequest","message":"Tracking ID is already received"}],"code":400,"message":"Tracking ID is already received"}}
```

{% endtab %}
{% endtabs %}

```json
curl --location --globoff --request PUT 'https://return-dot-eshopbox-client-portal-prod.el.r.appspot.com/_ah/api/esb/v2/return-shipment/{returnTrackingId}' \
--header 'Authorization: Bearer <token>' \
--header 'proxyHost: {accountSlug}' \
--header 'Content-Type: application/json' \
--header 'Cookie: JSESSIONID=w0pXRl-zXKcHn6QwZG-dfg' \
--data '{
    "returnTrackingId": "6547665764",
    "salesChannel": "CH3134",
    "customerOrderNumber": "SSRP-29",
    "allowToAddInventory": false,
    "items": [
        {
            "itemName": "Samsung Galaxy S23 Ultra 5G",
            "sku": "PHONE-01",
            "esin": "012TS3HWE3V",
            "ean": "43567809",
            "brand": "DummyBrand",
            "orderItemID": "SSRP-29-42553991",
            "returnItemCondition": "Sellable",
            "returnStatus": "restocked"
        },
        {
            "itemName": "Samsung Galaxy S23 Ultra 5G",
            "sku": "PHONE-01",
            "esin": "012TS3HWE3V",
            "ean": "43567809",
            "brand": "DummyBrand",
            "orderItemID": "SSRP-29-42553992",
            "returnItemCondition": "Non sellable",
            "qcRejectionReasons": [
                "Product is dirty"
            ],
            "returnStatus": "quarantined"
        }
    ],
    "location": "alternateworkflowmadhapursku",
    "workspace": "alternateworkflow",
    "returnIdentification": "Return Identified"
}'
```
