> For the complete documentation index, see [llms.txt](https://docs.hyperswitch.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyperswitch.io/other-features/connectors/split-payments/xendit-split-payments.md).

# Xendit Split Settlement

Split and route payments across multiple accounts or sub-merchants using Xendit's split settlement feature via Hyperswitch.

### Before you start

Set up a Xendit account and enable split settlement on the Xendit platform. Also enable split settlement on the relevant Hyperswitch business profile with the `split_txns_enabled` flag (see [Processors with Split Settlement](https://docs.hyperswitch.io/other-features/connectors/split-payments.md)), then configure a Xendit connector account in the [Hyperswitch control center](https://app.hyperswitch.io/). See the [Xendit documentation](https://docs.xendit.co/docs) for setup instructions.

### Overview

If your platform charges a fee or commission when facilitating payments for your partners, or if you need to split settlement between multiple parties, Juspay Hyperswitch enables you to do so automatically. Xendit via Hyperswitch offers multiple routing methods to support diverse use cases:

* Partner to Platform
* Partner to Partner
* Platform to Partner
* Accepting Payments for Sub-Accounts

### Split Xendit payments via Hyperswitch

Split settlements between multiple sub-merchants, partners, or platforms by including the Xendit split rules in the [payment creation API request](https://api-reference.hyperswitch.io/v1/payments/payments--create).

#### Example: Flat amount Split

```json
{  
  "amount": 10000,  
  "currency": "IDR",  
  "confirm": true,  
  "split_payments": {  
    "xendit_split_payment": {  
      "multiple_splits": {  
        "name": "Marketplace Split",  
        "description": "Platform fee and merchant payment",  
        "routes": [  
          {  
            "flat_amount": 1000,  
            "currency": "IDR",  
            "destination_account_id": "platform_account_123",  
            "reference_id": "platform_fee"  
          },  
          {  
            "flat_amount": 9000,  
            "currency": "IDR",   
            "destination_account_id": "merchant_account_456",  
            "reference_id": "merchant_payment"  
          }  
        ]  
      }  
    }  
  }  
}
```

#### Example: Percentage-Based Split

```json
{  
  "amount": 10000,  
  "currency": "IDR",  
  "confirm": true,  
  "split_payments": {  
    "xendit_split_payment": {  
      "multiple_splits": {  
        "name": "Percentage Split",  
        "description": "Commission-based split",  
        "routes": [  
          {  
            "percent_amount": 10,  
            "currency": "IDR",  
            "destination_account_id": "platform_account_123",  
            "reference_id": "commission"  
          },  
          {  
            "percent_amount": 90,  
            "currency": "IDR",  
            "destination_account_id": "merchant_account_456",   
            "reference_id": "merchant_share"  
          }  
        ]  
      }  
    }  
  }  
}
```

#### Constraints & Validation Logic

Constraints:

* Each route must specify either `flat_amount` OR `percent_amount`, never both
* For zero-amount payments, all split amounts must be zero
* Sum of split amounts cannot exceed total payment amount

The validation ensures that:

1. **Missing both fields**: Returns error `Expected either split_payments.xendit_split_payment.routes.flat_amount or split_payments.xendit_split_payment.routes.percent_amount to be provided`
2. **Having both fields**: Returns error `Expected either split_payments.xendit_split_payment.routes.flat_amount or split_payments.xendit_split_payment.routes.percent_amount, but not both`

#### XenditSplitRequest Structure

The main `XenditSplitRequest` enum supports two types:

1. **MultipleSplits** - For splitting across multiple accounts
2. **SingleSplit** - For routing to a single sub-merchant

#### MultipleSplits Parameters

For the `XenditMultipleSplitRequest` structure:

**`name`** (string, **required**)

* Name to identify the split rule
* Not required to be unique
* Typically based on transaction and/or sub-merchant types

**`description`** (string, **required**)

* Description to identify the fee rule
* Used for internal tracking and identification

**`for_user_id`** (string, optional)

* The sub-account user-id that you want to make this transaction for
* Used when making payments on behalf of a sub-merchant

**`routes`** (array, **required**)

* Array of `XenditSplitRoute` objects that define how the platform wants to route the fees and to which accounts
* Each route object represents a single payment split from the end user to a destination account

#### XenditSplitRoute Parameters

Each route in the `routes` array has these parameters:

**`flat_amount`** (MinorUnit, optional)

* Amount of payments to be split using a flat rate
* Specified in Hyperswitch minor units, which follow Hyperswitch's currency exponent rather than Xendit's: 3000 is 30.00 USD. Hyperswitch treats IDR as a two-decimal currency as well, so 3000 is also 30.00 IDR. Hyperswitch converts the value to major units before sending it to Xendit, and the conversion is exact: 3000 becomes 30.00, nothing is rounded
* **Validation**: Must specify either `flat_amount` OR `percent_amount`, never both

**`percent_amount`** (i64, optional)

* Amount of payments to be split using a percentage rate
* Integer percentage value (e.g., 5 = 5%)
* Xendit performs the split. Hyperswitch does not compute route amounts for the request; it only checks that the routes fit inside the payment
* For that check, a percent route is valued as `percent_amount * total_amount / 100` in minor units with integer division, so any fraction of a minor unit is dropped: a 33% route on a payment of 1,001 minor units counts as 330
* The valued percent routes and the flat routes are added together, and the request is rejected if the sum exceeds the payment amount

**`currency`** (Currency enum, **required**)

* Currency code for the split amount
* Must match supported currency values

**`destination_account_id`** (string, **required**)

* ID of the destination account where the amount will be routed
* Can be the ID of your platform account or sub-merchant account

**`reference_id`** (string, **required**)

* Reference ID that acts as an identifier for the route itself
* Used to distinguish routes when one split rule has multiple routes to the same destination
* Must be unique and case-sensitive for every route object under the same split rule

#### SingleSplit Parameters

For single split settlements, the structure is simpler:

**`for_user_id`** (string, **required**)

* The sub-account user-id that you want to make this transaction for
* Required field for single split scenarios

#### Split Settlement Response Types

**Multiple Splits Response**

For multiple splits, the `charges` field contains detailed split rule information:

```json
{
  "charges": {
    "xendit_split_payment": {
      "multiple_splits": {
        "split_rule_id": "sr_12345",
        "for_user_id": "user_123",
        "name": "Split Rule Name",
        "description": "Split description",
        "routes": [...]
      }
    }
  }
}
```

Key fields:

* `split_rule_id`: Generated during preprocessing step
* `for_user_id`: Optional sub-merchant identifier
* `routes`: Array of split route details with amounts and destinations

**Single Split Response**

For single splits, the structure is simpler:

```json
{
  "charges": {
    "xendit_split_payment": {
      "single_split": {
        "for_user_id": "user_123"
      }
    }
  }
}
```

#### Response Processing Flow

The response passes through three stages:

1. **Raw Xendit Response**: Received from Xendit's API
2. **Response Transformation**: Converted by the connector transformer
3. **Charge Data Storage**: Split information preserved for subsequent operations

#### Things to know

**Field Usage Distinction**: `split_payments` is used in requests while `charges` is used in responses. This is a common source of confusion.

**Preprocessing Context**: For multiple splits, the response includes data from the preprocessing step where split rules are created.

**Refund Integration**: The response data is used for refunds, particularly the `for_user_id` field requirement.

### Refunds for Xendit Split Payments

If you have made a split payment using `for_user_id`, whether for multiple split payments or a single split payment, you will need to include the associated `for_user_id` in the refund request.

```json
{
  "split_refunds": {
    "xendit_split_refund": {
      "for_user_id": "*****************"
    }
  }
}
```


---

# 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.hyperswitch.io/other-features/connectors/split-payments/xendit-split-payments.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.
