RefundsApi refundsApi = client.getRefundsApi();
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.
CompletableFuture<ListPaymentRefundsResponse> listPaymentRefundsAsync(
final String beginTime,
final String endTime,
final String sortOrder,
final String cursor,
final String locationId,
final String status,
final String sourceType,
final Integer limit)
Parameter | Type | Tags | Description |
---|---|---|---|
beginTime |
String |
Query, Optional | The timestamp for the beginning of the requested reporting period, in RFC 3339 format. Default: The current time minus one year. |
endTime |
String |
Query, Optional | The timestamp for the end of the requested reporting period, in RFC 3339 format. Default: The current time. |
sortOrder |
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. |
locationId |
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. |
sourceType |
String |
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 |
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 |
refundsApi.listPaymentRefundsAsync(null, null, null, null, null, null, null, null).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});
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.
CompletableFuture<RefundPaymentResponse> refundPaymentAsync(
final RefundPaymentRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
RefundPaymentRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Money money = new Money.Builder()
.amount(1000L)
.currency("USD")
.build();
Money money = new Money.Builder()
.amount(10L)
.currency("USD")
.build();
RefundPaymentRequest body = new RefundPaymentRequest.Builder(
"9b7f2dcf-49da-4411-b23e-a2d6af21333a",
amountMoney)
.appFeeMoney(bodyAppFeeMoney)
.paymentId("R2B3Z8WMVt3EAmzYWLZvz7Y69EbZY")
.reason("Example")
.build();
refundsApi.refundPaymentAsync(body).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});
Retrieves a specific refund using the refund_id
.
CompletableFuture<GetPaymentRefundResponse> getPaymentRefundAsync(
final String refundId)
Parameter | Type | Tags | Description |
---|---|---|---|
refundId |
String |
Template, Required | The unique ID for the desired PaymentRefund . |
String refundId = "refund_id4";
refundsApi.getPaymentRefundAsync(refundId).thenAccept(result -> {
// TODO success callback handler
}).exceptionally(exception -> {
// TODO failure callback handler
return null;
});