Payments

June 5, 2026 ยท View on GitHub

Use the /payments resource to authorize, capture, void authorizations, and retrieve captures.

PaymentsController paymentsController = client.getPaymentsController();

Class Name

PaymentsController

Methods

Get Authorized Payment

Shows details for an authorized payment, by ID.

CompletableFuture<ApiResponse<PaymentAuthorization>> getAuthorizedPaymentAsync(
    final GetAuthorizedPaymentInput input)

Authentication

This endpoint requires Oauth2

Parameters

ParameterTypeTagsDescription
inputGetAuthorizedPaymentInputRequiredInput structure for the method GetAuthorizedPaymentAsync

Response Type

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.

Example Usage

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;
});

Errors

HTTP Status CodeError DescriptionException Class
401Authentication failed due to missing authorization header, or invalid authentication credentials.ErrorException
403The request failed because the caller has insufficient permissions.ErrorException
404The request failed because the resource does not exist.ErrorException
500The request failed because an internal server error occurred.ApiException
DefaultThe error response.ErrorException

Capture Authorized Payment

Captures an authorized payment, by ID.

CompletableFuture<ApiResponse<CapturedPayment>> captureAuthorizedPaymentAsync(
    final CaptureAuthorizedPaymentInput input)

Authentication

This endpoint requires Oauth2

Parameters

ParameterTypeTagsDescription
inputCaptureAuthorizedPaymentInputRequiredInput structure for the method CaptureAuthorizedPaymentAsync

Response Type

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.

Example Usage

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;
});

Errors

HTTP Status CodeError DescriptionException Class
400The request failed because it is not well-formed or is syntactically incorrect or violates schema.ErrorException
401Authentication failed due to missing authorization header, or invalid authentication credentials.ErrorException
403The request failed because the caller has insufficient permissions.ErrorException
404The request failed because the resource does not exist.ErrorException
409The server has detected a conflict while processing this request.ErrorException
422The request failed because it is semantically incorrect or failed business validation.ErrorException
500The request failed because an internal server error occurred.ApiException
DefaultThe error response.ErrorException

Reauthorize Payment

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)

Authentication

This endpoint requires Oauth2

Parameters

ParameterTypeTagsDescription
inputReauthorizePaymentInputRequiredInput structure for the method ReauthorizePaymentAsync

Response Type

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.

Example Usage

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;
});

Errors

HTTP Status CodeError DescriptionException Class
400The request failed because it is not well-formed or is syntactically incorrect or violates schema.ErrorException
401Authentication failed due to missing authorization header, or invalid authentication credentials.ErrorException
403The request failed because the caller has insufficient permissions.ErrorException
404The request failed because the resource does not exist.ErrorException
422The request failed because it either is semantically incorrect or failed business validation.ErrorException
500The request failed because an internal server error occurred.ApiException
DefaultThe error response.ErrorException

Void Payment

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)

Authentication

This endpoint requires Oauth2

Parameters

ParameterTypeTagsDescription
inputVoidPaymentInputRequiredInput structure for the method VoidPaymentAsync

Response Type

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.

Example Usage

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;
});

Errors

HTTP Status CodeError DescriptionException Class
401Authentication failed due to missing authorization header, or invalid authentication credentials.ErrorException
403The request failed because the caller has insufficient permissions.ErrorException
404The request failed because the resource does not exist.ErrorException
409The request failed because a previous call for the given resource is in progress.ErrorException
422The request failed because it either is semantically incorrect or failed business validation.ErrorException
500The request failed because an internal server error occurred.ApiException
DefaultThe error response.ErrorException

Get Captured Payment

Shows details for a captured payment, by ID.

CompletableFuture<ApiResponse<CapturedPayment>> getCapturedPaymentAsync(
    final GetCapturedPaymentInput input)

Authentication

This endpoint requires Oauth2

Parameters

ParameterTypeTagsDescription
inputGetCapturedPaymentInputRequiredInput structure for the method GetCapturedPaymentAsync

Response Type

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.

Example Usage

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;
});

Errors

HTTP Status CodeError DescriptionException Class
401Authentication failed due to missing authorization header, or invalid authentication credentials.ErrorException
403The request failed because the caller has insufficient permissions.ErrorException
404The request failed because the resource does not exist.ErrorException
500The request failed because an internal server error occurred.ApiException
DefaultThe error response.ErrorException

Refund Captured Payment

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)

Authentication

This endpoint requires Oauth2

Parameters

ParameterTypeTagsDescription
inputRefundCapturedPaymentInputRequiredInput structure for the method RefundCapturedPaymentAsync

Response Type

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.

Example Usage

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;
});

Errors

HTTP Status CodeError DescriptionException Class
400The request failed because it is not well-formed or is syntactically incorrect or violates schema.ErrorException
401Authentication failed due to missing authorization header, or invalid authentication credentials.ErrorException
403The request failed because the caller has insufficient permissions.ErrorException
404The request failed because the resource does not exist.ErrorException
409The request failed because a previous call for the given resource is in progress.ErrorException
422The request failed because it either is semantically incorrect or failed business validation.ErrorException
500The request failed because an internal server error occurred.ApiException
DefaultThe error response.ErrorException

Get Refund

Shows details for a refund, by ID.

CompletableFuture<ApiResponse<Refund>> getRefundAsync(
    final GetRefundInput input)

Authentication

This endpoint requires Oauth2

Parameters

ParameterTypeTagsDescription
inputGetRefundInputRequiredInput structure for the method GetRefundAsync

Response Type

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.

Example Usage

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;
});

Errors

HTTP Status CodeError DescriptionException Class
401Authentication failed due to missing authorization header, or invalid authentication credentials.ErrorException
403The request failed because the caller has insufficient permissions.ErrorException
404The request failed because the resource does not exist.ErrorException
500The request failed because an internal server error occurred.ApiException
DefaultThe error response.ErrorException