# Managing returns

## Retrieve all returns for a specified order

Use the [`GET /v1/shoppers/me/orders/(orderId)/returns`](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/orders/returns#v1-shoppers-me-orders-orderid-returns) request to retrieve all returns for a specified order where 999999999 is the `orderId`.

{% hint style="info" %}
**Requirement**: Create an OAuth token before invoking the Returns API.
{% endhint %}

{% tabs %}
{% tab title="cURL" %}

```http
curl --location --request GET 'https://api.digitalriver.com/v1/shoppers/me/orders/{orderId}/returns' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <<full access token>>'
...
```

{% endtab %}

{% tab title="200 OK response" %}
A successful request returns a `200 OK` response code:

```json
{
  "returns": [
    {
      "return": [
        {
          "id": 6654727889,
          "reason": "DUPLICATE_ORDER",
          "comments": "Shopper initiated self service return-",
          "type": "LineItemLevelReturnProduct",
          "status": "RefundedWithoutReturn",
          "generationDate": "2020-01-30T17:37:09.000Z",
          "generatedBy": "56066c6b-139b-47ff-9b07-1c799c10ea75",
          "origin": "SHOPPER",
          "policy": "LOD",
          "dateRefunded": "In Process",
          "refundTotal": {
            "currency": "USD",
            "value": 0
          },
          "formattedRefundTotal": "0.00USD",
          "outstandingTotal": {
            "currency": "USD",
            "value": 107.53
          },
          "formattedOutstandingTotal": "107.53USD",
          "requestedTotal": {
            "currency": "USD",
            "value": 107.53
          },
          "formattedRequestedTotal": "107.53USD",
          "returnLineItems": {
            "returnLineItem": [
              {
                "dueDate": "2020-02-07T05:59:59.000Z",
                "expectedQty": 1,
                "returnedQty": 1,
                "type": 100409,
                "notes": "LOD_REFUNDED-2020-02-07T05:59:59.000Z",
                "date": "2020-01-30T17:37:09.000Z",
                "status": "RefundedWithoutReturn",
                "returnLITotal": {
                  "currency": "USD",
                  "value": 107.53
                },
                "formattedReturnLITotal": "107.53USD",
                "lineItem": {
                  "uri": "https://api.digitalriver.com/v1/shoppers/me/orders/793374880082/line-items/793451150082"
                }
              }
            ]
          }
        }
      ]
    }
  ]
}
```

{% endtab %}
{% endtabs %}

See the [query parameters](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/orders/returns#v1-shoppers-me-orders-orderid-returns) for more information.

## Request the return of one or more line items in an order

Use [`POST /v1/shoppers/me/orders/{orderId}/returns`](https://www.digitalriver.com/docs/commerce-shopper-api/#tag/Returns/paths/~1v1~1shoppers~1me~1orders~1%7BorderId%7D~1returns/post) request to request a return for a specified order (`orderId`).

{% tabs %}
{% tab title="cURL" %}

```http
curl --location --request POST 'https://api.digitalriver.com/v1/shoppers/me/orders/{orderid}/returns' \
--header 'authorization: Basic ***\
...
--data-raw '{
  "return": {
    "reason": "DUPLICATE_ORDER",
    "comments": "Duplicate Order",
    "acceptELOD": "true",
    "returnLineItems": {
      "returnLineItem": [
        {
          "lineItemQuantityIDs": [
            1
          ],
          "lineItem": {
            "id": "123",
            "quantity": 1
          }
        }
      ]
    }
  }
}'  
```

{% endtab %}

{% tab title="200 OK response" %}
A successful request returns a 200 response code:

```json
{
  "returns": [
    {
      "return": [
        {
          "id": 6654727889,
          "reason": "DUPLICATE_ORDER",
          "comments": "Shopper initiated self service return-",
          "type": "LineItemLevelReturnProduct",
          "status": "RefundedWithoutReturn",
          "generationDate": "2020-01-30T17:37:09.000Z",
          "generatedBy": "56066c6b-139b-47ff-9b07-1c799c10ea75",
          "origin": "SHOPPER",
          "policy": "LOD",
          "dateRefunded": "In Process",
          "refundTotal": {
            "currency": "USD",
            "value": 0
          },
          "formattedRefundTotal": "0.00USD",
          "outstandingTotal": {
            "currency": "USD",
            "value": 107.53
          },
          "formattedOutstandingTotal": "107.53USD",
          "requestedTotal": {
            "currency": "USD",
            "value": 107.53
          },
          "formattedRequestedTotal": "107.53USD",
          "returnLineItems": {
            "returnLineItem": [
              {
                "dueDate": "2020-02-07T05:59:59.000Z",
                "expectedQty": 1,
                "returnedQty": 1,
                "type": 100409,
                "notes": "LOD_REFUNDED-2020-02-07T05:59:59.000Z",
                "date": "2020-01-30T17:37:09.000Z",
                "status": "RefundedWithoutReturn",
                "returnLITotal": {
                  "currency": "USD",
                  "value": 107.53
                },
                "formattedReturnLITotal": "107.53USD",
                "lineItem": {
                  "uri": "https://api.digitalriver.com/v1/shoppers/me/orders/793374880082/line-items/793451150082"
                }
              }
            ]
          }
        }
      ]
    }
  ]
}
```

{% endtab %}
{% endtabs %}

See [query parameters](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/orders/returns#v1-shoppers-me-orders-orderid-returns) and [formattedReturnedLITotal ](#formattedreturnlitotal)for more information.

### `formattedReturnLITotal`

The value for `formattedReturnLITotal` in the response body is based on the locale and currency. For example, if the locale is `en_US` the currency is `USD`.

```javascript
    formattedReturnLITotal": "105.00USD",
```
