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.
MercadoPagoConfig is the central, static, thread-safe configuration class for the Mercado Pago Java SDK. All of its fields are declared volatile (or synchronized where necessary), so a single call during application startup propagates consistently across all threads. Every API resource class in the SDK reads from this global configuration at request time, meaning you only need to configure the SDK once — typically at application bootstrap — before making any API calls.
Per-request overrides (for example, a different access token per merchant in a marketplace) can be specified through MPRequestOptions. Any field left at its zero or null default in that object automatically falls back to the values set here.
Package: com.mercadopago
SDK Constants
The following constants are defined aspublic static final fields and cannot be changed at runtime.
| Constant | Value | Description |
|---|---|---|
CURRENT_VERSION | "3.3.0" | SDK version string, included in every API request’s tracking header. |
BASE_URL | "https://api.mercadopago.com" | Root URL for all Mercado Pago REST API endpoints. |
PRODUCT_ID | "BC32A7VTRPP001U8NHJ0" | Internal analytics identifier sent as a header on every request. |
TRACKING_ID | "platform:<javaVersion>,type:SDK<version>,so;" | Composite tracking header built from getJavaVersion() and CURRENT_VERSION. |
Configuration Properties
All properties are read and written through static getter/setter methods generated by Lombok. Call the setter once at startup; getters are used internally by the SDK on every request.OAuth 2.0 access token used to authenticate every API request. This is the only required
configuration field. Obtain your token from the
Mercado Pago Developer Dashboard.
Optional platform identifier forwarded as an HTTP header (
x-platform-id) on every request.
Use this when your application is a platform that processes transactions on behalf of multiple
sellers.Optional corporation identifier forwarded as an HTTP header (
x-corporation-id). Used for
multi-entity or enterprise account setups to attribute requests to a specific legal entity.Optional integrator identifier forwarded as an HTTP header (
x-integrator-id). Identifies the
technology partner or integration agency responsible for the integration.Controls the verbosity of the SDK’s internal logger. The default value
Level.OFF disables all
SDK log output. Set to Level.FINE or Level.INFO to enable diagnostic logging during
development.Available levels (most to least verbose): Level.ALL, Level.FINEST, Level.FINER,
Level.FINE, Level.CONFIG, Level.INFO, Level.WARNING, Level.SEVERE, Level.OFF.Custom log handler for SDK output. When
null (the default), the SDK creates a new
ConsoleHandler that writes to System.err. Supply your own StreamHandler (or a subclass
such as FileHandler) to redirect log output to a file or another sink.See getStreamHandler() for the lazy-initialization behavior.Scope label included when the SDK reports internal metrics back to Mercado Pago infrastructure.
The default value
"prod" indicates production traffic. Change to "sandbox" or a custom
label only if instructed by Mercado Pago support.Maximum number of concurrent HTTP connections maintained in the SDK’s connection pool. Increase
this value for high-throughput applications that issue many parallel API calls. The pool is
created lazily the first time
getHttpClient() is called.Maximum time in milliseconds the SDK will wait while establishing a new TCP connection to the
Mercado Pago API. A value of
0 means indefinitely. Throws ConnectTimeoutException when
exceeded.Maximum time in milliseconds the SDK will wait to acquire an existing connection from the
connection pool. This timeout is relevant under high concurrency when all pooled connections are
in use. Throws
ConnectionPoolTimeoutException when exceeded.Maximum time in milliseconds the SDK will wait for data to arrive on an open socket (i.e., time
between consecutive TCP packets during the response body transfer). A value of
0 means
indefinitely. Throws SocketTimeoutException when exceeded.Custom HTTP client implementation that replaces the built-in
MPDefaultHttpClient. Implement
the MPHttpClient interface to use a different HTTP library, add request/response interceptors,
or integrate with your application’s existing HTTP infrastructure. Must be set before the first
API call is made.HTTP proxy host through which all SDK requests are routed. When
null (the default), requests
go directly to BASE_URL. The getter and setter for this field are @Synchronized to prevent
partial reads during concurrent updates.Custom retry handler that overrides the default Apache HTTP client retry strategy. When set, the
underlying
CloseableHttpClient delegates all retry decisions to this handler. Useful for
implementing exponential backoff or disabling retries entirely.Methods
getHttpClient()
MPHttpClient instance used for all API communication. On the first call, if no
custom client has been set via setHttpClient(), a new MPDefaultHttpClient is instantiated
using the current pool and timeout settings. Subsequent calls return the same instance (singleton).
The active HTTP client — either the custom implementation set via
setHttpClient(), or a lazily
created MPDefaultHttpClient. Never null.getStreamHandler()
StreamHandler for SDK logging. If a custom handler has been configured via
setLoggingHandler(), that handler is returned. Otherwise, a new ConsoleHandler (writing to
System.err) is created and returned each time.
The configured
StreamHandler, or a freshly constructed ConsoleHandler if none has been set.getJavaVersion()
"major|full". For example, on Java 11.0.12+7 this
returns "11|11.0.12+7". This value is embedded in the TRACKING_ID constant that is sent as a
header on every API request so the Mercado Pago platform can identify the client environment.
A string in the format
"majorVersion|fullVersion", or null if the
java.runtime.version system property is unavailable.