Skip to main content
The Split class provides methods for creating and managing transaction splits on your integration. Splits allow you to automatically distribute payments across multiple subaccounts.

Overview

The Split class allows you to:
  • Create transaction splits with multiple subaccounts
  • List and retrieve split configurations
  • Update split settings
  • Add or remove subaccounts from splits

Methods

create

Creates a split on your integration.
async create(input: SplitCreateInput): Promise<SplitCreateResponse>
name
string
required
Name of the split
type
'flat' | 'percentage'
required
Type of split (flat amount or percentage)
currency
'NGN' | 'USD' | 'GHS' | 'ZAR' | 'KES' | 'XOF'
required
Currency for the split (defaults to NGN)
subaccounts
array
required
Array of subaccount objects
  • subaccount (string): Subaccount code starting with ACCT_
  • share (number): Share amount or percentage
bearer_type
'subaccount' | 'account' | 'all-proportional' | 'all'
required
Who bears transaction charges
bearer_subaccount
string
required
Subaccount code of the bearer (when bearer_type is “subaccount”)
data
object
id
number
The split ID
name
string
The split name
split_code
string
The unique split code
type
string
The split type (flat or percentage)
currency
string
The currency
active
boolean
Whether the split is active
bearer_type
string
The bearer type
subaccounts
array
Array of subaccount configurations with their shares
Example:
const { data, error } = await paystack.split.create({
  name: "50/50 Split",
  type: "percentage",
  currency: "NGN",
  subaccounts: [
    { subaccount: "ACCT_abc123", share: 50 },
    { subaccount: "ACCT_def456", share: 50 }
  ],
  bearer_type: "all-proportional",
  bearer_subaccount: "ACCT_abc123"
});

if (data) {
  console.log(data.data.split_code);
}

list

Lists transaction splits available on your integration.
async list(input: SplitListInput): Promise<SplitListResponse>
name
string
required
Filter by split name
active
boolean
required
Filter by active status
sort_by
string
Field to sort by
perPage
number
Number of records per page (1-100, defaults to 50)
page
number
Page number (defaults to 1)
from
string
ISO datetime to filter from
to
string
ISO datetime to filter to
data
array
Array of split objects
id
number
The split ID
name
string
The split name
split_code
string
The unique split code
type
string
The split type
active
boolean
Whether the split is active
total_subaccounts
number
Total number of subaccounts in the split
meta
object
Pagination metadata including total, page, perPage, and pageCount
Example:
const { data, error } = await paystack.split.list({
  name: "Commission",
  active: true,
  perPage: 20,
  page: 1
});

if (data) {
  console.log(`Found ${data.meta.total} splits`);
}

getSplitById

Gets details of a split on your integration.
async getSplitById(id: string): Promise<SplitSingleResponse>
id
string
required
The ID of the split
data
object
id
number
The split ID
name
string
The split name
split_code
string
The unique split code
type
string
The split type
currency
string
The currency
active
boolean
Whether the split is active
bearer_type
string
The bearer type
subaccounts
array
Array of subaccount configurations with details
total_subaccounts
number
Total number of subaccounts
Example:
const { data, error } = await paystack.split.getSplitById("123");

if (data) {
  console.log(data.data.name);
}

update

Updates a split details on your integration.
async update(input: SplitUpdateInput): Promise<SplitSingleResponse>
id
string
required
The ID of the split to update
name
string
required
The new name for the split
active
boolean
required
Whether the split should be active
bearer_type
'subaccount' | 'account' | 'all-proportional' | 'all'
The new bearer type
bearer_subaccount
string
The new bearer subaccount code
Example:
const { data, error } = await paystack.split.update({
  id: "123",
  name: "Updated Split Name",
  active: true,
  bearer_type: "account"
});

if (data) {
  console.log(data.message);
}

addOrUpdateSubaccount

Adds a subaccount to a split or updates an existing subaccount’s share.
async addOrUpdateSubaccount(input: SplitSubaccountInput): Promise<SplitSubaccountUpdateResponse>
id
string
required
The ID of the split
subaccount
string
required
The subaccount code (starting with ACCT_)
share
number
required
The share amount or percentage for the subaccount
data
object
Updated split object with the new subaccount configuration
Example:
const { data, error } = await paystack.split.addOrUpdateSubaccount({
  id: "123",
  subaccount: "ACCT_xyz789",
  share: 25
});

if (data) {
  console.log(`Split now has ${data.data.total_subaccounts} subaccounts`);
}

removeSubaccount

Removes a subaccount from a split.
async removeSubaccount(input: SplitSubaccountRemoveInput): Promise<GenericResponse>
id
string
required
The ID of the split
subaccount
string
required
The subaccount code to remove
Example:
const { data, error } = await paystack.split.removeSubaccount({
  id: "123",
  subaccount: "ACCT_xyz789"
});

if (data) {
  console.log(data.message);
}