Package com.mercadopago.client.payment
Class PaymentClient
- java.lang.Object
-
- com.mercadopago.client.MercadoPagoClient
-
- com.mercadopago.client.payment.PaymentClient
-
public class PaymentClient extends MercadoPagoClient
Client responsible for performing payment actions.
-
-
Field Summary
-
Fields inherited from class com.mercadopago.client.MercadoPagoClient
defaultHeaders, httpClient
-
-
Constructor Summary
Constructors Constructor Description PaymentClient()
Default constructor.PaymentClient(MPHttpClient httpClient)
Constructor used for providing a custom http client.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Payment
cancel(Long id)
Method responsible for cancel payment.Payment
cancel(Long id, MPRequestOptions requestOptions)
Method responsible for cancel payment with request options.Payment
capture(Long id)
Method responsible for capture payment.Payment
capture(Long id, MPRequestOptions requestOptions)
Method responsible for capture payment.Payment
capture(Long id, BigDecimal amount)
Method responsible for capture payment.Payment
capture(Long id, BigDecimal amount, MPRequestOptions requestOptions)
Method responsible for capture payment.Payment
create(PaymentCreateRequest request)
Method responsible for creating payment.Payment
create(PaymentCreateRequest request, MPRequestOptions requestOptions)
Method responsible for creating payment with request options.Payment
get(Long id)
Method responsible for getting payment.Payment
get(Long id, MPRequestOptions requestOptions)
Method responsible for getting payment.PaymentRefund
getRefund(Long paymentId, Long refundId)
Gets a refund by id from the payment.PaymentRefund
getRefund(Long paymentId, Long refundId, MPRequestOptions requestOptions)
Gets a refund by id from the payment.MPResourceList<PaymentRefund>
listRefunds(Long paymentId)
Lists the refunds of the payment.MPResourceList<PaymentRefund>
listRefunds(Long paymentId, MPRequestOptions requestOptions)
Lists the refunds of the payment.PaymentRefund
refund(Long paymentId)
Creates a total refund for payment.PaymentRefund
refund(Long paymentId, MPRequestOptions requestOptions)
Creates a total refund for payment.PaymentRefund
refund(Long paymentId, BigDecimal amount)
Creates a refund for payment.PaymentRefund
refund(Long paymentId, BigDecimal amount, MPRequestOptions requestOptions)
Creates a refund for payment.MPResultsResourcesPage<Payment>
search(MPSearchRequest request)
Method responsible for search payments.MPResultsResourcesPage<Payment>
search(MPSearchRequest request, MPRequestOptions requestOptions)
Method responsible for search payments.
-
-
-
Constructor Detail
-
PaymentClient
public PaymentClient()
Default constructor. Uses the default http client used by the SDK.
-
PaymentClient
public PaymentClient(MPHttpClient httpClient)
Constructor used for providing a custom http client.- Parameters:
httpClient
- httpClient
-
-
Method Detail
-
get
public Payment get(Long id) throws MPException, MPApiException
Method responsible for getting payment.- Parameters:
id
- paymentId- Returns:
- payment
- Throws:
MPException
- an error if the request failsMPApiException
-
get
public Payment get(Long id, MPRequestOptions requestOptions) throws MPException, MPApiException
Method responsible for getting payment.- Parameters:
id
- paymentIdrequestOptions
- metadata to customize the request- Returns:
- payment
- Throws:
MPException
- an error if the request failsMPApiException
-
create
public Payment create(PaymentCreateRequest request) throws MPException, MPApiException
Method responsible for creating payment.- Parameters:
request
- request- Returns:
- payment response
- Throws:
MPException
- an error if the request failsMPApiException
-
create
public Payment create(PaymentCreateRequest request, MPRequestOptions requestOptions) throws MPException, MPApiException
Method responsible for creating payment with request options.- Parameters:
request
- requestrequestOptions
- metadata to customize the request- Returns:
- payment response
- Throws:
MPException
- an error if the request failsMPApiException
-
cancel
public Payment cancel(Long id) throws MPException, MPApiException
Method responsible for cancel payment.- Parameters:
id
- id- Returns:
- Payment payment that was cancelled
- Throws:
MPException
- an error if the request failsMPApiException
-
cancel
public Payment cancel(Long id, MPRequestOptions requestOptions) throws MPException, MPApiException
Method responsible for cancel payment with request options.- Parameters:
id
- payment idrequestOptions
- metadata to customize the request- Returns:
- Payment payment that was cancelled
- Throws:
MPException
- an error if the request failsMPApiException
-
capture
public Payment capture(Long id) throws MPException, MPApiException
Method responsible for capture payment.- Parameters:
id
- id- Returns:
- Payment payment that was captured
- Throws:
MPException
- an error if the request failsMPApiException
-
capture
public Payment capture(Long id, MPRequestOptions requestOptions) throws MPException, MPApiException
Method responsible for capture payment.- Parameters:
id
- idrequestOptions
- metadata to customize the request- Returns:
- Payment payment that was captured
- Throws:
MPException
- an error if the request failsMPApiException
-
capture
public Payment capture(Long id, BigDecimal amount) throws MPException, MPApiException
Method responsible for capture payment.- Parameters:
id
- idamount
- amount to be captured- Returns:
- Payment payment that was captured
- Throws:
MPException
- an error if the request failsMPApiException
-
capture
public Payment capture(Long id, BigDecimal amount, MPRequestOptions requestOptions) throws MPException, MPApiException
Method responsible for capture payment.- Parameters:
id
- paymentIdamount
- amount to be capturedrequestOptions
- metadata to customize the request- Returns:
- Payment payment that was captured
- Throws:
MPException
- an error if the request failsMPApiException
-
search
public MPResultsResourcesPage<Payment> search(MPSearchRequest request) throws MPException, MPApiException
Method responsible for search payments.- Parameters:
request
- search request information- Returns:
- list of results
- Throws:
MPException
- an error if the request failsMPApiException
-
search
public MPResultsResourcesPage<Payment> search(MPSearchRequest request, MPRequestOptions requestOptions) throws MPException, MPApiException
Method responsible for search payments.- Parameters:
request
- search request informationrequestOptions
- metadata to customize the request- Returns:
- list of results
- Throws:
MPException
- an error if the request failsMPApiException
-
refund
public PaymentRefund refund(Long paymentId) throws MPException, MPApiException
Creates a total refund for payment.- Parameters:
paymentId
- payment id- Returns:
- PaymentRefund refund information
- Throws:
MPException
- an error if the request failsMPApiException
-
refund
public PaymentRefund refund(Long paymentId, MPRequestOptions requestOptions) throws MPException, MPApiException
Creates a total refund for payment.- Parameters:
paymentId
- payment idrequestOptions
- metadata to customize the request- Returns:
- PaymentRefund refund information
- Throws:
MPException
- an error if the request failsMPApiException
-
refund
public PaymentRefund refund(Long paymentId, BigDecimal amount) throws MPException, MPApiException
Creates a refund for payment.- Parameters:
paymentId
- payment idamount
- refund amount- Returns:
- PaymentRefund refund information
- Throws:
MPException
- an error if the request failsMPApiException
-
refund
public PaymentRefund refund(Long paymentId, BigDecimal amount, MPRequestOptions requestOptions) throws MPException, MPApiException
Creates a refund for payment.- Parameters:
paymentId
- payment idamount
- refund amountrequestOptions
- metadata to customize the request- Returns:
- PaymentRefund refund information
- Throws:
MPException
- an error if the request failsMPApiException
-
getRefund
public PaymentRefund getRefund(Long paymentId, Long refundId) throws MPException, MPApiException
Gets a refund by id from the payment.- Parameters:
paymentId
- payment idrefundId
- refund id- Returns:
- PaymentRefund refund information
- Throws:
MPException
- an error if the request failsMPApiException
-
getRefund
public PaymentRefund getRefund(Long paymentId, Long refundId, MPRequestOptions requestOptions) throws MPException, MPApiException
Gets a refund by id from the payment.- Parameters:
paymentId
- payment idrefundId
- refund idrequestOptions
- metadata to customize the request- Returns:
- PaymentRefund refund information
- Throws:
MPException
- an error if the request failsMPApiException
-
listRefunds
public MPResourceList<PaymentRefund> listRefunds(Long paymentId) throws MPException, MPApiException
Lists the refunds of the payment.- Parameters:
paymentId
- payment id- Returns:
- list of PaymentRefund
- Throws:
MPException
- an error if the request failsMPApiException
-
listRefunds
public MPResourceList<PaymentRefund> listRefunds(Long paymentId, MPRequestOptions requestOptions) throws MPException, MPApiException
Lists the refunds of the payment.- Parameters:
paymentId
- payment idrequestOptions
- metadata to customize the request- Returns:
- list of PaymentRefund
- Throws:
MPException
- an error if the request failsMPApiException
-
-