Use the /payments resource to authorize, capture, void authorizations, and retrieve captures.
PaymentsController paymentsController = client.getPaymentsController();PaymentsController
- Get Authorized Payment
- Capture Authorized Payment
- Reauthorize Payment
- Void Payment
- Get Captured Payment
- Refund Captured Payment
- Get Refund
Shows details for an authorized payment, by ID.
CompletableFuture<ApiResponse<PaymentAuthorization>> getAuthorizedPaymentAsync(
final GetAuthorizedPaymentInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
GetAuthorizedPaymentInput |
Required | Input structure for the method GetAuthorizedPaymentAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows authorization details.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type PaymentAuthorization.
GetAuthorizedPaymentInput getAuthorizedPaymentInput = new GetAuthorizedPaymentInput.Builder(
"authorization_id8"
)
.build();
paymentsController.getAuthorizedPaymentAsync(getAuthorizedPaymentInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof ErrorException) {
ErrorException errorException = (ErrorException) cause;
errorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | ErrorException |
| 403 | The request failed because the caller has insufficient permissions. | ErrorException |
| 404 | The request failed because the resource does not exist. | ErrorException |
| 500 | The request failed because an internal server error occurred. | ApiException |
| Default | The error response. | ErrorException |
Captures an authorized payment, by ID.
CompletableFuture<ApiResponse<CapturedPayment>> captureAuthorizedPaymentAsync(
final CaptureAuthorizedPaymentInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
CaptureAuthorizedPaymentInput |
Required | Input structure for the method CaptureAuthorizedPaymentAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows captured payment details.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type CapturedPayment.
CaptureAuthorizedPaymentInput captureAuthorizedPaymentInput = new CaptureAuthorizedPaymentInput.Builder(
"authorization_id8",
null
)
.prefer("return=minimal")
.body(new CaptureRequest.Builder()
.finalCapture(false)
.build())
.build();
paymentsController.captureAuthorizedPaymentAsync(captureAuthorizedPaymentInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof ErrorException) {
ErrorException errorException = (ErrorException) cause;
errorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | The request failed because it is not well-formed or is syntactically incorrect or violates schema. | ErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | ErrorException |
| 403 | The request failed because the caller has insufficient permissions. | ErrorException |
| 404 | The request failed because the resource does not exist. | ErrorException |
| 409 | The server has detected a conflict while processing this request. | ErrorException |
| 422 | The request failed because it is semantically incorrect or failed business validation. | ErrorException |
| 500 | The request failed because an internal server error occurred. | ApiException |
| Default | The error response. | ErrorException |
Reauthorizes an authorized PayPal account payment, by ID. To ensure that funds are still available, reauthorize a payment after its initial three-day honor period expires. Within the 29-day authorization period, you can issue multiple re-authorizations after the honor period expires. If 30 days have transpired since the date of the original authorization, you must create an authorized payment instead of reauthorizing the original authorized payment. A reauthorized payment itself has a new honor period of three days. You can reauthorize an authorized payment from 4 to 29 days after the 3-day honor period. The allowed amount depends on context and geography, for example in US it is up to 115% of the original authorized amount, not to exceed an increase of $75 USD. Supports only the amount request parameter.
CompletableFuture<ApiResponse<PaymentAuthorization>> reauthorizePaymentAsync(
final ReauthorizePaymentInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
ReauthorizePaymentInput |
Required | Input structure for the method ReauthorizePaymentAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows the reauthorized payment details.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type PaymentAuthorization.
ReauthorizePaymentInput reauthorizePaymentInput = new ReauthorizePaymentInput.Builder(
"authorization_id8",
null
)
.prefer("return=minimal")
.build();
paymentsController.reauthorizePaymentAsync(reauthorizePaymentInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof ErrorException) {
ErrorException errorException = (ErrorException) cause;
errorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | The request failed because it is not well-formed or is syntactically incorrect or violates schema. | ErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | ErrorException |
| 403 | The request failed because the caller has insufficient permissions. | ErrorException |
| 404 | The request failed because the resource does not exist. | ErrorException |
| 422 | The request failed because it either is semantically incorrect or failed business validation. | ErrorException |
| 500 | The request failed because an internal server error occurred. | ApiException |
| Default | The error response. | ErrorException |
Voids, or cancels, an authorized payment, by ID. You cannot void an authorized payment that has been fully captured.
CompletableFuture<ApiResponse<PaymentAuthorization>> voidPaymentAsync(
final VoidPaymentInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
VoidPaymentInput |
Required | Input structure for the method VoidPaymentAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows authorization details. This response is returned when the Prefer header is set to return=representation.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type PaymentAuthorization.
VoidPaymentInput voidPaymentInput = new VoidPaymentInput.Builder(
"authorization_id8"
)
.prefer("return=minimal")
.build();
paymentsController.voidPaymentAsync(voidPaymentInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof ErrorException) {
ErrorException errorException = (ErrorException) cause;
errorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | ErrorException |
| 403 | The request failed because the caller has insufficient permissions. | ErrorException |
| 404 | The request failed because the resource does not exist. | ErrorException |
| 409 | The request failed because a previous call for the given resource is in progress. | ErrorException |
| 422 | The request failed because it either is semantically incorrect or failed business validation. | ErrorException |
| 500 | The request failed because an internal server error occurred. | ApiException |
| Default | The error response. | ErrorException |
Shows details for a captured payment, by ID.
CompletableFuture<ApiResponse<CapturedPayment>> getCapturedPaymentAsync(
final GetCapturedPaymentInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
GetCapturedPaymentInput |
Required | Input structure for the method GetCapturedPaymentAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows captured payment details.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type CapturedPayment.
GetCapturedPaymentInput getCapturedPaymentInput = new GetCapturedPaymentInput.Builder(
"capture_id2"
)
.build();
paymentsController.getCapturedPaymentAsync(getCapturedPaymentInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof ErrorException) {
ErrorException errorException = (ErrorException) cause;
errorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | ErrorException |
| 403 | The request failed because the caller has insufficient permissions. | ErrorException |
| 404 | The request failed because the resource does not exist. | ErrorException |
| 500 | The request failed because an internal server error occurred. | ApiException |
| Default | The error response. | ErrorException |
Refunds a captured payment, by ID. For a full refund, include an empty payload in the JSON request body. For a partial refund, include an amount object in the JSON request body.
CompletableFuture<ApiResponse<Refund>> refundCapturedPaymentAsync(
final RefundCapturedPaymentInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
RefundCapturedPaymentInput |
Required | Input structure for the method RefundCapturedPaymentAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows refund details.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type Refund.
RefundCapturedPaymentInput refundCapturedPaymentInput = new RefundCapturedPaymentInput.Builder(
"capture_id2",
null
)
.prefer("return=minimal")
.build();
paymentsController.refundCapturedPaymentAsync(refundCapturedPaymentInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof ErrorException) {
ErrorException errorException = (ErrorException) cause;
errorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 400 | The request failed because it is not well-formed or is syntactically incorrect or violates schema. | ErrorException |
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | ErrorException |
| 403 | The request failed because the caller has insufficient permissions. | ErrorException |
| 404 | The request failed because the resource does not exist. | ErrorException |
| 409 | The request failed because a previous call for the given resource is in progress. | ErrorException |
| 422 | The request failed because it either is semantically incorrect or failed business validation. | ErrorException |
| 500 | The request failed because an internal server error occurred. | ApiException |
| Default | The error response. | ErrorException |
Shows details for a refund, by ID.
CompletableFuture<ApiResponse<Refund>> getRefundAsync(
final GetRefundInput input)This endpoint requires Oauth2
| Parameter | Type | Tags | Description |
|---|---|---|---|
input |
GetRefundInput |
Required | Input structure for the method GetRefundAsync |
200: A successful request returns the HTTP 200 OK status code and a JSON response body that shows refund details.
This method returns an ApiResponse instance. The getResult() getter of this instance returns the response data which is of type Refund.
GetRefundInput getRefundInput = new GetRefundInput.Builder(
"refund_id4"
)
.build();
paymentsController.getRefundAsync(getRefundInput).thenAccept(result -> {
// TODO success callback handler
System.out.println(result);
}).exceptionally(exception -> {
Throwable cause = exception.getCause();
if (cause instanceof ErrorException) {
ErrorException errorException = (ErrorException) cause;
errorException.printStackTrace();
} else {
// fallback for unexpected errors
exception.printStackTrace();
}
return null;
});| HTTP Status Code | Error Description | Exception Class |
|---|---|---|
| 401 | Authentication failed due to missing authorization header, or invalid authentication credentials. | ErrorException |
| 403 | The request failed because the caller has insufficient permissions. | ErrorException |
| 404 | The request failed because the resource does not exist. | ErrorException |
| 500 | The request failed because an internal server error occurred. | ApiException |
| Default | The error response. | ErrorException |