> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Exchange Return

> This endpoint processes an exchange for a returned item.

### Body

<ParamField body="return_id" type="string">
  The ID provided in the data tab may be used to identify the return
</ParamField>

<ParamField body="exchange_product_id" type="string">
  The product ID of the item to exchange for
</ParamField>

<ParamField body="exchange_variant_id" type="string">
  The variant ID if exchanging for a different variant (size, color, etc.)
</ParamField>

<ParamField body="exchange_reason" type="string">
  The reason for the exchange
</ParamField>

<ParamField body="price_difference" type="number">
  The price difference between original and exchange items (positive if customer owes, negative if refund due)
</ParamField>

<ParamField body="shipping_method" type="string">
  The shipping method for the exchange item
</ParamField>

<ParamField body="expedited" type="boolean">
  Whether to expedite the exchange shipment
</ParamField>

### Response

<ResponseField name="id" type="string">
  The ID provided in the data tab may be used to identify the return
</ResponseField>

<ResponseField name="object" type="string">
  The object type
</ResponseField>

<ResponseField name="exchange_order_id" type="string">
  The new order ID for the exchange
</ResponseField>

<ResponseField name="exchange_status" type="string">
  The status of the exchange (e.g., "pending", "processing", "shipped")
</ResponseField>

<ResponseField name="original_product_id" type="string">
  The original product that was returned
</ResponseField>

<ResponseField name="exchange_product_id" type="string">
  The new product being sent as exchange
</ResponseField>

<ResponseField name="price_difference" type="number">
  The price difference between items
</ResponseField>

<ResponseField name="payment_status" type="string">
  Status of any additional payment or refund
</ResponseField>

<ResponseField name="tracking_number" type="string">
  Tracking number for the exchange shipment
</ResponseField>

<ResponseField name="success" type="number">
  Indicates whether the call was successful. true if successful, false if not.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request POST 'https://api.stateset.com/v1/returns/:id/exchange' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Token <token>' \
  --data-raw '{
      "id": "rt_1NXWPnCo6bFb1KQto6C8OWvE",
      "exchange_product_id": "prod_abc789",
      "exchange_variant_id": "var_size_large",
      "exchange_reason": "Wrong size ordered",
      "price_difference": 0,
      "shipping_method": "standard",
      "expedited": false
  }'
  ```

  ```graphQL GraphQL theme={null}
        mutation returnExchangeMutation {
          returnExchange(
            id: "${returnId}",
            exchangeProductId: "${exchangeProductId}",
            exchangeVariantId: "${exchangeVariantId}",
            exchangeReason: "${exchangeReason}",
            priceDifference: ${priceDifference},
            shippingMethod: "${shippingMethod}",
            expedited: ${expedited}
          ) {
            return {
              id,
              status,
              exchange_order_id,
              exchange_status,
              tracking_number
            }
            userErrors {
              field
              message
            }
          }
        }
      `;
  ```

  ```js Node.js theme={null}
  const returns = await stateset.returns.exchange({
    id: 'rt_1NXWPnCo6bFb1KQto6C8OWvE',
    exchange_product_id: 'prod_abc789',
    exchange_variant_id: 'var_size_large',
    exchange_reason: 'Wrong size ordered',
    price_difference: 0,
    shipping_method: 'standard',
    expedited: false
  });
  ```

  ```python Python theme={null}
  returns = stateset.returns.exchange({
    'id': 'rt_1NXWPnCo6bFb1KQto6C8OWvE',
    'exchange_product_id': 'prod_abc789',
    'exchange_variant_id': 'var_size_large',
    'exchange_reason': 'Wrong size ordered',
    'price_difference': 0,
    'shipping_method': 'standard',
    'expedited': False
  })
  ```

  ```ruby Ruby theme={null}
  returns = Stateset::Return.exchange({
    id: 'rt_1NXWPnCo6bFb1KQto6C8OWvE',
    exchange_product_id: 'prod_abc789',
    exchange_variant_id: 'var_size_large',
    exchange_reason: 'Wrong size ordered',
    price_difference: 0,
    shipping_method: 'standard',
    expedited: false
  })
  ```

  ```go Go theme={null}
  returns, err := stateset.Returns.exchange({
    ID: 'rt_1NXWPnCo6bFb1KQto6C8OWvE',
    ExchangeProductID: 'prod_abc789',
    ExchangeVariantID: 'var_size_large',
    ExchangeReason: 'Wrong size ordered',
    PriceDifference: 0,
    ShippingMethod: 'standard',
    Expedited: false
  })
  ```

  ```java Java theme={null}
  Return returns = stateset.Returns.exchange({
    id: 'rt_1NXWPnCo6bFb1KQto6C8OWvE',
    exchangeProductId: 'prod_abc789',
    exchangeVariantId: 'var_size_large',
    exchangeReason: 'Wrong size ordered',
    priceDifference: 0,
    shippingMethod: 'standard',
    expedited: false
  });
  ```

  ```php PHP theme={null}
  $returns = $stateset->returns->exchange([
    'id' => 'rt_1NXWPnCo6bFb1KQto6C8OWvE',
    'exchange_product_id' => 'prod_abc789',
    'exchange_variant_id' => 'var_size_large',
    'exchange_reason' => 'Wrong size ordered',
    'price_difference' => 0,
    'shipping_method' => 'standard',
    'expedited' => false
  ]);
  ```

  ```csharp C# theme={null}
  var returns = await stateset.Returns.Exchange(new {
    Id = 'rt_1NXWPnCo6bFb1KQto6C8OWvE',
    ExchangeProductId = 'prod_abc789',
    ExchangeVariantId = 'var_size_large',
    ExchangeReason = 'Wrong size ordered',
    PriceDifference = 0,
    ShippingMethod = 'standard',
    Expedited = false
  });
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "rt_1NXWPnCo6bFb1KQto6C8OWvE",
    "object": "return",
    "exchanged": true,
    "exchange_order_id": "ord_exch_789xyz",
    "exchange_status": "processing",
    "original_product_id": "prod_xyz123",
    "exchange_product_id": "prod_abc789",
    "exchange_variant_id": "var_size_large",
    "price_difference": 0,
    "payment_status": "no_payment_required",
    "tracking_number": "1Z999AA10123456785",
    "estimated_delivery": "2024-01-18"
  }
  ```
</ResponseExample>
