Skip to content

Orders ​

Order operations.

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

List Orders.

List the previously created orders

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/order/#list

create ​

ruby
orders.create(
  email:,
  first_name:,
  last_name:,
  phone:,
  currency:,
  items:,
  shipping:,
  is_gift: nil,
  pay_for_me: nil
)

Create Order.

Create an order for selected items

ParameterTypeRequiredDescription
emailStringyesThe email of the customer placing the order
first_nameStringyesThe customer's first name
last_nameStringyesThe customer's last name
phoneStringyesThe customer's mobile number
currencyStringyesCurrency in which amount is set One of: GHS, KES, NGN, USD, ZAR.
itemsArrayyes
shippingHashyesThe shipping details of the order
is_giftBooleanA flag to indicate if the order is for someone else
pay_for_meBooleanA flag to indicate if the someone else should pay for the order

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

fetch ​

ruby
orders.fetch(id:)

Fetch Order.

Fetch the details of a previously created order

ParameterTypeRequiredDescription
idIntegeryesThe unique identifier of the order

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

fetch_product_orders ​

ruby
orders.fetch_product_orders(id:)

Fetch Product Orders.

Fetch all orders for a particular product

ParameterTypeRequiredDescription
idIntegeryesThe unique identifier of the order

Paystack docs: https://paystack.com/docs/api/order/#fetch-product-orders

validate ​

ruby
orders.validate(code:)

Validate Order.

Validate a pay for me order

ParameterTypeRequiredDescription
codeStringyesThe unique code of a previously created order

Paystack docs: https://paystack.com/docs/api/order/#validate

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