SubAccounts Module

This wrapper class facilitates synchronous integration with Paystack SubAccounts API. The Subaccounts API allows you to create and manage subaccounts on your integration. Subaccounts can be used to split payment between two accounts (your main account and a subaccount).


class SubAccountClientAPI(secret_key: str = None)

Paystack SubAccount API Reference: Subaccount

create_subaccount(business_name: str, settlement_bank: str, account_number: str, percentage_charge: float, description: str, primary_contact_email: str | None = None, primary_contact_name: str | None = None, primary_contact_phone: str | None = None, metadata: Dict[str, List[Dict[str, Any]]] | None = None)→ PayStackResponse

Create a subaccount

Parameters:
  • business_name (str) – The business name of the subaccount

  • settlement_bank (str) – Bank code for the bank

  • account_number (str)

  • percentage_charge (float) – The percentage charge receives from each payment made to the subaccount

  • description (str) – The description of the subaccount

  • primary_contact_email (str, optional) – A contact email for the subaccount

  • primary_contact_name (str, optional) – A name for the contact person for this subaccount

  • primary_contact_phone (str, optional) – A phone number to call for this subaccount

  • metadata (Dict[str, List[Dict[str, Any]]] | None,) – Metadata associated with the subaccount. It is a dictionary of custom fields type of metadata

Returns:

A response from the API

Return type:

PayStackResponse object

fetch_subaccount(id_or_code: str)→ PayStackResponse

Fetch a subaccount

Parameters:

id_or_code (str) – The id or code of the subaccount

Returns:

A response from the API

Return type:

PayStackResponse object

list_subaccounts(per_page: int | None = 50, page: int | None = 1, from_date: date | None = None, to_date: date | None = None)→ PayStackResponse

List subaccounts

Parameters:
  • per_page (int, optional) – The number of subaccounts to return. (default: 50)

  • page (int, optional) – The page to return. (default: 1)

  • from_date (date, optional) – The date from which to list subaccounts

  • to_date (date, optional) – The date until which to list subaccounts

Returns:

A response from the API

Return type:

PayStackResponse object

update_subaccount(id_or_code: str, business_name: str, settlement_bank: str, account_number: str, active: bool | None = None, percentage_charge: float | None = None, description: str | None = None, primary_contact_email: str | None = None, primary_contact_name: str | None = None, primary_contact_phone: str | None = None, settlement_schedule: str | None = None, metadata: Dict[str, List[Dict[str, Any]]] | None = None)→ PayStackResponse

Update a subaccount

Parameters:
  • id_or_code (str) – The id or code of the subaccount

  • business_name (str) – The business name of the subaccount

  • settlement_bank (str) – Bank code for the bank

  • account_number (str)

  • active (bool, optional) – Whether the subaccount is active or not. (default: True)

  • percentage_charge (float, optional) – The percentage charge receives from each payment made to the subaccount

  • description (str, optional) – The description of the subaccount

  • primary_contact_email (str, optional) – A contact email for the subaccount

  • primary_contact_name (str, optional) – A name for the contact person for this subaccount

  • primary_contact_phone (str, optional) – A phone number to call for this subaccount

  • settlement_schedule (str, optional) – The settlement schedule of the subaccount. (default: auto)

  • metadata (Dict[str, List[Dict[str, Any]]] | None,) – Metadata associated with the subaccount. It is a dictionary of custom fields type

Returns:

A response from the API

Return type:

PayStackResponse object

Note

auto means payout is T+1 Manual means payout to the subaccount should only be made when requested.

Ensure you check use the string values of the enum classes. See Tool kit module documentation for more information.