public class PaymentService
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
PaymentService.PaymentCancelRequest
Request class for
cancel(java.lang.String) . |
static class |
PaymentService.PaymentCreateRequest
Request class for
create() . |
static class |
PaymentService.PaymentGetRequest
Request class for
get(java.lang.String) . |
static class |
PaymentService.PaymentListRequest<S>
Request class for
list() . |
static class |
PaymentService.PaymentRetryRequest
Request class for
retry(java.lang.String) . |
static class |
PaymentService.PaymentUpdateRequest
Request class for
update(java.lang.String) . |
Constructor and Description |
---|
PaymentService(HttpClient httpClient)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
PaymentService.PaymentListRequest<java.lang.Iterable<Payment>> |
all() |
PaymentService.PaymentCancelRequest |
cancel(java.lang.String identity)
Cancels the payment if it has not already been submitted to the banks.
|
PaymentService.PaymentCreateRequest |
create()
|
PaymentService.PaymentGetRequest |
get(java.lang.String identity)
Retrieves the details of a single existing payment.
|
PaymentService.PaymentListRequest<ListResponse<Payment>> |
list()
Returns a cursor-paginated list of your payments.
|
PaymentService.PaymentRetryRequest |
retry(java.lang.String identity)
|
PaymentService.PaymentUpdateRequest |
update(java.lang.String identity)
Updates a payment object.
|
public PaymentService(HttpClient httpClient)
Constructor. Users of this library should have no need to call this - an instance of this class can be obtained by calling GoCardlessClient.payments()
.
public PaymentService.PaymentCreateRequest create()
This fails with a mandate_is_inactive
error if the linked mandate is cancelled or has failed. Payments can be created against mandates with status of: pending_customer_approval
, pending_submission
, submitted
, and active
.
public PaymentService.PaymentListRequest<ListResponse<Payment>> list()
Returns a cursor-paginated list of your payments.
public PaymentService.PaymentListRequest<java.lang.Iterable<Payment>> all()
public PaymentService.PaymentGetRequest get(java.lang.String identity)
Retrieves the details of a single existing payment.
public PaymentService.PaymentUpdateRequest update(java.lang.String identity)
Updates a payment object. This accepts only the metadata parameter.
public PaymentService.PaymentCancelRequest cancel(java.lang.String identity)
Cancels the payment if it has not already been submitted to the banks. Any metadata supplied to this endpoint will be stored on the payment cancellation event it causes.
This will fail with a cancellation_failed
error unless the payment’s status is pending_submission
.
public PaymentService.PaymentRetryRequest retry(java.lang.String identity)
Retries a failed payment if the underlying mandate is active. You will receive a resubmission_requested
webhook, but after that retrying the payment follows the same process as its initial creation, so you will receive a submitted
webhook, followed by a confirmed
or failed
event. Any metadata supplied to this endpoint will be stored against the payment submission event it causes.
This will return a retry_failed
error if the payment has not failed.
Payments can be retried up to 3 times.