Ir para o conteúdo

tempest_fastapi_sdk.integrations.payment.mercado_pago

A superfície do Mercado Pago: cliente, schemas e webhook.

« Integrações e pagamentos


MercadoPagoClient

MercadoPagoClient(client: HTTPClient)

Client for MercadoPago API (version 1.0.0).

Initialize the client.

Parameters:

Name Type Description Default
client HTTPClient

The transport to issue requests through. Build it with HTTPClient(base_url=DEFAULT_BASE_URL) to target the server the specification declares, and attach credentials via its default_headers.

required

search_authorized_payments async

search_authorized_payments(
    *,
    preapproval_id: str | None = None,
    payment_id: int | None = None,
    payer_id: int | None = None,
    status: AuthorizedPaymentStatus | None = None,
    limit: int | None = None,
    offset: int | None = None,
) -> AuthorizedPaymentSearchResult

Search subscription invoices.

Search billing invoices generated by subscriptions.

Parameters:

Name Type Description Default
preapproval_id str | None

The preapproval_id value. Omitted from the query when None.

None
payment_id int | None

The payment_id value. Omitted from the query when None.

None
payer_id int | None

The payer_id value. Omitted from the query when None.

None
status AuthorizedPaymentStatus | None

The status value. Omitted from the query when None.

None
limit int | None

The limit value. Omitted from the query when None.

None
offset int | None

The offset value. Omitted from the query when None.

None

Returns:

Name Type Description
AuthorizedPaymentSearchResult AuthorizedPaymentSearchResult

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 500.

get_authorized_payment async

get_authorized_payment(id: int) -> AuthorizedPayment

Get subscription invoice.

Parameters:

Name Type Description Default
id int

The id value.

required

Returns:

Name Type Description
AuthorizedPayment AuthorizedPayment

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 500.

create_preference async

create_preference(*, body: PreferenceRequest) -> Preference

Create a preference.

Creates a Checkout Pro preference. The response contains init_point (production) and Webhook events triggered: payment, merchant_order

Parameters:

Name Type Description Default
body PreferenceRequest

The request body.

required

Returns:

Name Type Description
Preference Preference

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

search_preferences async

search_preferences(
    *,
    external_reference: str | None = None,
    marketplace: str | None = None,
    site_id: str | None = None,
    sponsor_id: int | None = None,
    limit: int | None = None,
    offset: int | None = None,
) -> SearchPreferencesResponse

Search preferences.

Parameters:

Name Type Description Default
external_reference str | None

The external_reference value. Omitted from the query when None.

None
marketplace str | None

The marketplace value. Omitted from the query when None.

None
site_id str | None

The site_id value. Omitted from the query when None.

None
sponsor_id int | None

The sponsor_id value. Omitted from the query when None.

None
limit int | None

The limit value. Omitted from the query when None.

None
offset int | None

The offset value. Omitted from the query when None.

None

Returns:

Name Type Description
SearchPreferencesResponse SearchPreferencesResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

get_preference async

get_preference(id: str) -> Preference

Get preference by ID.

Parameters:

Name Type Description Default
id str

The id value.

required

Returns:

Name Type Description
Preference Preference

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 404.

update_preference async

update_preference(id: str, *, body: PreferenceRequest) -> Preference

Update a preference.

Parameters:

Name Type Description Default
id str

The id value.

required
body PreferenceRequest

The request body.

required

Returns:

Name Type Description
Preference Preference

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400.

put_checkout_preferences_by_id_expire async

put_checkout_preferences_by_id_expire(id: int) -> Preference

Expires a Preference.

Expires a payment preference. Enter the preference ID and it will be expired.

Parameters:

Name Type Description Default
id int

Preference ID

required

Returns:

Name Type Description
Preference Preference

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 403, 404, 500.

create_qr_integrator_config async

create_qr_integrator_config(*, body: CreateQrIntegratorConfigBody) -> None

Create or update QR integrator configuration.

Configures the integrator settings for QR in-store payments.

Not routed. Probed against the sandbox and answered the way a path the API does not route answers — measured 2026-10-09, PATCH, POST and PUT on /instore/integrator all answer the edge's 404 'resource not found' with and without the sandbox token. The GET on the same path was removed on 2026-08-28.

Parameters:

Name Type Description Default
body CreateQrIntegratorConfigBody

The request body.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

confirm_cashout_qr async

confirm_cashout_qr(merchant_order_id: str, *, body: ConfirmCashoutQrBody) -> None

Confirm QR cashout status.

Confirms the cashout status for a QR-based cash withdrawal order. Available in: Argentina, Brazil (MLA, MLB)

Parameters:

Name Type Description Default
merchant_order_id str

The merchant_order_id value.

required
body ConfirmCashoutQrBody

The request body.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

create_merchant_order async

create_merchant_order(*, body: CreateMerchantOrderBody) -> CreateMerchantOrderResponse

Create a merchant order.

Webhook events triggered: merchant_order

Parameters:

Name Type Description Default
body CreateMerchantOrderBody

The request body.

required

Returns:

Name Type Description
CreateMerchantOrderResponse CreateMerchantOrderResponse

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

search_merchant_orders async

search_merchant_orders(
    *,
    status: MerchantOrderStatus | None = None,
    preference_id: str | None = None,
    application_id: str | None = None,
    payer_id: int | None = None,
    sponsor_id: int | None = None,
    external_reference: str | None = None,
    site_id: CreateMerchantOrderBodySiteId | None = None,
    marketplace: str | None = None,
    date_created_from: datetime | None = None,
    date_created_to: datetime | None = None,
    last_updated_from: datetime | None = None,
    last_updated_to: datetime | None = None,
    limit: int | None = None,
    offset: int | None = None,
) -> SearchMerchantOrdersResponse

Search merchant orders.

Parameters:

Name Type Description Default
status MerchantOrderStatus | None

The status value. Omitted from the query when None.

None
preference_id str | None

The preference_id value. Omitted from the query when None.

None
application_id str | None

The application_id value. Omitted from the query when None.

None
payer_id int | None

The payer_id value. Omitted from the query when None.

None
sponsor_id int | None

The sponsor_id value. Omitted from the query when None.

None
external_reference str | None

The external_reference value. Omitted from the query when None.

None
site_id CreateMerchantOrderBodySiteId | None

The site_id value. Omitted from the query when None.

None
marketplace str | None

The marketplace value. Omitted from the query when None.

None
date_created_from datetime | None

The date_created_from value. Omitted from the query when None.

None
date_created_to datetime | None

The date_created_to value. Omitted from the query when None.

None
last_updated_from datetime | None

The last_updated_from value. Omitted from the query when None.

None
last_updated_to datetime | None

The last_updated_to value. Omitted from the query when None.

None
limit int | None

The limit value. Omitted from the query when None.

None
offset int | None

The offset value. Omitted from the query when None.

None

Returns:

Name Type Description
SearchMerchantOrdersResponse SearchMerchantOrdersResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

get_merchant_order async

get_merchant_order(id: int) -> GetMerchantOrderResponse

Get merchant order.

Parameters:

Name Type Description Default
id int

The id value.

required

Returns:

Name Type Description
GetMerchantOrderResponse GetMerchantOrderResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404.

update_merchant_order async

update_merchant_order(id: int, *, body: UpdateMerchantOrderBody) -> None

Update merchant order.

Parameters:

Name Type Description Default
id int

The id value.

required
body UpdateMerchantOrderBody

The request body.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

create_o_auth_token async

create_o_auth_token(*, body: CreateOAuthTokenBody) -> CreateOAuthTokenResponse

Create OAuth token.

Exchanges authorization codes for access tokens, refreshes expired tokens, or requests client credentials tokens for machine-to-machine flows. Security notes: - The state parameter is mandatory for authorization_code flows to prevent CSRF. - Store refresh tokens in server-side encrypted storage — never in localStorage. - Rotate client_secret regularly and store in a secrets manager.

Parameters:

Name Type Description Default
body CreateOAuthTokenBody

The request body.

required

Returns:

Name Type Description
CreateOAuthTokenResponse CreateOAuthTokenResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 429.

list_point_devices async

list_point_devices() -> ListPointDevicesResponse

List Point devices.

Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Returns:

Name Type Description
ListPointDevicesResponse ListPointDevicesResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_point_payment_intent async

create_point_payment_intent(
    deviceid: str, *, body: CreatePointPaymentIntentBody
) -> CreatePointPaymentIntentResponse

Create a payment intent on a Point device.

Creates a payment intent that is sent to a Point POS device for the customer to tap/insert their card. The device handles card capture. Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM) Idempotent: Supports X-Idempotency-Key header to safely retry without duplicate charges. Webhook events triggered: point_integration_wh

Parameters:

Name Type Description Default
deviceid str

The deviceid value.

required
body CreatePointPaymentIntentBody

The request body.

required

Returns:

Name Type Description
CreatePointPaymentIntentResponse CreatePointPaymentIntentResponse

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400.

cancel_point_payment_intent async

cancel_point_payment_intent(deviceid: str, paymentintentid: str) -> None

Cancel a payment intent.

Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Parameters:

Name Type Description Default
deviceid str

The deviceid value.

required
paymentintentid str

The paymentintentid value.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_point_refund_intent async

create_point_refund_intent(
    deviceid: str, *, body: CreatePointRefundIntentBody
) -> CreatePointRefundIntentResponse

Create a refund intent on a terminal.

Initiates a refund intent on a Point terminal device.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
deviceid str

Terminal device identifier

required
body CreatePointRefundIntentBody

The request body.

required

Returns:

Name Type Description
CreatePointRefundIntentResponse CreatePointRefundIntentResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404.

cancel_point_refund_intent async

cancel_point_refund_intent(deviceid: str, refundintentid: str) -> None

Cancel a refund intent on a terminal.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
deviceid str

The deviceid value.

required
refundintentid str

The refundintentid value.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

get_point_payment_intent async

get_point_payment_intent(paymentintentid: str) -> None

Get payment intent details.

Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Parameters:

Name Type Description Default
paymentintentid str

The paymentintentid value.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

get_point_refund_intent async

get_point_refund_intent(refundintentid: str) -> GetPointRefundIntentResponse

Get a refund intent status.

Parameters:

Name Type Description Default
refundintentid str

Refund intent identifier

required

Returns:

Name Type Description
GetPointRefundIntentResponse GetPointRefundIntentResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

search_pos async

search_pos(
    *,
    external_id: str | None = None,
    external_store_id: str | None = None,
    store_id: str | None = None,
    category: int | None = None,
) -> SearchPosResponse

Search points of sale.

Parameters:

Name Type Description Default
external_id str | None

The external_id value. Omitted from the query when None.

None
external_store_id str | None

The external_store_id value. Omitted from the query when None.

None
store_id str | None

The store_id value. Omitted from the query when None.

None
category int | None

The category value. Omitted from the query when None.

None

Returns:

Name Type Description
SearchPosResponse SearchPosResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_pos async

create_pos(*, body: PosRequest) -> Pos

Create a point of sale.

Creates a point of sale in a store to receive payments for products or services. Each POS will have a unique QR code linked to it.

Parameters:

Name Type Description Default
body PosRequest

The request body.

required

Returns:

Name Type Description
Pos Pos

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

get_pos async

get_pos(id: str) -> Pos

Get a point of sale.

Parameters:

Name Type Description Default
id str

POS identifier

required

Returns:

Name Type Description
Pos Pos

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

update_pos async

update_pos(id: str, *, body: PosRequest) -> Pos

Update a point of sale.

Parameters:

Name Type Description Default
id str

The id value.

required
body PosRequest

The request body.

required

Returns:

Name Type Description
Pos Pos

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

delete_pos async

delete_pos(id: str) -> None

Delete a point of sale.

Parameters:

Name Type Description Default
id str

POS identifier to delete

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

search_claims async

search_claims(
    *,
    id: int | None = None,
    type: ClaimType | None = None,
    stage: ClaimStage | None = None,
    status: ClaimStatus | None = None,
    limit: int | None = None,
    offset: int | None = None,
) -> ClaimSearchResult

Search claims.

Parameters:

Name Type Description Default
id int | None

The id value. Omitted from the query when None.

None
type ClaimType | None

The type value. Omitted from the query when None.

None
stage ClaimStage | None

The stage value. Omitted from the query when None.

None
status ClaimStatus | None

The status value. Omitted from the query when None.

None
limit int | None

The limit value. Omitted from the query when None.

None
offset int | None

The offset value. Omitted from the query when None.

None

Returns:

Name Type Description
ClaimSearchResult ClaimSearchResult

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 401.

get_claim async

get_claim(claim_id: int) -> Claim

Get claim details.

Returns full details of a post-sale claim including status, stage, and players.

Parameters:

Name Type Description Default
claim_id int

The claim_id value.

required

Returns:

Name Type Description
Claim Claim

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 401, 404.

upload_shipping_evidence async

upload_shipping_evidence(claim_id: int, *, body: UploadShippingEvidenceBody) -> None

Upload shipping evidence.

Uploads shipping evidence (tracking code, proof of delivery) to support the seller's case in a claim. Accepted as part of the claims resolution process.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
claim_id int

The claim_id value.

required
body UploadShippingEvidenceBody

The request body.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 201 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

request_claim_mediation async

request_claim_mediation(claim_id: int) -> None

Request claim mediation.

Escalates a claim to mediation, requesting MP to intervene in the dispute.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
claim_id int

The claim_id value.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

send_claim_message async

send_claim_message(
    claim_id: int, *, body: SendMessageRequest, application_id: str | None = None
) -> None

Send a message in a claim.

Sends a text message (with optional attachments) in the claim thread.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
claim_id int

The claim_id value.

required
body SendMessageRequest

The request body.

required
application_id str | None

The application_id value. Omitted from the query when None.

None

Returns:

Name Type Description
None None

Nothing — the operation answers 201 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 429.

attach_claim_file async

attach_claim_file(claim_id: int, *, file: bytes) -> AttachClaimFileResponse

Attach a file to a claim message.

Uploads and attaches a file (image, PDF) to a claim. Supported formats: JPEG, PNG, PDF. Max size: 10 MB.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
claim_id int

The claim_id value.

required
file bytes

File to attach (JPEG, PNG, or PDF, max 10 MB)

required

Returns:

Name Type Description
AttachClaimFileResponse AttachClaimFileResponse

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

get_claim_file async

get_claim_file(claim_id: int, file_name: str) -> GetClaimFileResponse

Get attached file metadata.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
claim_id int

The claim_id value.

required
file_name str

The fileName value.

required

Returns:

Name Type Description
GetClaimFileResponse GetClaimFileResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

download_claim_file async

download_claim_file(claim_id: int, file_name: str) -> bytes

Download an attached file.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
claim_id int

The claim_id value.

required
file_name str

The fileName value.

required

Returns:

Name Type Description
bytes bytes

The 200 response body, undecoded — the operation answers application/octet-stream, which is handed over as bytes rather than parsed.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

get_claim_evidence async

get_claim_evidence(claim_id: int) -> list[ClaimEvidence]

Get claim evidence.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
claim_id int

The claim_id value.

required

Returns:

Type Description
list[ClaimEvidence]

list[ClaimEvidence]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

get_claim_mediation_resolutions async

get_claim_mediation_resolutions(claim_id: int) -> list[MediationResolution]

Get expected mediation resolutions.

Returns the possible resolution options for a claim at the mediation stage.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
claim_id int

The claim_id value.

required

Returns:

Type Description
list[MediationResolution]

list[MediationResolution]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

get_claim_messages async

get_claim_messages(claim_id: int) -> list[ClaimMessage]

Get claim messages.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
claim_id int

The claim_id value.

required

Returns:

Type Description
list[ClaimMessage]

list[ClaimMessage]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

get_claim_history async

get_claim_history(claim_id: int) -> list[ClaimHistoryEntry]

Get claim status history.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
claim_id int

The claim_id value.

required

Returns:

Type Description
list[ClaimHistoryEntry]

list[ClaimHistoryEntry]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_subscription async

create_subscription(*, body: SubscriptionRequest) -> Subscription

Create a subscription.

Parameters:

Name Type Description Default
body SubscriptionRequest

The request body.

required

Returns:

Name Type Description
Subscription Subscription

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 403, 500.

export_subscriptions async

export_subscriptions(
    *,
    collector_id: int,
    preapproval_plan_id: str | None = None,
    status: SubscriptionRequestStatus | None = None,
    sort: ExportSubscriptionsSort | None = None,
) -> bytes

Export subscriptions.

Exports a list of subscriptions for a collector as a downloadable file. Filter by plan ID, status, and sort order.

Parameters:

Name Type Description Default
collector_id int

Collector (seller) user ID

required
preapproval_plan_id str | None

Filter by plan ID. Omitted from the query when None.

None
status SubscriptionRequestStatus | None

The status value. Omitted from the query when None.

None
sort ExportSubscriptionsSort | None

The sort value. Omitted from the query when None.

None

Returns:

Name Type Description
bytes bytes

The 200 response body, undecoded — the operation answers text/csv, which is handed over as bytes rather than parsed.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

search_subscriptions async

search_subscriptions(
    *,
    q: str | None = None,
    payer_id: int | None = None,
    payer_email: EmailStr | None = None,
    preapproval_plan_id: str | None = None,
    transaction_amount: float | None = None,
    semaphore: str | None = None,
    status: SubscriptionRequestStatus | None = None,
    sort: str | None = None,
    limit: int | None = None,
    offset: int | None = None,
) -> SubscriptionSearchResult

Search subscriptions.

Parameters:

Name Type Description Default
q str | None

The q value. Omitted from the query when None.

None
payer_id int | None

The payer_id value. Omitted from the query when None.

None
payer_email EmailStr | None

The payer_email value. Omitted from the query when None.

None
preapproval_plan_id str | None

The preapproval_plan_id value. Omitted from the query when None.

None
transaction_amount float | None

The transaction_amount value. Omitted from the query when None.

None
semaphore str | None

The semaphore value. Omitted from the query when None.

None
status SubscriptionRequestStatus | None

The status value. Omitted from the query when None.

None
sort str | None

The sort value. Omitted from the query when None.

None
limit int | None

The limit value. Omitted from the query when None.

None
offset int | None

The offset value. Omitted from the query when None.

None

Returns:

Name Type Description
SubscriptionSearchResult SubscriptionSearchResult

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 500.

get_subscription async

get_subscription(id: str) -> Subscription

Get subscription.

Parameters:

Name Type Description Default
id str

The id value.

required

Returns:

Name Type Description
Subscription Subscription

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 403, 404, 500.

update_subscription async

update_subscription(id: str, *, body: SubscriptionUpdateRequest) -> Subscription

Update subscription.

Update subscription status or billing details. Common use: {"status": "paused"} to pause, {"status": "authorized"} to resume, {"status": "cancelled"} to cancel.

Parameters:

Name Type Description Default
id str

The id value.

required
body SubscriptionUpdateRequest

The request body.

required

Returns:

Name Type Description
Subscription Subscription

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 500.

create_subscription_plan async

create_subscription_plan(*, body: SubscriptionPlanRequest) -> SubscriptionPlan

Create a subscription plan.

Creates a recurring billing plan. Individual subscriptions reference this plan. The response includes init_point to send subscribers to authorize billing.

Parameters:

Name Type Description Default
body SubscriptionPlanRequest

The request body.

required

Returns:

Name Type Description
SubscriptionPlan SubscriptionPlan

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404, 500.

search_subscription_plans async

search_subscription_plans(
    *,
    status: SubscriptionPlanStatus | None = None,
    q: str | None = None,
    sort: str | None = None,
    criteria: SearchSubscriptionPlansCriteria | None = None,
    limit: int | None = None,
    offset: int | None = None,
) -> SubscriptionSearchResult

Search subscription plans.

Parameters:

Name Type Description Default
status SubscriptionPlanStatus | None

The status value. Omitted from the query when None.

None
q str | None

The q value. Omitted from the query when None.

None
sort str | None

The sort value. Omitted from the query when None.

None
criteria SearchSubscriptionPlansCriteria | None

The criteria value. Omitted from the query when None.

None
limit int | None

The limit value. Omitted from the query when None.

None
offset int | None

The offset value. Omitted from the query when None.

None

Returns:

Name Type Description
SubscriptionSearchResult SubscriptionSearchResult

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 500.

get_subscription_plan async

get_subscription_plan(id: str) -> SubscriptionPlan

Get subscription plan.

Parameters:

Name Type Description Default
id str

The id value.

required

Returns:

Name Type Description
SubscriptionPlan SubscriptionPlan

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 401, 404, 500.

update_subscription_plan async

update_subscription_plan(id: str, *, body: SubscriptionPlanRequest) -> SubscriptionPlan

Update a subscription plan.

Parameters:

Name Type Description Default
id str

The id value.

required
body SubscriptionPlanRequest

The request body.

required

Returns:

Name Type Description
SubscriptionPlan SubscriptionPlan

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404, 500.

create_terminal_action async

create_terminal_action(
    *, body: CreateTerminalActionBody
) -> CreateTerminalActionResponse

Create a terminal print action.

Sends a print action to a Point terminal — either a receipt image or a DTE (electronic tax document, available in Chile/MLC only). Set type to PRINT_INFO for image printing or PRINT_DTE for DTE. Available in: Argentina, Brazil, Chile, Mexico (MLA, MLB, MLC, MLM)

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
body CreateTerminalActionBody

The request body.

required

Returns:

Name Type Description
CreateTerminalActionResponse CreateTerminalActionResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 429.

get_terminal_action async

get_terminal_action(action_id: str) -> GetTerminalActionResponse

Get terminal action status.

Available in: Argentina, Brazil, Chile, Mexico (MLA, MLB, MLC, MLM)

Parameters:

Name Type Description Default
action_id str

The action_id value.

required

Returns:

Name Type Description
GetTerminalActionResponse GetTerminalActionResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

cancel_terminal_action async

cancel_terminal_action(action_id: str) -> None

Cancel a terminal action.

Available in: Argentina, Brazil, Chile, Mexico (MLA, MLB, MLC, MLM)

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
action_id str

The action_id value.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

list_terminals async

list_terminals() -> ListTerminalsResponse

Get list of terminals.

Returns all Point hardware terminals registered to the account. Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Returns:

Name Type Description
ListTerminalsResponse ListTerminalsResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 401.

update_terminal_operation_mode async

update_terminal_operation_mode(*, body: UpdateTerminalOperationModeBody) -> None

Update terminal operation mode.

Changes the operating mode of one or more terminals. PDV — integrated POS mode (connected to your system); STANDALONE — independent mode (no system integration). Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
body UpdateTerminalOperationModeBody

The request body.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 429.

get_authenticated_user async

get_authenticated_user() -> AuthenticatedUser

Get the authenticated user.

Returns the account the credentials belong to.

Absent from the vendored document. The response is modelled from the one the sandbox returned on 2026-10-09: every declared field was observed, none is required, and fields not declared are kept as extra fields rather than dropped.

Declared by scripts/mercadopago_overlay.py from mercadopago 3.5.0 resources/user.py:get.

Returns:

Name Type Description
AuthenticatedUser AuthenticatedUser

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

list_pos async

list_pos(user_id: int) -> None

List POS devices for a user.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
user_id int

The user_id value.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_store async

create_store(user_id: int, *, body: CreateStoreBody) -> None

Create a store.

Parameters:

Name Type Description Default
user_id int

The user_id value.

required
body CreateStoreBody

The request body.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 201 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

search_stores async

search_stores(user_id: int, *, external_id: str | None = None) -> SearchStoresResponse

Search stores.

Parameters:

Name Type Description Default
user_id int

The user_id value.

required
external_id str | None

Filter by your external store ID. Omitted from the query when None.

None

Returns:

Name Type Description
SearchStoresResponse SearchStoresResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

update_store async

update_store(user_id: int, id: str, *, body: StoreRequest) -> Store

Update a store.

Parameters:

Name Type Description Default
user_id int

The user_id value.

required
id str

The id value.

required
body StoreRequest

The request body.

required

Returns:

Name Type Description
Store Store

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

delete_store async

delete_store(user_id: int, id: str) -> None

Delete a store.

Parameters:

Name Type Description Default
user_id int

The user_id value.

required
id str

The id value.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

get_release_report async

get_release_report() -> ReportListResult

Get releases report list.

Not routed. Probed against the sandbox and answered the way a path the API does not route answers — measured 2026-10-10 with a test seller's token, GET answers 405 'Method GET is not supported' while /v1/account/release_report/list and /search answer 200.

Returns:

Name Type Description
ReportListResult ReportListResult

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_release_report async

create_release_report(*, body: ReportRequest) -> ReportTask

Create a releases report.

Generates a one-time releases report for the specified date range. Returns a task ID to poll for completion via the task endpoint.

Parameters:

Name Type Description Default
body ReportRequest

The request body.

required

Returns:

Name Type Description
ReportTask ReportTask

The 202 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 429.

get_release_report_config async

get_release_report_config() -> ReportConfig

Get releases report configuration.

Returns:

Name Type Description
ReportConfig ReportConfig

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_release_report_config async

create_release_report_config(*, body: ReportConfig) -> ReportConfig

Create releases report configuration.

Creates the configuration for automatic releases report generation. Defines columns, schedule frequency, file format, and optional SFTP delivery.

Parameters:

Name Type Description Default
body ReportConfig

The request body.

required

Returns:

Name Type Description
ReportConfig ReportConfig

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 429.

update_release_report_config async

update_release_report_config(*, body: ReportConfig) -> ReportConfig

Update releases report configuration.

Parameters:

Name Type Description Default
body ReportConfig

The request body.

required

Returns:

Name Type Description
ReportConfig ReportConfig

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

list_scheduled_release_reports async

list_scheduled_release_reports() -> ReportListResult

List scheduled releases reports.

Returns:

Name Type Description
ReportListResult ReportListResult

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

enable_release_report_schedule async

enable_release_report_schedule() -> None

Enable automatic releases report generation.

Enables scheduled report generation based on the configured frequency.

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 401.

disable_release_report_schedule async

disable_release_report_schedule() -> None

Disable automatic releases report generation.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

search_release_reports async

search_release_reports(
    *, begin_date: datetime | None = None, end_date: datetime | None = None
) -> ReportListResult

Search releases reports.

Parameters:

Name Type Description Default
begin_date datetime | None

The begin_date value. Omitted from the query when None.

None
end_date datetime | None

The end_date value. Omitted from the query when None.

None

Returns:

Name Type Description
ReportListResult ReportListResult

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

get_release_report_task async

get_release_report_task(task_id: str) -> ReportTask

Get releases report task status.

Polls the status of a report generation task. Check until status=done.

Parameters:

Name Type Description Default
task_id str

The task_id value.

required

Returns:

Name Type Description
ReportTask ReportTask

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

download_release_report async

download_release_report(file_name: str) -> bytes

Download a releases report file.

Downloads the generated report CSV file by filename.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
file_name str

The file_name value.

required

Returns:

Name Type Description
bytes bytes

The 200 response body, undecoded — the operation answers text/csv, which is handed over as bytes rather than parsed.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

get_settlement_report async

get_settlement_report() -> ReportListResult

Get settlements report list.

Not routed. Probed against the sandbox and answered the way a path the API does not route answers — measured 2026-10-10 with a test seller's token, GET answers 404 'Resource /account/settlement_report not found.' while /v1/account/settlement_report/list and /search answer 200.

Returns:

Name Type Description
ReportListResult ReportListResult

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_settlement_report async

create_settlement_report(*, body: ReportRequest) -> ReportTask

Create a settlements report.

Generates a one-time all-transactions report for the specified date range. Returns a task ID to poll for completion.

Parameters:

Name Type Description Default
body ReportRequest

The request body.

required

Returns:

Name Type Description
ReportTask ReportTask

The 202 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 429.

get_settlement_report_config async

get_settlement_report_config() -> ReportConfig

Get settlements report configuration.

Returns:

Name Type Description
ReportConfig ReportConfig

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_settlement_report_config async

create_settlement_report_config(*, body: ReportConfig) -> ReportConfig

Create settlements report configuration.

Creates the configuration for automatic all-transactions (settlements) report generation. Defines columns, schedule frequency, file format, and optional SFTP delivery.

Parameters:

Name Type Description Default
body ReportConfig

The request body.

required

Returns:

Name Type Description
ReportConfig ReportConfig

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 429.

update_settlement_report_config async

update_settlement_report_config(*, body: ReportConfig) -> ReportConfig

Update settlements report configuration.

Parameters:

Name Type Description Default
body ReportConfig

The request body.

required

Returns:

Name Type Description
ReportConfig ReportConfig

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

list_scheduled_settlement_reports async

list_scheduled_settlement_reports() -> ReportListResult

List scheduled settlements reports.

Returns:

Name Type Description
ReportListResult ReportListResult

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

enable_settlement_report_schedule async

enable_settlement_report_schedule() -> None

Enable automatic settlements report generation.

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

disable_settlement_report_schedule async

disable_settlement_report_schedule() -> None

Disable automatic settlements report generation.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

search_settlement_reports async

search_settlement_reports(
    *, begin_date: datetime | None = None, end_date: datetime | None = None
) -> ReportListResult

Search settlements reports.

Parameters:

Name Type Description Default
begin_date datetime | None

The begin_date value. Omitted from the query when None.

None
end_date datetime | None

The end_date value. Omitted from the query when None.

None

Returns:

Name Type Description
ReportListResult ReportListResult

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

get_settlement_report_task async

get_settlement_report_task(task_id: str) -> ReportTask

Get settlements report task status.

Parameters:

Name Type Description Default
task_id str

The task_id value.

required

Returns:

Name Type Description
ReportTask ReportTask

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

download_settlement_report async

download_settlement_report(file_name: str) -> bytes

Download a settlements report file.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
file_name str

The file_name value.

required

Returns:

Name Type Description
bytes bytes

The 200 response body, undecoded — the operation answers text/csv, which is handed over as bytes rather than parsed.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

create_advanced_payment async

create_advanced_payment(
    *,
    body: CreateAdvancedPaymentBody,
    x_idempotency_key: UUID,
    x_meli_session_id: str | None = None,
) -> CreateAdvancedPaymentResponse

Create an advanced payment.

Creates a Wallet Connect advanced payment (marketplace split payment).

Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Parameters:

Name Type Description Default
body CreateAdvancedPaymentBody

The request body.

required
x_idempotency_key UUID

The X-Idempotency-Key value.

required
x_meli_session_id str | None

The X-Meli-Session-Id value. Omitted from the request headers when None.

None

Returns:

Name Type Description
CreateAdvancedPaymentResponse CreateAdvancedPaymentResponse

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 500.

search_advanced_payments async

search_advanced_payments(
    *, limit: int | None = None, offset: int | None = None
) -> dict[str, Any]

Search advanced payments.

Searches advanced payments matching the given filters.

Absent from the vendored document. limit and offset are declared because every other search in this document declares them — that is this document's convention, not a measurement. The remaining filters and the response are not modelled.

Declared by scripts/mercadopago_overlay.py from mercadopago 3.5.0 resources/advanced_payment.py:search.

Parameters:

Name Type Description Default
limit int | None

The limit value. Omitted from the query when None.

None
offset int | None

The offset value. Omitted from the query when None.

None

Returns:

Type Description
dict[str, Any]

dict[str, Any]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

get_advanced_payment async

get_advanced_payment(advanced_payment_id: int) -> GetAdvancedPaymentResponse

Get an advanced payment.

Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Parameters:

Name Type Description Default
advanced_payment_id int

The advanced_payment_id value.

required

Returns:

Name Type Description
GetAdvancedPaymentResponse GetAdvancedPaymentResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404, 500.

update_advanced_payment async

update_advanced_payment(
    advanced_payment_id: int, *, body: UpdateAdvancedPaymentBody
) -> UpdateAdvancedPaymentResponse

Capture or cancel an advanced payment.

Capture (capture=true) or cancel (status=cancelled).

Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Parameters:

Name Type Description Default
advanced_payment_id int

The advanced_payment_id value.

required
body UpdateAdvancedPaymentBody

The request body.

required

Returns:

Name Type Description
UpdateAdvancedPaymentResponse UpdateAdvancedPaymentResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404, 500.

create_disbursement_refund async

create_disbursement_refund(
    advanced_payment_id: str, disbursement_id: str, *, body: dict[str, Any]
) -> dict[str, Any]

Refund one disbursement of an advanced payment.

Refunds a single disbursement, in full or by amount.

Absent from the vendored document, and built through a local variable in the SDK. Neither the body nor the response is modelled.

Declared by scripts/mercadopago_overlay.py from mercadopago 3.5.0 resources/disbursement_refund.py:create.

Parameters:

Name Type Description Default
advanced_payment_id str

The advanced_payment_id value.

required
disbursement_id str

The disbursement_id value.

required
body dict[str, Any]

The request body.

required

Returns:

Type Description
dict[str, Any]

dict[str, Any]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

update_advanced_payment_release_date async

update_advanced_payment_release_date(
    advanced_payment_id: str, *, body: dict[str, Any]
) -> dict[str, Any]

Update the release date of a disbursement.

Moves the money release date of an advanced payment's disbursements.

Absent from the vendored document. Neither the body nor the response is modelled.

Declared by scripts/mercadopago_overlay.py from mercadopago 3.5.0 resources/advanced_payment.py:update_release_date.

Parameters:

Name Type Description Default
advanced_payment_id str

The advanced_payment_id value.

required
body dict[str, Any]

The request body.

required

Returns:

Type Description
dict[str, Any]

dict[str, Any]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

list_disbursement_refunds async

list_disbursement_refunds(advanced_payment_id: str) -> dict[str, Any]

List the refunds of an advanced payment.

Lists every disbursement refund of one advanced payment.

Absent from the vendored document, and invisible to a reader that only follows literal arguments: the SDK builds this URL through a local variable. The response is not modelled.

Declared by scripts/mercadopago_overlay.py from mercadopago 3.5.0 resources/disbursement_refund.py:list_all.

Parameters:

Name Type Description Default
advanced_payment_id str

The advanced_payment_id value.

required

Returns:

Type Description
dict[str, Any]

dict[str, Any]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_disbursement_refunds async

create_disbursement_refunds(
    advanced_payment_id: str, *, body: dict[str, Any]
) -> dict[str, Any]

Refund an advanced payment.

Creates a refund covering the advanced payment's disbursements.

Absent from the vendored document. Neither the body nor the response is modelled — nobody here has credentials to observe either — so both are dict[str, Any].

Declared by scripts/mercadopago_overlay.py from mercadopago 3.5.0 resources/disbursement_refund.py:create_all.

Parameters:

Name Type Description Default
advanced_payment_id str

The advanced_payment_id value.

required
body dict[str, Any]

The request body.

required

Returns:

Type Description
dict[str, Any]

dict[str, Any]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_card_token async

create_card_token(*, body: CardTokenRequest) -> CardToken

Create a card token (client-side only).

CLIENT-SIDE ONLY. Creates a single-use card token from raw card data. Call this from your frontend using MercadoPago.js with the PUBLIC_KEY. Never call this endpoint server-side — doing so puts raw PAN and CVV on your server and brings your integration into full PCI DSS scope. PCI scope: Handling this endpoint brings your integration into PCI DSS scope. Auth note: Use PUBLIC_KEY for this endpoint (not ACCESS_TOKEN). Public key is safe in frontend code. Using ACCESS_TOKEN here from the browser exposes your server credentials.

Parameters:

Name Type Description Default
body CardTokenRequest

The request body.

required

Returns:

Name Type Description
CardToken CardToken

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400.

get_card_token async

get_card_token(id: str) -> CardToken

Get a card token.

PCI scope: Handling this endpoint brings your integration into PCI DSS scope.

Parameters:

Name Type Description Default
id str

The id value.

required

Returns:

Name Type Description
CardToken CardToken

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

search_chargebacks async

search_chargebacks(*, payment_id: str) -> ChargebackSearchResponse

Search chargebacks.

Searches the chargebacks of one payment.

Absent from the vendored document. Measured on 2026-10-10 with a test seller's token: without payment_id the call answers 400 Wrong parameters in Search Cases (also with only limit and offset, or only a date filter); with it, 200 and the paging envelope modelled here. limit=10 came back as paging.limit 25, so limit and offset are not declared. The items of results were never observed — every search returned none — and stay untyped.

Declared by scripts/mercadopago_overlay.py from mercadopago 3.5.0 resources/chargeback.py:search.

Parameters:

Name Type Description Default
payment_id str

The payment_id value.

required

Returns:

Name Type Description
ChargebackSearchResponse ChargebackSearchResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

get_chargeback async

get_chargeback(id: str) -> GetChargebackResponse

Get chargeback by ID.

Parameters:

Name Type Description Default
id str

The id value.

required

Returns:

Name Type Description
GetChargebackResponse GetChargebackResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

update_chargeback async

update_chargeback(id: str, *, body: UpdateChargebackBody) -> None

Upload chargeback documentation.

Not routed. Probed against the sandbox and answered the way a path the API does not route answers — measured 2026-10-09, PUT /v1/chargebacks/ answers 404 'Request method 'PUT' is not supported' with and without the sandbox token — the chargebacks service itself names the verb. mercadopago 3.5.0 chargeback.py calls only search and get.

Parameters:

Name Type Description Default
id str

The id value.

required
body UpdateChargebackBody

The request body.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_customer async

create_customer(*, body: CustomerRequest) -> Customer

Create a customer.

Creates a customer profile for storing payment methods. The customer email is unique per account.

Parameters:

Name Type Description Default
body CustomerRequest

The request body.

required

Returns:

Name Type Description
Customer Customer

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

search_customers async

search_customers(
    *,
    email: EmailStr | None = None,
    limit: int | None = None,
    offset: int | None = None,
) -> CustomerSearchResult

Search customers.

Parameters:

Name Type Description Default
email EmailStr | None

The email value. Omitted from the query when None.

None
limit int | None

The limit value. Omitted from the query when None.

None
offset int | None

The offset value. Omitted from the query when None.

None

Returns:

Name Type Description
CustomerSearchResult CustomerSearchResult

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

list_customer_addresses async

list_customer_addresses(customer_id: str) -> list[Address]

List customer addresses.

Parameters:

Name Type Description Default
customer_id str

The customer_id value.

required

Returns:

Type Description
list[Address]

list[Address]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 401.

create_customer_address async

create_customer_address(customer_id: str, *, body: Address) -> Address

Create a customer address.

Adds a shipping or billing address to a customer profile.

Parameters:

Name Type Description Default
customer_id str

The customer_id value.

required
body Address

The request body.

required

Returns:

Name Type Description
Address Address

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 429.

get_customer_address async

get_customer_address(customer_id: str, address_id: str) -> Address

Get a customer address.

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
customer_id str

The customer_id value.

required
address_id str

The address_id value.

required

Returns:

Name Type Description
Address Address

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

update_customer_address async

update_customer_address(customer_id: str, address_id: str, *, body: Address) -> Address

Update a customer address.

Parameters:

Name Type Description Default
customer_id str

The customer_id value.

required
address_id str

The address_id value.

required
body Address

The request body.

required

Returns:

Name Type Description
Address Address

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

delete_customer_address async

delete_customer_address(customer_id: str, address_id: str) -> None

Delete a customer address.

Parameters:

Name Type Description Default
customer_id str

The customer_id value.

required
address_id str

The address_id value.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 404.

list_cards async

list_cards(customer_id: str) -> list[Card]

List customer cards.

Parameters:

Name Type Description Default
customer_id str

The customer_id value.

required

Returns:

Type Description
list[Card]

list[Card]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

save_card async

save_card(customer_id: str, *, body: SaveCardRequest) -> Card

Save a card to a customer.

Saves a tokenized card to a customer profile for future payments. The token must be created client-side via MercadoPago.js. Raw card data must never pass through your server. PCI scope: Handling this endpoint brings your integration into PCI DSS scope.

Parameters:

Name Type Description Default
customer_id str

The customer_id value.

required
body SaveCardRequest

The request body.

required

Returns:

Name Type Description
Card Card

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

get_card async

get_card(customer_id: str, id: str) -> Card

Get a saved card.

Parameters:

Name Type Description Default
customer_id str

The customer_id value.

required
id str

The id value.

required

Returns:

Name Type Description
Card Card

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404.

update_card async

update_card(customer_id: str, id: str, *, body: UpdateCardRequest) -> Card

Update a saved card.

Parameters:

Name Type Description Default
customer_id str

The customer_id value.

required
id str

The id value.

required
body UpdateCardRequest

The request body.

required

Returns:

Name Type Description
Card Card

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404.

delete_card async

delete_card(customer_id: str, id: str) -> Card

Delete a saved card.

Parameters:

Name Type Description Default
customer_id str

The customer_id value.

required
id str

The id value.

required

Returns:

Name Type Description
Card Card

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404.

get_customer async

get_customer(id: str) -> Customer

Get customer by ID.

Parameters:

Name Type Description Default
id str

The id value.

required

Returns:

Name Type Description
Customer Customer

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404.

update_customer async

update_customer(id: str, *, body: CustomerRequest) -> Customer

Update a customer.

Parameters:

Name Type Description Default
id str

The id value.

required
body CustomerRequest

The request body.

required

Returns:

Name Type Description
Customer Customer

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404.

delete_customer async

delete_customer(id: str) -> Customer

Delete a customer.

Permanently deletes a customer profile. This action cannot be undone. Saved cards associated with the customer will also be removed.

Parameters:

Name Type Description Default
id str

Customer ID to delete

required

Returns:

Name Type Description
Customer Customer

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 401, 404.

list_identification_types async

list_identification_types() -> list[ListIdentificationTypesResponseItem]

List identification types.

Returns valid ID document types for the credential's site_id. Examples: CPF/CNPJ (Brazil), DNI/CUIL/CUIT (Argentina), RFC/CURP (Mexico). Use this to populate identification type selectors and validate inputs.

Returns:

Type Description
list[ListIdentificationTypesResponseItem]

list[ListIdentificationTypesResponseItem]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404.

search_orders async

search_orders(
    *,
    begin_date: datetime,
    end_date: datetime,
    external_reference: str | None = None,
    type: OrderRequestType | None = None,
    status: OrderStatus | None = None,
    limit: int | None = None,
    offset: int | None = None,
) -> OrderSearchResult

Search orders.

Search for orders using date range and optional filters. begin_date and end_date are required.

Parameters:

Name Type Description Default
begin_date datetime

Start of date range (ISO 8601)

required
end_date datetime

End of date range (ISO 8601)

required
external_reference str | None

The external_reference value. Omitted from the query when None.

None
type OrderRequestType | None

The type value. Omitted from the query when None.

None
status OrderStatus | None

The status value. Omitted from the query when None.

None
limit int | None

The limit value. Omitted from the query when None.

None
offset int | None

The offset value. Omitted from the query when None.

None

Returns:

Name Type Description
OrderSearchResult OrderSearchResult

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401.

create_order async

create_order(*, body: OrderRequest, x_idempotency_key: UUID) -> Order

Create an order.

Creates an Order for processing payment transactions. Supports automatic (single-stage, set processing_mode=automatic) and manual (multi-stage, set processing_mode=manual) modes.

In automatic mode, include the transactions.payments array with the payment method. In manual mode, omit transactions and add them later via POST /v1/orders/{id}/transactions, then trigger processing with POST /v1/orders/{id}/process.

Available for: credit card, debit card, Pix (MLB), Boleto (MLB), OXXO (MLM), SPEI (MLM), PSE (MCO), Rapipago (MLA), Pago Fácil (MLA).

Parameters:

Name Type Description Default
body OrderRequest

The request body.

required
x_idempotency_key UUID

Unique key per order creation attempt. Prevents duplicate orders on retry.

required

Returns:

Name Type Description
Order Order

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 422, 423, 500.

get_order async

get_order(id: str) -> Order

Get order by ID.

Returns all order information for the given order ID.

Parameters:

Name Type Description Default
id str

Order ID

required

Returns:

Name Type Description
Order Order

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404.

cancel_order async

cancel_order(order_id: str, *, x_idempotency_key: UUID) -> Order

Cancel an order.

Cancels an order and all its transactions. Only orders with status=action_required or status=created can be canceled.

Parameters:

Name Type Description Default
order_id str

The order_id value.

required
x_idempotency_key UUID

The X-Idempotency-Key value.

required

Returns:

Name Type Description
Order Order

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404, 409.

capture_order async

capture_order(order_id: str, *, x_idempotency_key: UUID) -> CaptureOrderResponse

Capture an authorized order.

Fully captures a previously authorized order (capture_mode=manual). All associated authorized transactions are captured in full.

Parameters:

Name Type Description Default
order_id str

The order_id value.

required
x_idempotency_key UUID

The X-Idempotency-Key value.

required

Returns:

Name Type Description
CaptureOrderResponse CaptureOrderResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404, 409.

process_order async

process_order(order_id: str, *, x_idempotency_key: UUID) -> Order

Process an order.

Triggers processing of an order and all its transactions. Only available for manual-mode orders (processing_mode=manual). After calling this endpoint the order transitions to processed or action_required.

Parameters:

Name Type Description Default
order_id str

The order_id value.

required
x_idempotency_key UUID

The X-Idempotency-Key value.

required

Returns:

Name Type Description
Order Order

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404, 409.

refund_order async

refund_order(
    order_id: str, *, body: OrderRefundRequest | None = None, x_idempotency_key: UUID
) -> RefundOrderResponse

Refund an order.

Performs a full or partial refund of transactions associated with an order. For a full refund, send an empty request body (omit transactions). For a partial refund, include the transactions array with the specific transaction IDs and amounts to refund.

Parameters:

Name Type Description Default
order_id str

The order_id value.

required
body OrderRefundRequest

The request body. Optional.

None
x_idempotency_key UUID

The X-Idempotency-Key value.

required

Returns:

Name Type Description
RefundOrderResponse RefundOrderResponse

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404, 409.

add_order_transaction async

add_order_transaction(
    order_id: str, *, body: AddOrderTransactionBody, x_idempotency_key: UUID
) -> AddOrderTransactionResponse

Add a transaction to an order.

Adds a payment transaction to an order. Only available when processing_mode=manual. The order must be in status=created.

Parameters:

Name Type Description Default
order_id str

The order_id value.

required
body AddOrderTransactionBody

The request body.

required
x_idempotency_key UUID

The X-Idempotency-Key value.

required

Returns:

Name Type Description
AddOrderTransactionResponse AddOrderTransactionResponse

The 201 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404, 422.

update_order_transaction async

update_order_transaction(
    order_id: str,
    transaction_id: str,
    *,
    body: UpdateOrderTransactionBody,
    x_idempotency_key: UUID,
) -> OrderTransactionPayment

Update a transaction on an order.

Updates the payment method of a pending transaction on a manual-mode order.

Parameters:

Name Type Description Default
order_id str

The order_id value.

required
transaction_id str

The transaction_id value.

required
body UpdateOrderTransactionBody

The request body.

required
x_idempotency_key UUID

The X-Idempotency-Key value.

required

Returns:

Name Type Description
OrderTransactionPayment OrderTransactionPayment

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404.

delete_order_transaction async

delete_order_transaction(order_id: str, transaction_id: str) -> None

Delete a transaction from an order.

Removes a transaction from a manual-mode order. Only available before processing.

Parameters:

Name Type Description Default
order_id str

The order_id value.

required
transaction_id str

The transaction_id value.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 204 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404.

list_payment_methods async

list_payment_methods() -> list[ListPaymentMethodsResponseItem]

List available payment methods.

Returns all payment methods available for the credential's site_id. Use this to build payment method selectors and validate method availability before attempting a payment.

Returns:

Type Description
list[ListPaymentMethodsResponseItem]

list[ListPaymentMethodsResponseItem]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 404.

get_installments async

get_installments(
    *,
    payment_method_id: str,
    amount: float,
    issuer_id: str | None = None,
    bin: str | None = None,
) -> list[GetInstallmentsResponseItem]

Get installment options.

Returns available installment plans for a given card BIN, amount, and site. Use this to populate installment selectors in your checkout.

Parameters:

Name Type Description Default
payment_method_id str

The payment_method_id value.

required
amount float

The amount value.

required
issuer_id str | None

The issuer_id value. Omitted from the query when None.

None
bin str | None

First 6 digits of the card (BIN) for more accurate installment pricing. Omitted from the query when None.

None

Returns:

Type Description
list[GetInstallmentsResponseItem]

list[GetInstallmentsResponseItem]: The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_payout async

create_payout(*, body: CreatePayoutBody) -> None

Create a batch of payout transactions.

Available in: Argentina, Mexico (MLA, MLM)

Parameters:

Name Type Description Default
body CreatePayoutBody

The request body.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 201 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

list_payout_transactions async

list_payout_transactions(payout_id: str) -> None

List payout transactions.

Available in: Argentina, Mexico (MLA, MLM)

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
payout_id str

The payout_id value.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

cancel_payout_transaction async

cancel_payout_transaction(payout_id: str, transaction_id: str) -> None

Cancel a payout transaction.

Available in: Argentina, Mexico (MLA, MLM)

Parameters:

Name Type Description Default
payout_id str

The payout_id value.

required
transaction_id str

The transaction_id value.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

process_transaction_intent async

process_transaction_intent(*, body: ProcessTransactionIntentBody) -> None

Create a disbursement (Pix or bank transfer).

Creates a Pix or bank transfer disbursement for Brazil. The payment_method_id determines the method: - pix — instant Pix transfer (available 24/7) - bank_transfer — TED/DOC bank transfer Available in: Brazil (MLB)

Parameters:

Name Type Description Default
body ProcessTransactionIntentBody

The request body.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 201 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

get_transaction_intent async

get_transaction_intent(id: str) -> None

Get disbursement status.

Available in: Brazil (MLB)

Unverified. Neither the provider's SDK nor an unauthenticated probe covers this operation, so nothing here confirms the API routes it. See issue #227.

Parameters:

Name Type Description Default
id str

The id value.

required

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents no error status.

create_wallet_agreement async

create_wallet_agreement(
    *,
    body: CreateWalletAgreementBody,
    client_id: str | None = None,
    x_platform_id: str | None = None,
) -> CreateWalletAgreementResponse

Create a Wallet Connect agreement.

Creates an authorization agreement for Wallet Connect. Returns an agreement token to redirect the payer to MP for wallet authorization. Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Parameters:

Name Type Description Default
body CreateWalletAgreementBody

The request body.

required
client_id str | None

The client.id value. Omitted from the query when None.

None
x_platform_id str | None

The x-platform-id value. Omitted from the request headers when None.

None

Returns:

Name Type Description
CreateWalletAgreementResponse CreateWalletAgreementResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400.

get_wallet_agreement async

get_wallet_agreement(
    agreement_id: str, *, client_id: str | None = None, x_platform_id: str | None = None
) -> GetWalletAgreementResponse

Get a Wallet Connect agreement.

Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Parameters:

Name Type Description Default
agreement_id str

The agreement_id value.

required
client_id str | None

The client.id value. Omitted from the query when None.

None
x_platform_id str | None

The x-platform-id value. Omitted from the request headers when None.

None

Returns:

Name Type Description
GetWalletAgreementResponse GetWalletAgreementResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 404, 500.

delete_wallet_agreement async

delete_wallet_agreement(
    agreement_id: str, *, client_id: str | None = None, x_platform_id: str | None = None
) -> None

Revoke a Wallet Connect agreement.

Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Parameters:

Name Type Description Default
agreement_id str

The agreement_id value.

required
client_id str | None

The client.id value. Omitted from the query when None.

None
x_platform_id str | None

The x-platform-id value. Omitted from the request headers when None.

None

Returns:

Name Type Description
None None

Nothing — the operation answers 200 with no body.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 404, 500.

create_wallet_payer_token async

create_wallet_payer_token(
    agreement_id: str,
    *,
    body: CreateWalletPayerTokenBody,
    x_platform_id: str | None = None,
) -> CreateWalletPayerTokenResponse

Create a payer token from agreement.

Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Parameters:

Name Type Description Default
agreement_id str

The agreement_id value.

required
body CreateWalletPayerTokenBody

The request body.

required
x_platform_id str | None

The x-platform-id value. Omitted from the request headers when None.

None

Returns:

Name Type Description
CreateWalletPayerTokenResponse CreateWalletPayerTokenResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 404, 500.

validate_wallet_coupon async

validate_wallet_coupon(
    *, body: ValidateWalletCouponBody, x_payer_token: str
) -> ValidateWalletCouponResponse

Validate a coupon.

Checks coupon status and returns description and legal terms.

Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Parameters:

Name Type Description Default
body ValidateWalletCouponBody

The request body.

required
x_payer_token str

The x-payer-token value.

required

Returns:

Name Type Description
ValidateWalletCouponResponse ValidateWalletCouponResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 500.

create_wallet_discount async

create_wallet_discount(
    *, body: CreateWalletDiscountBody, x_payer_token: str
) -> CreateWalletDiscountResponse

Create a discount promise.

Validates a coupon and returns discount amount and legal terms.

Available in: Argentina, Brazil, Mexico (MLA, MLB, MLM)

Parameters:

Name Type Description Default
body CreateWalletDiscountBody

The request body.

required
x_payer_token str

Payer wallet token from agreement flow.

required

Returns:

Name Type Description
CreateWalletDiscountResponse CreateWalletDiscountResponse

The 200 response body, validated.

Raises:

Type Description
HTTPStatusError

For any non-2xx response. The specification documents 400, 401, 500.

DEFAULT_BASE_URL module-attribute

DEFAULT_BASE_URL: Final[str] = 'https://api.mercadopago.com'

The only server the specification declares.

Kept as a constant rather than an enum of environments precisely because there is nothing to choose between. An enum here would suggest a safety that does not exist.

MercadoPagoEventEnum

Bases: BaseStrEnum

A notification topic, as Mercado Pago names it.

Attributes:

Name Type Description
PAYMENT str

A payment was created or changed state.

MERCHANT_ORDER str

A merchant order changed.

POINT_INTEGRATION str

An in-person (Point) terminal event.

ORDER str

An order of the Orders API was created or changed state. The action in the body says which (order.updated, order.canceled, ...).

UNKNOWN str

A topic this SDK version does not name. The delivery is still verified and still reaches the caller — only the classification is absent.

to_cents

to_cents(amount: float | int | str | Decimal) -> int

Turn an amount Mercado Pago states in reais into exact cents.

Parameters:

Name Type Description Default
amount float | int | str | Decimal

The amount as the API typed it. A float is what a generated model produces, since the specification declares type: number.

required

Returns:

Name Type Description
int int

The amount in cents.

Raises:

Type Description
ValueError

If the amount is negative, or carries a fraction of a cent. Both mean the caller's assumption about the field is wrong, and silently rounding would hide a real mismatch behind a plausible number.

A float is routed through repr before Decimal so that 19.9 reads as Decimal("19.9") rather than the binary expansion Decimal(19.9) would produce.

from_cents

from_cents(cents: int) -> Decimal

Turn exact cents into the amount Mercado Pago expects.

Parameters:

Name Type Description Default
cents int

The amount in cents.

required

Returns:

Name Type Description
Decimal Decimal

The amount in reais, quantized to two places.

Raises:

Type Description
ValueError

If cents is negative.

Returns a Decimal rather than a float on purpose. Serializing a Decimal to JSON produces the digits you asked for; going through a float first can produce 19.900000000000002, which some providers reject and all of them log.

format_amount

format_amount(cents: int) -> str

Render an amount for a log line or a receipt.

Parameters:

Name Type Description Default
cents int

The amount in cents.

required

Returns:

Name Type Description
str str

The amount with two decimal places and no currency symbol —

str

"19.90". The symbol is a presentation decision that belongs to

str

whoever is displaying it.

MercadoPagoWebhookEvent dataclass

MercadoPagoWebhookEvent(
    topic: str,
    event: MercadoPagoEventEnum | None = None,
    data_id: str = "",
    payload: dict[str, Any] = dict(),
    body: bytes = b"",
)

A verified Mercado Pago notification.

A dataclass rather than a BaseSchema: this is the value handed to a route, not a wire DTO. BaseSchema sets use_enum_values=True, which would store :attr:event as a bare str — and then event.event is MercadoPagoEventEnum.PAYMENT would be silently False on every delivery.

Attributes:

Name Type Description
topic str

The notification type exactly as delivered.

event MercadoPagoEventEnum | None

The parsed topic. :attr:MercadoPagoEventEnum.UNKNOWN when Mercado Pago sent one this SDK version does not name, None when the delivery carried no topic at all.

data_id str

The resource id the notification points at, read from the data.id query parameter — the value the signature covers. Kept as delivered, uppercase for an order (ORD01...), even though the signature covers it lowercased: it is what you re-read from the API before acting, and GET /v1/orders/{id} answers to the delivered spelling.

payload dict[str, Any]

The decoded body. Not covered by the signature: the manifest signs data.id, x-request-id and ts, never the body.

body bytes

The raw body, byte-for-byte, for logging or a second verification.

SignatureHeader dataclass

SignatureHeader(timestamp: str = '', hashes: Mapping[str, str] = dict())

The parsed x-signature value.

Attributes:

Name Type Description
timestamp str

The ts component, or "" when the header carried none.

hashes Mapping[str, str]

Every vN component, keyed by the lowercase version. A header may carry more than one.

digest

digest(versions: Sequence[str] = DEFAULT_SIGNATURE_VERSIONS) -> str

Pick the digest for the first version present.

Parameters:

Name Type Description Default
versions Sequence[str]

Versions to try, in preference order.

DEFAULT_SIGNATURE_VERSIONS

Returns:

Name Type Description
str str

The hex digest, or "" when the header carries none of

str

them — which is what a provider migration to an unsupported

str

version looks like from here.

DEFAULT_SIGNATURE_VERSIONS module-attribute

DEFAULT_SIGNATURE_VERSIONS: Final[tuple[str, ...]] = ('v1',)

Hash versions accepted by default, in preference order.

Upstream defaults to ['v1'] and iterates in order, so a header carrying both v1 and v2 verifies against whichever the caller lists first. Passing ("v2", "v1") is how an integrator adopts a new version before this package ships one.

DEFAULT_TOLERANCE_SECONDS module-attribute

DEFAULT_TOLERANCE_SECONDS: Final[float] = 300.0

Maximum drift, in seconds, between a delivery's ts and the clock.

Five minutes, the value the Stripe verifier in this package uses. Upstream leaves the window opt-in, which means a delivery captured off the wire verifies forever: the signature covers a timestamp nobody checks. This package turns it on by default; pass tolerance_seconds=None to keep the upstream behaviour, or a larger number when a delivery legitimately arrives late.

MERCADO_PAGO_DATA_ID_QUERY module-attribute

MERCADO_PAGO_DATA_ID_QUERY: Final[str] = 'data.id'

Query-string parameter carrying the resource id, part of the manifest.

make_mercado_pago_webhook_dependency

make_mercado_pago_webhook_dependency(
    secret: str,
    *,
    tolerance_seconds: float | None = DEFAULT_TOLERANCE_SECONDS,
    versions: Sequence[str] = DEFAULT_SIGNATURE_VERSIONS,
    error_message: str = "Invalid Mercado Pago webhook signature",
) -> Callable[..., Coroutine[Any, Any, MercadoPagoWebhookEvent]]

Build a FastAPI dependency yielding a verified notification.

Parameters:

Name Type Description Default
secret str

The webhook secret from the Mercado Pago dashboard. An empty secret rejects every delivery, as :func:verify_signature does.

required
tolerance_seconds float | None

Maximum drift between ts and the clock, forwarded to :func:verify_signature. Defaults to :data:DEFAULT_TOLERANCE_SECONDS; None skips the check, as upstream does.

DEFAULT_TOLERANCE_SECONDS
versions Sequence[str]

Hash versions to accept, in preference order. Defaults to :data:DEFAULT_SIGNATURE_VERSIONS.

DEFAULT_SIGNATURE_VERSIONS
error_message str

Message on the raised :class:UnauthorizedException.

'Invalid Mercado Pago webhook signature'

Returns:

Type Description
Callable[..., Coroutine[Any, Any, MercadoPagoWebhookEvent]]

Callable[..., Coroutine[Any, Any, MercadoPagoWebhookEvent]]: An

Callable[..., Coroutine[Any, Any, MercadoPagoWebhookEvent]]

async dependency that reads data.id from the query string and

Callable[..., Coroutine[Any, Any, MercadoPagoWebhookEvent]]

x-signature / x-request-id from the headers, verifies them,

Callable[..., Coroutine[Any, Any, MercadoPagoWebhookEvent]]

and returns a :class:MercadoPagoWebhookEvent.

Raises:

Type Description
UnauthorizedException

Raised by the returned dependency when x-signature is missing or the delivery does not verify — including a data.id or x-request-id absent from the request while the signature covered it. The route handler is never called.

The signature covers data.id, x-request-id and ts — not the body. data_id on the returned event is therefore the one value the provider vouched for; payload and topic came along unsigned. Re-read the resource from the API by data_id before acting on it.

A body that is not JSON does not fail the request: the delivery verified, and rejecting it would discard a notification the provider considers sent. payload stays empty and body carries the bytes. The topic is read from the body's type, falling back to the type query parameter Mercado Pago also appends; a topic this SDK version does not name becomes :attr:MercadoPagoEventEnum.UNKNOWN rather than an error, so a provider release does not become an outage here.

verify_signature

verify_signature(
    *,
    secret: str,
    signature_header: str,
    data_id: str = "",
    request_id: str = "",
    versions: Sequence[str] = DEFAULT_SIGNATURE_VERSIONS,
    tolerance_seconds: float | None = DEFAULT_TOLERANCE_SECONDS,
    now: Callable[[], float] | None = None,
) -> bool

Check a delivery's signature.

Parameters:

Name Type Description Default
secret str

The webhook secret from the dashboard.

required
signature_header str

The raw x-signature value.

required
data_id str

The data.id query parameter, as delivered — it is lowercased into the manifest, never by the caller. Absent for the topics that carry none, and then it is left out of the manifest.

''
request_id str

The x-request-id header, same rule.

''
versions Sequence[str]

Hash versions to accept, in preference order. Defaults to :data:DEFAULT_SIGNATURE_VERSIONS.

DEFAULT_SIGNATURE_VERSIONS
tolerance_seconds float | None

Maximum drift between ts and the clock. Defaults to :data:DEFAULT_TOLERANCE_SECONDS; None skips the check, as upstream does.

DEFAULT_TOLERANCE_SECONDS
now Callable[[], float] | None

Clock for the tolerance check, in seconds since the epoch. Defaults to :func:time.time; override it in tests, never in production. The ts it is compared against is read as seconds or milliseconds by magnitude, because the provider's own artifacts disagree about the unit.

None

Returns:

Name Type Description
bool bool

Whether the delivery verifies. Comparison goes through

bool

func:hmac.compare_digest, so it does not leak the correct digest

bool

one byte at a time through timing.

A False here covers every rejection: no secret, a malformed header, a timestamp that is not all digits, no hash for a supported version, a digest that does not match, or drift past tolerance_seconds. The reason is deliberately not returned — a route that branches on why a signature failed tends to grow a path that accepts one of them.

An empty secret always returns False. Treating "no secret configured" as "everything is valid" is how an unauthenticated endpoint ships to production believing it is protected.

Turning the tolerance off

With tolerance_seconds=None a delivery captured off the wire verifies forever: the signature covers a timestamp nobody is checking. Upstream ships it that way; this package does not.

sign_manifest

sign_manifest(
    *, secret: str, data_id: str = "", request_id: str = "", timestamp: str
) -> str

Compute the HMAC-SHA256 digest of one delivery's manifest.

Parameters:

Name Type Description Default
secret str

The webhook secret from the Mercado Pago dashboard.

required
data_id str

The data.id query parameter of the delivery.

''
request_id str

The x-request-id header.

''
timestamp str

The ts component of x-signature.

required

Returns:

Name Type Description
str str

The lowercase hex digest.

Exposed publicly because a test — yours or this package's — needs to produce a valid signature without duplicating the manifest rules. The data_id is lowercased by :func:build_manifest, as the provider does, so passing the id exactly as a delivery carries it signs what the provider would sign.

build_manifest

build_manifest(*, data_id: str = '', request_id: str = '', timestamp: str) -> str

Build the string Mercado Pago signs, omitting the pairs it omits.

Parameters:

Name Type Description Default
data_id str

The data.id query parameter of the delivery, in any case — it enters the manifest lowercased.

''
request_id str

The x-request-id header.

''
timestamp str

The ts component of x-signature.

required

Returns:

Name Type Description
str str

The manifest — present pairs joined by ;, always ending in

str

;. With everything present that is

str

id:<data_id>;request-id:<request_id>;ts:<ts>;; with no

str

data.id it is request-id:<request_id>;ts:<ts>;, and the

str

empty id: is not there.

The omission rule is the reason this function exists instead of a format string: a fixed template turns an absent data.id into id:;, which hashes to something the provider never signed. Ported from mercadopago/sdk-nodejs, src/utils/webhook/index.ts (buildManifest) at commit 99857f33.

The data.id is lowercased, which that commit no longer does. Live Orders deliveries are signed over the lowercased id (ORD01... arrives, ord01... is signed), so a manifest with the id as delivered rejected every one of them; the module docstring has the history.

parse_signature_header

parse_signature_header(header: str) -> SignatureHeader

Split ts=...,v1=... into its components.

Parameters:

Name Type Description Default
header str

The x-signature value.

required

Returns:

Name Type Description
SignatureHeader SignatureHeader

The timestamp and every version hash present. A

SignatureHeader

malformed header yields empty components rather than an exception:

SignatureHeader

it means an untrusted caller, not a bug.

Keys are lowercased and values trimmed, matching upstream — TS= and V1= parse. Unknown keys are ignored, so a component the provider adds later does not break parsing.