Refunds
Refunds — methods, parameters, and examples for easy-sdk (gem).
There is no top-level Refunds resource — refunds are issued against an
existing transfer via the reversals sub-resource. Use
client.transfers.create_refund to issue them.
For a top-level refunds index / retrieve API, coming soon.
Issuing a refund
# Full refund
charge = client.transfers.retrieve("tr_…")
client.transfers.create_refund(charge[:id], refund_amount: charge[:amount])
# Partial refund
client.transfers.create_refund("tr_…", refund_amount: 500)
# With reconciliation tags
client.transfers.create_refund(
"tr_…",
refund_amount: 1_000,
tags: { reason: "customer_request", agent: "support@example.com" }
)See Transfers › create_refund
for the full method signature.
Reading refund history
The :reversals field on the parent transfer contains every refund
issued against it:
charge = client.transfers.retrieve("tr_…")
charge[:reversals]&.each do |refund|
puts "#{refund[:id]} — #{refund[:amount]}"
endWebhook events
Subscribe to refund.created and refund.updated to react to refund
state changes asynchronously. See Webhooks for the
verifier and the full event-type catalog.