Skip to content

Pages ​

Page operations.

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

List Pages.

List all previously created payment pages

ParameterTypeRequiredDescription
per_pageIntegerNumber of records to fetch per page
pageIntegerThe section to retrieve
fromStringThe start date
toStringThe end date

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

create ​

ruby
pages.create(
  name:,
  description: nil,
  amount: nil,
  currency: nil,
  slug: nil,
  type: nil,
  plan: nil,
  fixed_amount: nil,
  split_code: nil,
  metadata: nil,
  redirect_url: nil,
  success_message: nil,
  notification_email: nil,
  collect_phone: nil,
  custom_fields: nil
)

Create Page.

Create a webpage to receive payments

ParameterTypeRequiredDescription
nameStringyesName of page
descriptionStringThe description of the page
amountIntegerAmount should be in kobo if currency is NGN, pesewas, if currency is GHS, and cents, if currency is ZAR
currencyStringThe transaction currency. One of: NGN, GHS, ZAR, KES, USD.
slugStringURL slug you would like to be associated with this page.
typeStringThe type of payment page to create. One of: payment, subscription, product, plan.
planStringThe ID of the plan to subscribe customers on this payment page to when type is set to subscription.
fixed_amountBooleanSpecifies whether to collect a fixed amount on the payment page.
split_codeStringThe split code of the transaction split.
metadataHashJSON object of custom data
redirect_urlStringIf you would like Paystack to redirect to a URL upon successful payment, specify the URL here.
success_messageStringA success message to display to the customer after a successful transaction
notification_emailStringAn email address that will receive transaction notifications for this payment page
collect_phoneBooleanSpecify whether to collect phone numbers on the payment page
custom_fieldsArrayIf you would like to accept custom fields, specify them here.

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

fetch ​

ruby
pages.fetch(id_or_slug:)

Fetch Page.

Get a previously created payment page

ParameterTypeRequiredDescription
id_or_slugStringyesThe unique identifier of a payment page

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

update ​

ruby
pages.update(id_or_slug:, name: nil, description: nil, amount: nil, active: nil)

Update Page.

Update a previously created payment page

ParameterTypeRequiredDescription
id_or_slugStringyesThe unique identifier of a payment page
nameStringName of page
descriptionStringThe description of the page
amountIntegerAmount should be in the subunit of the currency
activeBooleanSet to false to deactivate page url

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

check_slug_availability ​

ruby
pages.check_slug_availability(slug:)

Check Slug Availability.

Check if a custom slug is available for use when creating a payment page

ParameterTypeRequiredDescription
slugStringyesThe custom slug to check

Paystack docs: https://paystack.com/docs/api/page/#check-slug

add_products ​

ruby
pages.add_products(id:, products:)

Add Products.

Add products to a previously created payment page.

ParameterTypeRequiredDescription
idIntegeryes
productsArrayyesA list of IDs of products to add to a page.

Paystack docs: https://paystack.com/docs/api/page/#add-products

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