# Creating a satisfaction refund

There are two ways to create a refund. A Customer Service Representative (CRS) can [initiate a satisfaction refund](https://help.digitalriver.com/help/gc/Customer-Service/Initiating-a-refund.htm#HowToInitiateARefund) through Global Commerce, or you can [create a satisfaction refund programmatically](/commerce-api/admin-apis/refunds/creating-a-satisfaction-refund.md#creating-a-satisfaction-refund-programmatically).

## Create a satisfaction refund programmatically

The following [`POST /orders/{orderId}/refunds`](https://docs.digitalriver.com/commerce-api-references/admin-apis/order-management/refunds#orders-orderid-refunds-1) request requires the customer token and sets the `type` to `productRefund`, the `category` to `PRODUCT_LEVEL_PRODUCT`, the reason to `CUSTOMER_SATISFACTION_ISSUE`, the comments to `Test Product Refund`, and `refundAmount`.

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

```javascript
curl --location --request POST 'https://api.digitalriver.com/orders/{orderid}/refunds' \
--header 'authorization: bearer {auth_token}' \
...
--data-raw '{
    "type": "productRefund",
    "category": "PRODUCT_LEVEL_PRODUCT",
    "reason": "CUSTOMER_SATISFACTION_ISSUE",
    "comments": "Test Product Refund",
    "lineItems": [
        {
            "lineItemId": "51274910082",
            "refundAmount": {
                "value": 139.23,
                "currency": "EUR"
            }
        }
    ]
}

}'
```

{% endtab %}

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

```json
{
    "refunds": [
        {
            "id": "7613660289",
            "status": "ReturnAcknowledged",
            "reason": "CUSTOMER_SATISFACTION_ISSUE",
            "comments": "Satisfaction Refund Api-Test Product Refund",
            "type": "LineItemLevelSatisfactionRefund",
            "category": null,
            "generationDate": "Wed Sep 29 20:10:51 CDT 2021",
            "generatedBy": "automation-HostAdmin",
            "origin": "CUSTOMER_SERVICE",
            "overrides": "OVERRIDE_EXCEEDS_MAX_ITEM_LEVEL_REFUND_PCT",
            "policy": "NothingRequired",
            "currency": "EUR",
            "totalRefunded": {
                "value": 0.0,
                "formattedValue": "0.00EUR"
            },
            "outstanding": {
                "value": 139.23,
                "formattedValue": "139.23EUR"
            },
            "totalRequested": {
                "value": 139.23,
                "formattedValue": "139.23EUR"
            },
            "lineItems": [
                {
                    "status": "ReturnAcknowledged",
                    "expectedQuantity": 0,
                    "returnedQuantity": 0,
                    "type": "Physical",
                    "notes": "Nothing Required",
                    "date": "Wed Sep 29 20:10:51 CDT 2021",
                    "product": {
                        "companyId": "fitbit",
                        "id": "5423986700",
                        "externalId": "507BKBK"
                    },
                    "lineItemId": "51274910082"
                }
            ]
        }
    ]
}
```

{% endtab %}
{% endtabs %}

## Create a product-level refund request

The following [`POST /orders/{orderId}/refunds`](https://docs.digitalriver.com/commerce-api-references/admin-apis/order-management/refunds#orders-orderid-refunds-1) request requires the customer token and sets the `type` to `productRefund`, the `category` to `PRODUCT_LEVEL_PRODUCT`, the reason to `VENDOR_APPROVED_REFUND`, the comments to `Test Product Refund`, and `refundAmount`.

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

```javascript
curl --location --globoff 'api.digitalriver.com/order-api/orders/{orderID}}/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <<full access token>>' \
--data '{
    "type": "productRefund",
    "category": "PRODUCT_LEVEL_PRODUCT",
    "reason": "VENDOR_APPROVED_REFUND",
    "comments": "Test Product Refund",
    "lineItems": [
        {
            "lineItemId": "123",
            "refundAmount": {
                "value": 2,
                "currency": "USD"
            }
        }
    ]
}'
```

{% endtab %}

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

```json
{
  "refunds": [
    {
      "id": "string",
      "status": "string",
      "reason": "string",
      "comments": "string",
      "type": "string",
      "category": "string",
      "generationDate": "string",
      "generatedBy": "string",
      "origin": "string",
      "policy": "string",
      "currency": "string",
      "totalRefunded": {},
      "outstanding": {},
      "totalRequested": {},
      "lineItems": [
        {
          "status": "string",
          "expectedQuantity": 0,
          "returnedQuantity": 0,
          "type": "string",
          "notes": "string",
          "date": "string",
          "product": {
            "companyId": "string",
            "id": "string",
            "externalId": "string"
          },
          "lineItemId": "string"
        }
      ]
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Create an order-level refund

The following [`POST /orders/{orderId}/refunds`](https://docs.digitalriver.com/commerce-api-references/admin-apis/order-management/refunds#orders-orderid-refunds-1) request requires the customer token and sets the `type` to `orderRefund`, the `category` to `ORDER_LEVEL_FULL`, the reason to `VENDOR_APPROVED_REFUND`, the comments to `Test Product Refund`, and `refundAmount`.

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

```javascript
curl --location --globoff 'api.digitalriver.com/order-api/orders/{orderID}}/refunds' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <<full access token>>' \
--data '{
    "type": "productRefund",
    "category": "PRODUCT_LEVEL_PRODUCT",
    "reason": "VENDOR_APPROVED_REFUND",
    "comments": "Test Product Refund",
    "lineItems": [
        {
            "lineItemId": "123",
            "refundAmount": {
                "value": 2,
                "currency": "USD"
            }
        }
    ]
}'
```

{% endtab %}

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

```json
{
  "refunds": [
    {
      "id": "string",
      "status": "string",
      "reason": "string",
      "comments": "string",
      "type": "string",
      "category": "string",
      "generationDate": "string",
      "generatedBy": "string",
      "origin": "string",
      "policy": "string",
      "currency": "string",
      "totalRefunded": {},
      "outstanding": {},
      "totalRequested": {}
    }
  ]
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalriver.com/commerce-api/admin-apis/refunds/creating-a-satisfaction-refund.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
