Skip to content

Subaccounts ​

Subaccount operations.

Use it as client.subaccounts. 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
subaccounts.list(per_page: nil, page: nil, active: nil)

List Subaccounts.

List subaccounts available on your integration

ParameterTypeRequiredDescription
per_pageIntegerNumber of records to fetch per request
pageIntegerThe offset to retrieve data from
activeIntegerFilter by the state of the subaccounts

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

create ​

ruby
subaccounts.create(
  business_name:,
  bank_code:,
  account_number:,
  percentage_charge:,
  description: nil,
  primary_contact_email: nil,
  primary_contact_name: nil,
  primary_contact_phone: nil,
  metadata: nil
)

Create Subaccount.

Create a subacount for a partner

ParameterTypeRequiredDescription
business_nameStringyesName of business for subaccount
bank_codeStringyesBank code for the bank, from the List Banks endpoint.
account_numberStringyesBank account number
percentage_chargeNumericyesThe percentage the main account receives from each payment made to the subaccount.
descriptionStringA description for this subaccount
primary_contact_emailStringA contact email for the subaccount
primary_contact_nameStringThe name of the contact person for this subaccount
primary_contact_phoneStringA phone number to call for this subaccount
metadataStringStringified JSON object of custom data

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

fetch ​

ruby
subaccounts.fetch(id_or_code:)

Fetch Subaccount.

Get details of a subaccount on your integration

ParameterTypeRequiredDescription
id_or_codeStringyesThe subaccount code you want to fetch

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

update ​

ruby
subaccounts.update(
  id_or_code:,
  business_name: nil,
  bank_code: nil,
  account_number: nil,
  active: nil,
  percentage_charge: nil,
  description: nil,
  primary_contact_email: nil,
  primary_contact_name: nil,
  primary_contact_phone: nil,
  metadata: nil
)

Update Subaccount.

Update a subaccount details on your integration

ParameterTypeRequiredDescription
id_or_codeStringyesThe subaccount code you want to fetch
business_nameStringName of business for subaccount
bank_codeStringBank code for the bank, from the List Banks endpoint.
account_numberStringBank account number
activeBooleanActivate or deactivate a subaccount
percentage_chargeNumericThe default percentage charged when receiving on behalf of this subaccount.
descriptionStringA description for this subaccount
primary_contact_emailStringA contact email for the subaccount
primary_contact_nameStringThe name of the contact person for this subaccount
primary_contact_phoneStringA phone number to call for this subaccount
metadataStringStringified JSON object of custom data

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

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