Welcome to Xendit’s latest documentation. For legacy content, access the previous documentation here or the previous API reference here.

Create Split Rule

Prev Next
Post
/split_rules

A Split Rule object defines how payments in xenPlatform can be routed and split to multiple sub-accounts or the Master account.

Include the split_rule_id returned in the response in supported transaction endpoints to automatically route and split payments to multiple account destinations once payments settle.

Security
HTTP
Type basic
Body parameters
{
  "name": "Platform and Delivery Fees",
  "description": "Platform fee and delivery fee for a Marketplace",
  "routes": [
    {
      "flat_amount": 3000,
      "currency": "IDR",
      "destination_account_id": "5f8d0c0603ffe06b7d4d9fcf",
      "reference_id": "reference-1"
    },
    {
      "percent_amount": 5.25,
      "currency": "IDR",
      "destination_account_id": "5f8d0c0603ffe06b7d4d9fcf",
      "reference_id": "reference-2"
    }
  ]
}
Expand All
object
name
string Required

Name to identify a split rule. Typically based on transaction and/or sub-merchant types and does not have to be unique. e.g. "standard platform fee and delivery fee", "commission"

description
string

Describes the purpose of the object

routes
Array of object (xenPlatform_route) Required
object

Defines a single amount and destination within a split rule

flat_amount
number

Amount of payments to be split, using a flat rate as a unit. This will be null if not applicable, and is required if percent_amount is null. All units must be a positive number

percent_amount
number

Amount of payments to be split, using a percent rate as unit. This will be null if not applicable. This will be required if flat_amount is null All units must be a positive number, with decimals supported up to 2 decimal places. Percent amounts have to be between 0 and 100 Percent amounts are rounded off to the nearest monetary unit (e.g. 0.50 IDR will be rounded to 1 IDR; 0.49 IDR will be rounded to 0 IDR)

currency
string

ISO 4217 Currency Code

Valid values[ "IDR", "PHP", "VND", "MYR", "THB" ]
destination_account_id
string

ID of your Account, use this in the for-user-id header to create transactions on behalf of your Account

reference_id
string

Reference ID which acts as an identifier of the route itself. This is used to distinguish in case one split rule has multiple routes of the same destinations. Its value must be unique and case sensitive for every route object under the same Split Rule. Limit: 255 characters.

Responses
200
{
  "id": "splitru_d9e069f2-4da7-4562-93b7-ded87023d749",
  "name": "Standard platform fee",
  "description": "Platform fee for all transactions accepted on behalf of vendors",
  "routes": [
    {
      "flat_amount": 3000,
      "currency": "IDR",
      "destination_account_id": "5f8d0c0603ffe06b7d4d9fcf",
      "reference_id": "reference-1"
    },
    {
      "percent_amount": 5.25,
      "currency": "IDR",
      "destination_account_id": "5cafeb170a2b18519b1b8768",
      "reference_id": "reference-2"
    }
  ],
  "created": "2020-09-01T07:00:00.007Z",
  "updated": "2020-09-01T07:00:00.007Z",
  "metadata": {}
}
Expand All
object
id
string

The unique Split Rule ID

name
string

Name to identify a split rule. Typically based on transaction and/or sub-merchant types and does not have to be unique. e.g. "standard platform fee and delivery fee", "commission"

description
string

Describes the purpose of the object

routes
Array of object (xenPlatform_route)
object

Defines a single amount and destination within a split rule

flat_amount
number

Amount of payments to be split, using a flat rate as a unit. This will be null if not applicable, and is required if percent_amount is null. All units must be a positive number

percent_amount
number

Amount of payments to be split, using a percent rate as unit. This will be null if not applicable. This will be required if flat_amount is null All units must be a positive number, with decimals supported up to 2 decimal places. Percent amounts have to be between 0 and 100 Percent amounts are rounded off to the nearest monetary unit (e.g. 0.50 IDR will be rounded to 1 IDR; 0.49 IDR will be rounded to 0 IDR)

currency
string

ISO 4217 Currency Code

Valid values[ "IDR", "PHP", "VND", "MYR", "THB" ]
destination_account_id
string

ID of your Account, use this in the for-user-id header to create transactions on behalf of your Account

reference_id
string

Reference ID which acts as an identifier of the route itself. This is used to distinguish in case one split rule has multiple routes of the same destinations. Its value must be unique and case sensitive for every route object under the same Split Rule. Limit: 255 characters.

created
string

Timestamp of when the object was created

updated
string

Timestamp of when the object was updated

metadata
string

Object of additional key-value pairs that the merchants may use like internal system parameters (business ID, shopping cart). User defines the JSON properties and values. You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Otherwise NULL

400

Validation error

API_VALIDATION_ERROR
{
  "error_code": "INVALID_CONFIGURATION",
  "message": "Inputs are failing validation. The errors field contains details about which fields are violating validation.",
  "errors": [
    "Detailed description here"
  ]
}
INVALID_FEE_AMOUNT
{
  "error_code": "INVALID_FEE_AMOUNT",
  "message": "Fee amount and/or unit is negative number or incorrect format.",
  "errors": [
    "Detailed description here"
  ]
}
DUPLICATE_ERROR
{
  "error_code": "DUPLICATE_ERROR",
  "message": "Returned if provided `reference_id` is not unique for the routes",
  "errors": [
    "Detailed description here"
  ]
}
object

Inputs are failing validation. The errors field contains details about which fields are violating validation.

error_code
string
Valid values[ "API_VALIDATION_ERROR", "INVALID_CONFIGURATION", "INVALID_JSON_FORMAT", "TYPE_AND_CONFIGURATION_CONFLICT", "INVALID_SOURCE_OR_DESTINATION_ERROR", "INSUFFICIENT_BALANCE", "INVALID_FEE_AMOUNT", "DUPLICATE_ERROR", "INVALID_AMOUNT", "INSUFFICIENT_ACCOUNT_HOLDER_DATA" ]
message
string
errors
Array
OneOf
string
string
object
object
404

Validation error

DESTINATION_ACCOUNT_NOT_FOUND
{
  "error_code": "DESTINATION_ACCOUNT_NOT_FOUND",
  "message": "Returned when destination_account_id is invalid or not connected to this xenPlatform account",
  "errors": [
    "Detailed description here"
  ]
}
object

The object being referenced does not exist

error_code
string
Valid values[ "DESTINATION_ACCOUNT_NOT_FOUND", "DATA_NOT_FOUND" ]
message
string
errors
Array
OneOf
string
string
object
object