Skip to content

Plans ​

Plan operations.

Use it as client.plans. 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
plans.list(per_page: nil, page: nil, interval: nil, amount: nil, from: nil, to: nil, status: nil)

List Plans.

List all recurring payment plans

ParameterTypeRequiredDescription
per_pageIntegerNumber of records to fetch per page
pageIntegerThe section to retrieve
intervalStringSpecify interval of the plan One of: hourly, daily, weekly, monthly, quarterly, biannually, annually.
amountIntegerThe amount on the plans to retrieve
fromStringThe start date
toStringThe end date
statusStringFilter list by plans with specified status.

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

create ​

ruby
plans.create(
  name:,
  amount:,
  interval:,
  description: nil,
  send_invoices: nil,
  send_sms: nil,
  currency: nil,
  invoice_limit: nil
)

Create Plan.

Create a plan for recurring payments

ParameterTypeRequiredDescription
nameStringyesName of plan
amountIntegeryesAmount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
intervalStringyesPayment interval One of: hourly, daily, weekly, monthly, quarterly, biannually, annually.
descriptionStringA description for this plan
send_invoicesBooleanSet to false if you don't want invoices to be sent to your customers
send_smsBooleanSet to false if you don't want text messages to be sent to your customers
currencyStringCurrency in which amount is set.
invoice_limitIntegerNumber of invoices to raise during subscription to this plan.

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

fetch ​

ruby
plans.fetch(id_or_code:)

Fetch Plan.

Get the details of a payment plan

ParameterTypeRequiredDescription
id_or_codeStringyesThe plan code you want to fetch

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

update ​

ruby
plans.update(
  id_or_code:,
  name: nil,
  amount: nil,
  interval: nil,
  description: nil,
  send_invoices: nil,
  send_sms: nil,
  currency: nil,
  invoice_limit: nil,
  update_existing_subscriptions: nil
)

Update Plan.

Update a plan details on your integration

ParameterTypeRequiredDescription
id_or_codeStringyesThe plan code you want to fetch
nameStringName of plan
amountIntegerAmount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
intervalStringPayment interval One of: hourly, daily, weekly, monthly, quarterly, biannually, annually.
descriptionStringA description for this plan
send_invoicesBooleanSet to false if you don't want invoices to be sent to your customers
send_smsBooleanSet to false if you don't want text messages to be sent to your customers
currencyStringCurrency in which amount is set.
invoice_limitIntegerNumber of invoices to raise during subscription to this plan.
update_existing_subscriptionsBooleanSet to true if you want the existing subscriptions to use the new changes.

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

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