Skip to content

Latest commit

 

History

History
153 lines (109 loc) · 5.17 KB

refunds.md

File metadata and controls

153 lines (109 loc) · 5.17 KB

Refunds

refunds_api = client.refunds

Class Name

RefundsApi

Methods

List Payment Refunds

Retrieves a list of refunds for the account making the request.

Results are eventually consistent, and new refunds or changes to refunds might take several seconds to appear.

The maximum results per page is 100.

def list_payment_refunds(begin_time: nil,
                         end_time: nil,
                         sort_order: nil,
                         cursor: nil,
                         location_id: nil,
                         status: nil,
                         source_type: nil,
                         limit: nil)

Parameters

Parameter Type Tags Description
begin_time String Query, Optional The timestamp for the beginning of the requested reporting period, in RFC 3339 format.

Default: The current time minus one year.
end_time String Query, Optional The timestamp for the end of the requested reporting period, in RFC 3339 format.

Default: The current time.
sort_order String Query, Optional The order in which results are listed:

- ASC - Oldest to newest.
- DESC - Newest to oldest (default).
cursor String Query, Optional A pagination cursor returned by a previous call to this endpoint.
Provide this cursor to retrieve the next set of results for the original query.

For more information, see Pagination.
location_id String Query, Optional Limit results to the location supplied. By default, results are returned
for all locations associated with the seller.
status String Query, Optional If provided, only refunds with the given status are returned.
For a list of refund status values, see PaymentRefund.

Default: If omitted, refunds are returned regardless of their status.
source_type String Query, Optional If provided, only refunds with the given source type are returned.

- CARD - List refunds only for payments where CARD was specified as the payment
source.

Default: If omitted, refunds are returned regardless of the source type.
limit Integer Query, Optional The maximum number of results to be returned in a single page.

It is possible to receive fewer results than the specified limit on a given page.

If the supplied value is greater than 100, no more than 100 results are returned.

Default: 100

Response Type

List Payment Refunds Response Hash

Example Usage

begin_time = 'begin_time2'
end_time = 'end_time2'
sort_order = 'sort_order0'
cursor = 'cursor6'
location_id = 'location_id4'
status = 'status8'
source_type = 'source_type0'
limit = 172

result = refunds_api.list_payment_refunds(begin_time: begin_time, end_time: end_time, sort_order: sort_order, cursor: cursor, location_id: location_id, status: status, source_type: source_type, limit: limit)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

Refund Payment

Refunds a payment. You can refund the entire payment amount or a portion of it. You can use this endpoint to refund a card payment or record a refund of a cash or external payment. For more information, see Refund Payment.

def refund_payment(body:)

Parameters

Parameter Type Tags Description
body Refund Payment Request Hash Body, Required An object containing the fields to POST for the request.

See the corresponding object definition for field details.

Response Type

Refund Payment Response Hash

Example Usage

body = {}
body[:idempotency_key] = 'a7e36d40-d24b-11e8-b568-0800200c9a66'
body[:amount_money] = {}
body[:amount_money][:amount] = 100
body[:amount_money][:currency] = 'USD'
body[:app_fee_money] = {}
body[:app_fee_money][:amount] = 114
body[:app_fee_money][:currency] = 'GEL'
body[:payment_id] = 'UNOE3kv2BZwqHlJ830RCt5YCuaB'
body[:reason] = 'reason8'

result = refunds_api.refund_payment(body: body)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end

Get Payment Refund

Retrieves a specific refund using the refund_id.

def get_payment_refund(refund_id:)

Parameters

Parameter Type Tags Description
refund_id String Template, Required The unique ID for the desired PaymentRefund.

Response Type

Get Payment Refund Response Hash

Example Usage

refund_id = 'refund_id4'

result = refunds_api.get_payment_refund(refund_id: refund_id)

if result.success?
  puts result.data
elsif result.error?
  warn result.errors
end