Plan Module

This wrapper class facilitates synchronous integration with Paystack Plans API. The Plans API allows you to create and manage installment payment options on your integration.


class PlanClientAPI(secret_key: str = None)

Paystack Plan API Reference: Plans

create_plan(name: str, amount: int, interval: str, currency: str, invoice_limit: int, send_invoices: bool, send_sms: bool, description: str | None = None)→ PayStackResponse

Create a plan

Parameters:
  • name (str) – The name of the plan

  • amount (int) – The amount of the plan

  • interval (str) – The interval of the plan

  • currency (str) – The currency of the plan

  • invoice_limit (int) – The invoice limit of the plan

  • send_invoices (bool) – Whether or not to send invoices

  • send_sms (bool) – Whether or not to send SMS

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

Returns:

The response from the API

Return type:

PayStackResponse object

fetch_plan(id_or_code: str)→ PayStackResponse

Fetch a plan

Parameters:

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

Returns:

The response from the API

Return type:

PayStackResponse object

list_plans(per_page: int | None = 50, page: int | None = 1, status: str | None = None, interval: str | None = None, amount: int | None = None)→ PayStackResponse

List plans

Parameters:
  • per_page (int, optional) – The number of plans per page

  • page (int, optional) – The page number

  • status (str, optional) – Filter list by plans with specified status

  • interval (str, optional) – Filter list by plans with specified interval

  • amount (int, optional) – The amount of the plans

Returns:

The response from the API

Return type:

PayStackResponse object

update_plan(id_or_code: str, name: str, amount: int, interval: str, send_invoices: bool, send_sms: bool, currency: str, invoice_limit: int, description: str | None = None)→ PayStackResponse

Update a plan

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

  • name (str) – The name of the plan

  • amount (int) – The amount of the plan

  • interval (str) – The interval of the plan.

  • send_invoices (bool) – Whether or not to send invoices

  • send_sms (bool) – Whether or not to send SMS

  • currency (str) – The currency of the plan

  • invoice_limit (int) – The invoice limit of the plan

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

Returns:

The response from the API

Return type:

PayStackResponse object

You can use the tool kit in the helpers module as reference to get the string value of the Interval enum class to pass into the interval parameter Tool kit module