Skip to content

Refunds ​

Refund operations.

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

List Refunds.

List previously created refunds

ParameterTypeRequiredDescription
per_pageIntegerNumber of records to fetch per page
pageIntegerThe section to retrieve
fromStringThe start date
toStringThe end date
transaction_idIntegerThe ID of the refunded transaction.

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

create ​

ruby
refunds.create(transaction:, amount: nil, currency: nil, customer_note: nil, merchant_note: nil)

Create Refund.

Initiate a refund for a previously completed transaction

ParameterTypeRequiredDescription
transactionStringyesThe reference or ID of a previously completed transaction.
amountIntegerAmount to be refunded to the customer.
currencyStringThree-letter ISO currency One of: GHS, KES, NGN, USD, ZAR.
customer_noteStringCustomer reason
merchant_noteStringMerchant reason

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

retry_with_customer_details ​

ruby
refunds.retry_with_customer_details(id:, refund_account_details:)

Retry Refund.

Retry a refund with a needs-attention status by providing the bank account details of a customer.

ParameterTypeRequiredDescription
idIntegeryesThe identifier of the refund
refund_account_detailsHashyesAn object that contains the customer’s account details for refund

Paystack docs: https://paystack.com/docs/api/refund/#retry

fetch ​

ruby
refunds.fetch(id:)

Fetch Refund.

Get a previously created refund

ParameterTypeRequiredDescription
idIntegeryesThe identifier of the refund

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

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