> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.feedonomics.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.feedonomics.com/_mcp/server.

# Create a refund

POST https://api.feedamp.feedonomics.com/api/v1/orders/{order-id}/refund

Create a refund in FeedAMP, FeedAMP will communicate the refund to the marketplace.
A single refund can only be applied to one order line. A seller that wishes to refund more than one order line in an order must make multiple refunds in FeedAMP.


Reference: https://docs.feedonomics.com/developer/api-reference/rest/feedamp-order-api-v1/seller-initiated-refunds/post-order-refund

## Authentication

- `token` header (required) — The Authentication token obtained from the get_token route.
- `x-api-key` header (required) — The SSO token obtained from the Feedonomics platform SSO token route.

## Request

### Path parameters

- `order-id` (string, required) — FeedAMP order id

### Headers

- `client` (integer, required) — The id of the client making the request.

## Response

### 201

Sample Response

- `id` (string, required) — FeedAMP unique refund id
- `order_id` (string, required) — FeedAMP unique order id that is being refunded
- `state` (string, required) — FeedAMP Refund State. Newly posted refunds are CREATED.
- `refund_info` (OrdersOrderIdRefundPostResponsesContentApplicationJsonSchemaRefundInfo, required)

## Types

### OrdersOrderIdRefundPostResponsesContentApplicationJsonSchemaRefundInfo

- `cp_refund_number` (string, required) — Unique seller ID for the refund. Must be unique for all posted refunds.
- `mp_line_number` (string, required) — The Marketplace's order line that is being refunded
- `refund_reason` (enum, required) — The reason for the refund. Use of 'other' is not recommended - some marketplaces may not accept it. If set to 'other', it is strongly recommended to enter a description in the 'refund_notes' field.
  - Allowed values: `customer_cancelled`, `customer_return`, `accidental_order`, `wrong_item_received`, `defective_item_received`, `damaged_item_received`, `item_never_received`, `item_received_late`, `wrong_quantity_received`, `could_not_ship`, `abandoned`, `price_error`, `tax_error`, `shipping_cost_error`, `other`
- `currency` (string, required) — The currency in ISO 4217 format.
- `refund_quantity` (integer, optional) — The quantity that is being refunded for the order line.
- `item_refund` (double, optional) — The amount being refunded for the item price.
- `item_tax_refund` (double, optional) — The amount being refunded for the item sales tax.
- `shipping_refund` (double, optional) — The amount being refunded for the shipping cost.
- `shipping_tax_refund` (double, optional) — The amount being refunded for the shipping tax
- `discount_refund` (double, optional) — The discount amount being refunded/undone.
- `refund_notes` (string, optional) — Custom notes on the refund to send to the customer (if supported by the marketplace).If refund_reason is set to 'other', it is recommended to populate this field.

## Examples

**Response**

```json
{
  "id": "123",
  "order_id": "1234",
  "state": "CREATED",
  "refund_info": {
    "cp_refund_number": "REFUND-1234",
    "mp_line_number": "12445244",
    "refund_reason": "customer_return",
    "currency": "USD",
    "refund_quantity": 1,
    "item_refund": 1.01,
    "item_tax_refund": 0.11,
    "shipping_refund": 0,
    "shipping_tax_refund": 0,
    "discount_refund": 0,
    "refund_notes": ""
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.feedamp.feedonomics.com/api/v1/orders/order-id/refund"

headers = {
    "client": "1",
    "token": "<apiKey>"
}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.feedamp.feedonomics.com/api/v1/orders/order-id/refund';
const options = {method: 'POST', headers: {client: '1', token: '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.feedamp.feedonomics.com/api/v1/orders/order-id/refund"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("client", "1")
	req.Header.Add("token", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.feedamp.feedonomics.com/api/v1/orders/order-id/refund")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["client"] = '1'
request["token"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.feedamp.feedonomics.com/api/v1/orders/order-id/refund")
  .header("client", "1")
  .header("token", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.feedamp.feedonomics.com/api/v1/orders/order-id/refund', [
  'headers' => [
    'client' => '1',
    'token' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.feedamp.feedonomics.com/api/v1/orders/order-id/refund");
var request = new RestRequest(Method.POST);
request.AddHeader("client", "1");
request.AddHeader("token", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "client": "1",
  "token": "<apiKey>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.feedamp.feedonomics.com/api/v1/orders/order-id/refund")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```