Documentation Index
Fetch the complete documentation index at: https://mintlify.com/mercadopago/sdk-java/llms.txt
Use this file to discover all available pages before exploring further.
PaymentClient is the primary entry point for the Mercado Pago Payments API (v1). It covers the complete payment lifecycle: creating payments, retrieving them by ID, cancelling pending payments, capturing authorized payments (full or partial), paginated search, and the full set of refund operations. Refund operations are internally delegated to PaymentRefundClient and exposed as convenience methods so you only ever need to interact with this single client.
Package: com.mercadopago.client.payment
Constructors
PaymentClient()
Creates a PaymentClient using the default HTTP client configured via MercadoPagoConfig.
PaymentClient(MPHttpClient httpClient)
Creates a PaymentClient with a custom HTTP client. An internal PaymentRefundClient is also initialised with the same HTTP client.
The HTTP client implementation used to execute all requests.
Methods
get — Retrieve a payment by ID
The unique identifier of the payment to retrieve.
Optional per-request overrides for access token, custom headers, or timeouts. Pass
null to use the global defaults.Payment — the requested payment object.
Throws: MPException on transport/SDK errors; MPApiException on non-2xx API responses.
create — Create a payment
transactionAmount, paymentMethodId, and payer.
The payment creation request. Key fields:
| Field | Type | Description |
|---|---|---|
transactionAmount | BigDecimal | Total amount to charge. |
paymentMethodId | String | Payment method identifier (e.g. "visa", "pix"). |
payer | PaymentPayerRequest | Payer details including email and identification. |
token | String | Card token generated by the tokenization flow. |
installments | Integer | Number of installments selected by the buyer. |
capture | Boolean | true to capture immediately; false to only authorize/reserve. |
externalReference | String | Your internal order or reference ID. |
notificationUrl | String | Webhook URL for payment status change notifications. |
description | String | Payment reason or item title. |
binaryMode | Boolean | When true, only approved/rejected statuses are used. |
Optional per-request overrides. Pass
null to use global defaults.Payment — the created payment, including its assigned id and initial status.
Throws: MPException on transport/SDK errors; MPApiException on non-2xx API responses.
cancel — Cancel a pending payment
cancelled. Only payments that are currently in pending or in_process state can be cancelled.
The unique identifier of the payment to cancel.
Optional per-request overrides. Pass
null to use global defaults.Payment — the cancelled payment with updated status.
Throws: MPException on transport/SDK errors; MPApiException on non-2xx API responses.
capture — Capture an authorized payment
Captures a payment that was previously authorized (created with capture = false). Overloads are provided for full capture and partial capture.
Full capture
The unique identifier of the authorized payment to capture.
Optional per-request overrides. Pass
null to use global defaults.Partial capture
The unique identifier of the authorized payment to capture.
The amount to capture. Pass
null to capture the full authorized amount.Optional per-request overrides. Pass
null to use global defaults.Payment — the updated payment with captured = true and the final transactionAmount.
Throws: MPException on transport/SDK errors; MPApiException on non-2xx API responses.
search — Search payments with pagination
Search parameters. Use
MPSearchRequest.builder().filters(map).offset(0).limit(30).build() to configure filters such as status, external_reference, date_created.range, etc.Optional per-request overrides. Pass
null to use global defaults.MPResultsResourcesPage<Payment> — contains .getResults() (list of matching payments), .getPaging().getTotal(), .getPaging().getOffset(), and .getPaging().getLimit().
Throws: MPException on transport/SDK errors; MPApiException on non-2xx API responses.
refund — Refund a payment
Creates a total or partial refund for a captured payment. These methods delegate to the internal PaymentRefundClient.
Total refund
The unique identifier of the payment to refund in full.
Optional per-request overrides. Pass
null to use global defaults.Partial refund
The unique identifier of the payment to partially refund.
The amount to refund. Must be greater than zero and at most the remaining refundable amount.
Optional per-request overrides. Pass
null to use global defaults.PaymentRefund — the created refund, including its id, amount, and status.
Throws: MPException on transport/SDK errors; MPApiException on non-2xx API responses.
getRefund — Retrieve a specific refund
The unique identifier of the original payment.
The unique identifier of the refund to retrieve.
Optional per-request overrides. Pass
null to use global defaults.PaymentRefund — the requested refund object.
Throws: MPException on transport/SDK errors; MPApiException on non-2xx API responses.
listRefunds — List all refunds for a payment
The unique identifier of the payment whose refunds should be listed.
Optional per-request overrides. Pass
null to use global defaults.MPResourceList<PaymentRefund> — contains .getResults() with all refunds for the payment.
Throws: MPException on transport/SDK errors; MPApiException on non-2xx API responses.
Resource classes
Payment resource
Key fields returned by the API on the Payment object:
Unique payment identifier assigned by Mercado Pago.
Current payment status:
approved, pending, in_process, rejected, cancelled, refunded, charged_back.Detailed explanation of the current status or rejection cause.
Total amount charged to the payer.
Total amount that has been refunded for this payment.
true if the payment has been captured; false if only authorized/reserved.Payment method used (e.g.
visa, master, pix).Type of the payment method:
credit_card, debit_card, ticket, bank_transfer.Your system’s reference identifier passed at creation.
Timestamp when the payment was created.
Timestamp when the payment was approved.
Data about the payment origin context, including QR code or deep-link data for Pix payments.
PaymentRefund resource
Unique identifier of this refund.
Identifier of the original payment that was refunded.
Amount returned to the payer.
Current refund status:
approved, in_process.Timestamp when the refund was created.