> For the complete documentation index, see [llms.txt](https://docs.biti.so/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.biti.so/refunds.md).

# refunds

Refund paid orders. A refund costs nothing.

| Endpoint                                                       | Purpose         |
| -------------------------------------------------------------- | --------------- |
| [`POST /partner/v1/refund-order`](#post-partnerv1refund-order) | Refund an order |

## POST /partner/v1/refund-order

**Refund an order**

{% hint style="info" %}
Auth: send `client_id` and `client_secret` in the request body. Call it from your server only.
{% endhint %}

Refund a paid order of your app, in full or in part. The money goes from your Payout Wallet back to the wallet that paid. The customer sees it in History as money received with your app name.

`status` is `partially_refunded` or `refunded`. A repeat of a full refund, or of a partial refund with the same `reference`, changes nothing. A refund costs nothing: a refund of 10.00 adds 10.00 to the payer wallet.

**Errors:**

* Invalid client credentials
* The order is not paid, or is not an order of your app
* Total refunds would be more than the paid amount
* `refs` sent together with `amount`
* After a release, the refund is more than the order amount minus released splits and earlier refunds

### Parameters

| Name            | Type            | Required | Description                                                            |
| --------------- | --------------- | -------- | ---------------------------------------------------------------------- |
| `client_id`     | string          | yes      | Your client ID.                                                        |
| `client_secret` | string          | yes      | Your client secret. Server only.                                       |
| `order_id`      | string          | yes      | The paid order.                                                        |
| `amount`        | number          | no       | Amount to refund. Without it, Biti refunds the rest of the order.      |
| `refs`          | array of string | no       | JSON list of held split refs to reverse. Do not send it with `amount`. |
| `reason`        | string          | no       | Reason for the refund.                                                 |
| `reference`     | string          | no       | Your unique id for the refund. Send it with every partial refund.      |

### Request

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

```bash
curl -X POST "https://api.biti.so/partner/v1/refund-order" \
  -H "Content-Type: application/json" \
  -d '{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "order_id": "MPO-00041",
  "amount": 10,
  "reason": "Item missing",
  "reference": "RF-1042-1"
}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.biti.so/partner/v1/refund-order"
headers = {
    "Content-Type": "application/json",
}
payload = {
    "client_id": "YOUR_CLIENT_ID",
    "client_secret": "YOUR_CLIENT_SECRET",
    "order_id": "MPO-00041",
    "amount": 10,
    "reason": "Item missing",
    "reference": "RF-1042-1",
}

response = requests.post(url, headers=headers, json=payload)
print(response.json())
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const response = await fetch("https://api.biti.so/partner/v1/refund-order", {
  method: "POST",
  headers: {
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "client_id": "YOUR_CLIENT_ID",
    "client_secret": "YOUR_CLIENT_SECRET",
    "order_id": "MPO-00041",
    "amount": 10,
    "reason": "Item missing",
    "reference": "RF-1042-1"
  }),
});
console.log(await response.json());
```

{% endtab %}
{% endtabs %}

### Response

```json
{
  "success": true,
  "message": "",
  "data": {
    "order_id": "MPO-00041",
    "status": "partially_refunded",
    "refunded_amount": 10,
    "refund_transaction_id": "RT..."
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.biti.so/refunds.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
