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.
MPRequestOptions is an immutable, per-request configuration object that lets you override the global defaults set in MercadoPagoConfig for a single API call. Any field left at its zero or null default automatically falls back to the corresponding global value, so you only need to populate the fields you want to change. Instances are constructed using the Lombok-generated builder and are safe to create on every request without pooling.
Package: com.mercadopago.core
Priority Order
When the SDK resolves the final value of a setting, it follows this precedence chain (highest to lowest):MPRequestOptions— field is non-null / non-zero in the options object passed to the API call.- Request object field — some resource request classes (e.g.,
PaymentCreateRequest) expose their own token or header fields. MercadoPagoConfig— the global static configuration, used as the final fallback.
Creating an Instance
Builder (recommended)
createDefault()
Returns an MPRequestOptions instance with all fields at their zero/null defaults. Passing this
to any SDK method is equivalent to not passing MPRequestOptions at all — every setting will fall
back to MercadoPagoConfig.
Fields
OAuth access token used exclusively for this request, overriding the global token configured in
MercadoPagoConfig.setAccessToken(). When null, the global token is used.This is the primary field for marketplace scenarios where each API call must be authenticated
on behalf of a different connected seller.Maximum time in milliseconds to wait while establishing a new TCP connection for this request.
A value of
0 means the SDK uses the value from MercadoPagoConfig.getConnectionTimeout()
(default 20000 ms).Maximum time in milliseconds to wait when acquiring an existing connection from the pool for
this request. A value of
0 defers to MercadoPagoConfig.getConnectionRequestTimeout()
(default 20000 ms).Maximum time in milliseconds to wait for data to arrive on the socket during this request. A
value of
0 defers to MercadoPagoConfig.getSocketTimeout() (default 20000 ms).Additional HTTP headers to include in this request only. Common use cases include:
- Idempotency keys (
x-idempotency-key) to safely retry POST requests. - Custom tracing headers for distributed tracing systems (e.g.,
x-request-id).
Authorization or the standard Mercado Pago tracking headers — those are managed automatically
by the SDK.Common Use Cases
Per-merchant access token (marketplace)
In a marketplace integration each seller has their own OAuth token. Pass the seller’s token viaMPRequestOptions so you never overwrite the global configuration shared by other threads.
Idempotent POST requests
Attach a unique idempotency key to prevent duplicate charges if the network request is retried after a timeout.Tighter timeouts for latency-sensitive operations
Use reduced timeouts for calls inside a user-facing request path where a slow API response should fail fast rather than block a web thread.All fields combined
MPSearchRequest
MPSearchRequest encapsulates the search filters and pagination parameters sent to any SDK
search() method. It is constructed with the same Lombok builder pattern.
Package: com.mercadopago.net
Fields
Maximum number of results to return per page. Passed as the
limit query parameter. If the
filters map already contains a "limit" key, that value takes precedence over this field.Zero-based index of the first result to return. Passed as the
offset query parameter. If the
filters map already contains an "offset" key, that value takes precedence.Arbitrary key-value pairs appended as additional query parameters. Use this to filter results by
resource-specific fields such as
status, external_reference, date_created.from, etc.Filter values override limit and offset if the same key appears in both places.getParameters()
limit, offset, and filters fields into a single query-parameter map that the SDK
appends to the request URL. Returns a new mutable HashMap on every call.
Builder example
Paginating through all results
Response Wrapper Types
All SDK list and search methods return one of three generic wrapper types, each of which extendsMPResource and therefore carries an attached MPResponse with the raw HTTP metadata.
MPResourceList<T>
Package:com.mercadopago.net
Represents a response whose JSON body is a flat array of resource objects — no pagination
envelope. Used for endpoints that return all matching items in a single call.
The deserialized list of resource objects. May be empty but is never
null.MPResultsResourcesPage<T>
Package:com.mercadopago.net
Represents a paginated response following the {"paging": {...}, "results": [...]} envelope used
by most Mercado Pago search endpoints.
Pagination metadata for the current page.
The deserialized resource objects for the current page.
MPElementsResourcesPage<T>
Package:com.mercadopago.net
Represents a paginated response following the alternative {"total": N, "next_offset": M, "elements": [...]} envelope used by some Mercado Pago endpoints (e.g., subscription-related resources).
Total number of items across all pages that match the search criteria. Constant across pages.
The offset value to pass as
offset in the next request to retrieve the following page. When
getNextOffset() >= getTotal(), all items have been fetched.The deserialized resource objects for the current page.
Accessing the Raw HTTP Response
Every object returned by the SDK — whether a single resource, anMPResourceList, an
MPResultsResourcesPage, or an MPElementsResourcesPage — extends MPResource and exposes a
getResponse() method that returns the underlying MPResponse.
The raw HTTP response from which the resource was deserialized.