RefundsApi refundsApi = client.getRefundsApi();
RefundsApi
Retrieves a list of refunds for the account making the request.
Max results per page: 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 | Timestamp for the beginning of the requested reporting period, in RFC 3339 format. Default: The current time minus one year. |
endTime |
String |
Query, Optional | 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 to retrieve the next set of results for the original query. See Pagination for more information. |
locationId |
String |
Query, Optional | Limit results to the location supplied. By default, results are returned for all locations associated with the merchant. |
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 status. |
sourceType |
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 paymentsource. Default: If omitted refunds are returned regardless of source type. |
limit |
Integer |
Query, Optional | 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, at most 100 results will be returned. Default: 100 |
String beginTime = "begin_time2";
String endTime = "end_time2";
String sortOrder = "sort_order0";
String cursor = "cursor6";
String locationId = "location_id4";
String status = "status8";
String sourceType = "source_type0";
Integer limit = 172;
refundsApi.listPaymentRefundsAsync(beginTime, endTime, sortOrder, cursor, locationId, status, sourceType, limit).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.
Refund a payment: https://developer.squareup.com/docs/payments-api/refund-payments#refund-a-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 bodyAmountMoney = new Money.Builder()
.amount(100L)
.currency("USD")
.build();
Money bodyAppFeeMoney = new Money.Builder()
.amount(114L)
.currency("GEL")
.build();
RefundPaymentRequest body = new RefundPaymentRequest.Builder(
"a7e36d40-d24b-11e8-b568-0800200c9a66",
bodyAmountMoney,
"UNOE3kv2BZwqHlJ830RCt5YCuaB")
.appFeeMoney(bodyAppFeeMoney)
.reason("reason8")
.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
.
Retrieve refund information: https://developer.squareup.com/docs/payments-api/refund-payments#retrieve-refund-information
CompletableFuture<GetPaymentRefundResponse> getPaymentRefundAsync(
final String refundId)
Parameter | Type | Tags | Description |
---|---|---|---|
refundId |
String |
Template, Required | 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;
});