> 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/api-reference/order-splits.md).

# order splits

Share one payment between stores and drivers. Release each split when it is earned.

| Endpoint                                                           | Purpose             |
| ------------------------------------------------------------------ | ------------------- |
| [`POST /partner/v1/release-splits`](#post-partnerv1release-splits) | Release held splits |

## POST /partner/v1/release-splits

**Release held splits**

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

Pay held splits now. Call it for one store when it accepts, and for one driver when the delivery is done. Without `refs`, every held split of the order is released. A repeat call changes nothing and sends no second SMS.

`released` lists the refs that are paid now or were already released. A split that failed at payment time, for example for lack of fee balance, is paid again by this call.

**Errors:**

* Invalid client credentials
* Unknown order

### 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 order that has the splits.                                                  |
| `refs`          | array of string | no       | JSON list of split `ref` values to release. Omit it to release all held splits. |

### Request

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

```bash
curl -X POST "https://api.biti.so/partner/v1/release-splits" \
  -H "Content-Type: application/json" \
  -d '{
  "client_id": "YOUR_CLIENT_ID",
  "client_secret": "YOUR_CLIENT_SECRET",
  "order_id": "MPO-00043",
  "refs": [
    "store-A"
  ]
}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api.biti.so/partner/v1/release-splits"
headers = {
    "Content-Type": "application/json",
}
payload = {
    "client_id": "YOUR_CLIENT_ID",
    "client_secret": "YOUR_CLIENT_SECRET",
    "order_id": "MPO-00043",
    "refs": [
        "store-A",
    ],
}

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/release-splits", {
  method: "POST",
  headers: {
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "client_id": "YOUR_CLIENT_ID",
    "client_secret": "YOUR_CLIENT_SECRET",
    "order_id": "MPO-00043",
    "refs": [
      "store-A"
    ]
  }),
});
console.log(await response.json());
```

{% endtab %}
{% endtabs %}

### Response

```json
{
  "success": true,
  "message": "",
  "data": {
    "order_id": "MPO-00043",
    "released": [
      "store-A"
    ],
    "splits": [
      {
        "ref": "store-A",
        "status": "released",
        "amount": 18,
        "transaction_id": "7TR2...",
        "sms_status": "none"
      },
      {
        "ref": "store-B",
        "status": "held",
        "amount": 15
      }
    ]
  }
}
```


---

# 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/api-reference/order-splits.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.
