refunds_api = client.refunds
RefundsApi
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(self,
begin_time=None,
end_time=None,
sort_order=None,
cursor=None,
location_id=None,
status=None,
source_type=None,
limit=None)
Parameter | Type | Tags | Description |
---|---|---|---|
begin_time |
str |
Query, Optional | Indicates the start of the time range to retrieve each PaymentRefund for, in RFC 3339format. The range is determined using the created_at field for each PaymentRefund .Default: The current time minus one year. |
end_time |
str |
Query, Optional | Indicates the end of the time range to retrieve each PaymentRefund for, in RFC 3339format. The range is determined using the created_at field for each PaymentRefund .Default: The current time. |
sort_order |
str |
Query, Optional | The order in which results are listed by PaymentRefund.created_at :- ASC - Oldest to newest.- DESC - Newest to oldest (default). |
cursor |
str |
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 |
str |
Query, Optional | Limit results to the location supplied. By default, results are returned for all locations associated with the seller. |
status |
str |
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 |
str |
Query, Optional | If provided, only returns refunds whose payments have the indicated source type. Current values include CARD , BANK_ACCOUNT , WALLET , CASH , and EXTERNAL .For information about these payment source types, see Take Payments. Default: If omitted, refunds are returned regardless of the source type. |
limit |
int |
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 |
This method returns a ApiResponse
instance. The body
property of this instance returns the response data which is of type List Payment Refunds Response
.
result = refunds_api.list_payment_refunds()
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
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(self,
body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
Refund Payment Request |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
This method returns a ApiResponse
instance. The body
property of this instance returns the response data which is of type Refund Payment Response
.
body = {
'idempotency_key': '9b7f2dcf-49da-4411-b23e-a2d6af21333a',
'amount_money': {
'amount': 1000,
'currency': 'USD'
},
'app_fee_money': {
'amount': 10,
'currency': 'USD'
},
'payment_id': 'R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY',
'reason': 'Example'
}
result = refunds_api.refund_payment(body)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)
Retrieves a specific refund using the refund_id
.
def get_payment_refund(self,
refund_id)
Parameter | Type | Tags | Description |
---|---|---|---|
refund_id |
str |
Template, Required | The unique ID for the desired PaymentRefund . |
This method returns a ApiResponse
instance. The body
property of this instance returns the response data which is of type Get Payment Refund Response
.
refund_id = 'refund_id4'
result = refunds_api.get_payment_refund(refund_id)
if result.is_success():
print(result.body)
elif result.is_error():
print(result.errors)