Skip to content

Splits ​

Split operations.

Use it as client.splits. Every method takes keyword arguments, returns a PaystackSdk::Response, and raises a PaystackSdk::Error if a parameter is invalid before anything is sent. An unsuccessful result from Paystack (a 400 or 404) comes back as a Response with success? false.

Methods ​

list ​

ruby
splits.list(
  subaccount_code: nil,
  name: nil,
  active: nil,
  per_page: nil,
  page: nil,
  from: nil,
  to: nil
)

List Splits.

List the transaction splits available on your integration

ParameterTypeRequiredDescription
subaccount_codeStringFilter by subaccount code
nameStringThe name of the split
activeBooleanThe status of the split
per_pageIntegerThe number of records to fetch per request
pageIntegerThe offset to retrieve data from
fromStringThe start date
toStringThe end date

Paystack docs: https://paystack.com/docs/api/split/#list

create ​

ruby
splits.create(name:, type:, subaccounts:, currency:, bearer_type: nil, bearer_subaccount: nil)

Create Split.

Create a split configuration for transactions

ParameterTypeRequiredDescription
nameStringyesName of the transaction split
typeStringyesThe type of transaction split you want to create. One of: percentage, flat.
subaccountsArrayyesA list of object containing subaccount code and number of shares
currencyStringyesThe transaction currency One of: NGN, GHS, ZAR, USD.
bearer_typeStringThis allows you specify how the transaction charge should be processed One of: subaccount, account, all-proportional, all.
bearer_subaccountStringThis is the subaccount code of the customer or partner that would bear the transaction charge if you specified subaccount as the bearer type

Paystack docs: https://paystack.com/docs/api/split/#create

fetch ​

ruby
splits.fetch(id:)

Fetch Split.

Get details of a split configuration for a transaction

ParameterTypeRequiredDescription
idStringyesThe ID of the split configuration to fetch

Paystack docs: https://paystack.com/docs/api/split/#fetch

update ​

ruby
splits.update(id:, name: nil, active: nil, bearer_type: nil, bearer_subaccount: nil)

Update Split.

Update a split configuration for transactions

ParameterTypeRequiredDescription
idStringyes
nameStringName of the transaction split
activeBooleanToggle status of split.
bearer_typeStringThis allows you specify how the transaction charge should be processed One of: subaccount, account, all-proportional, all.
bearer_subaccountStringThis is the subaccount code of the customer or partner that would bear the transaction charge if you specified subaccount as the bearer type

Paystack docs: https://paystack.com/docs/api/split/#update

add_subaccount ​

ruby
splits.add_subaccount(id:, subaccount:, share:)

Add Subaccount to Split.

Add a subaccount to a split configuration, or update the share of an existing subaccount

ParameterTypeRequiredDescription
idIntegeryesThe ID of the split configuration to fetch
subaccountStringyesSubaccount code of the customer or partner
shareIntegeryesThe percentage or flat quota of the customer or partner

Paystack docs: https://paystack.com/docs/api/split/#add-subaccount

remove_subaccount ​

ruby
splits.remove_subaccount(id:, subaccount:, share: nil)

Remove Subaccount from split.

Remove a subaccount from a split configuration

ParameterTypeRequiredDescription
idIntegeryesThe ID of the split configuration to fetch
subaccountStringyesSubaccount code of the customer or partner
shareIntegerNot used when removing a subaccount; the docs do not list it, and Paystack removes the subaccount whatever share is sent.

Paystack docs: https://paystack.com/docs/api/split/#remove-subaccount

Unofficial community SDK. Not affiliated with or endorsed by Paystack. · MIT License · rubygems.org/gems/paystack_sdk