Details
# mercadopago
Mercado Pago multi-product integration toolkit for Claude Code. Product availability depends on country, account eligibility, and commercial enablement.
> **Code scaffolding works without MCP authentication** using bundled references and the official per-country `llms.txt`. The plugin requests OAuth only immediately before a selected MCP tool, such as live documentation fallback, credential import, test-user actions, webhook registration, quality evaluation, or homologation.
## Quick Start
After installing the plugin, start using it offline or connect to your Mercado Pago account when an MCP-backed operation is needed — no Access Token setup is required.
**Claude Code:** OAuth starts on demand. Run `/mp-connect` only to connect or verify the status manually.
**Other IDEs (Cursor, VS Code, Windsurf, etc.):** add the HTTP server via your IDE's MCP settings panel with URL `https://mcp.mercadopago.com/mcp`, then complete the OAuth flow your IDE prompts. See `/mp-connect` for IDE-specific snippets.
## Version 4.3.2
- `/mp-integrate` reads routed skills directly from `${CLAUDE_PLUGIN_ROOT}`, avoiding a Bash preflight before routing.
## Version 4.3.1
- Checkout Pro and Checkout API always resolve a concrete checkout CTA.
- Checkout API creates and validates a separate payment screen; Checkout Pro keeps its hosted-checkout button in the resolved location.
- Card fields require persistent associated labels and remain interactive throughout SDK initialization.
- Public client configuration is loaded at runtime without HTML placeholder substitution.
- Official SDK installation or updates require authorization and use the current stable release.
- Bundled plugin files use `${CLAUDE_PLUGIN_ROOT}`; the plugin never copies its MCP configuration into the developer's project.
- Deterministic contracts cover Bricks, Subscriptions, Marketplace, Wallet Connect, SmartApps, Payouts, QR, and Point.
- Public installation and data-flow boundaries are documented in the repository `SECURITY.md` and `PRIVACY.md`.
## Architecture (v4)
One agent, four skills, one MCP. The plugin is an **orchestrator**: stable, version-pinned scaffold contracts and safety anchors are bundled and regression-tested, while volatile product documentation and live account data come from official country documentation or MCP on demand.
```
┌────────────────────────────────────────────────────────┐
│ mp-integration-expert (router) │
│ - country detection │
│ - mode detection (Orders API vs legacy) │
│ - delegates MCP-backed operations on demand │
│ - delegates to one of four skills │
└──────────────────────────┬─────────────────────────────┘
│
┌──────────────────┼──────────────────┬──────────────────┐
▼ ▼ ▼ ▼
mp-integrate mp-webhooks mp-test-setup mp-review
(wizard) (HMAC + MCP (create_test_user (quality_checklist
webhook tools) + add_money) + security floor)
│ │ │ │
└──────────────────┴──────────────────┴──────────────────┘
│
▼
┌───────────────────────────┐
│ Mercado Pago MCP server │
│ (mcp.mercadopago.com) │
│ │
│ search_documentation │
│ quality_checklist │
│ quality_evaluation │
│ save_webhook │
│ notifications_history… │
│ create_test_user │
│ add_money_test_user │
│ application_list │
└───────────────────────────┘
```
## Skills
| Skill | What it does | Backed by |
|-------|--------------|-----------|
| `mp-integrate` | Wizard that scaffolds a complete integration for any product and uses MCP only for a selected live fallback or account operation. | `search_documentation`, `application_list`, `get_credentials`, `create_application` |
| `mp-webhooks` | Receiver pattern with HMAC-SHA256 validation; configures and diagnoses webhooks. | `save_webhook`, `notifications_history` |
| `mp-test-setup` | Creates test users and loads funds. Credentials come in `APP_USR-` (Orders API, Checkout Pro, Point, QR) and `TEST-` (Checkout API, Bricks) formats — both valid and actively issued. | `create_test_user`, `add_money_test_user` |
| `mp-review` | Runs a local security floor and connects on demand for official quality checks and homologation. | `quality_checklist`, `quality_evaluation`, `form_homologation` |
## Commands
| Command | Description |
|---------|-------------|
| `/mp-connect` | Verify or trigger the MCP OAuth flow. |
| `/mp-integrate` | Scaffold a new integration. Sub-modes: `/mp-integrate webhook`, `/mp-integrate test-setup`. |
| `/mp-review [scope]` | Audit the integration. Scopes: `security`, `webhooks`, `checkout`, `qr`, `subscriptions`, `marketplace`, `quality`, `full`. |
| `/mp-test-cards [country]` | Return bundled test cards without MCP authentication. |
## MCP tools that trigger connection
Connection is requested only after the developer selects an operation backed by `application_list`, `get_credentials`, `create_application`, `search_documentation`, `search_payments`, `get_payment`, `get_order`, `create_test_user`, `add_money_test_user`, `save_webhook`, `notifications_history`, `quality_checklist`, `quality_evaluation`, or `form_homologation`.
`authenticate` and `complete_authentication` are OAuth bootstrap tools, not pre-flight checks. Static scaffolding, local security review, receiver generation, and bundled test cards do not connect to MCP.
## What changed from v3
- 13 product skills → 4 orchestration skills.
- Large duplicated documentation copies were removed; approved references now contain only stable anchors and tested scaffold contracts.
- Volatile status tables, device lists, and live availability remain in official documentation or MCP.
- `mp-setup` command renamed to `mp-integrate`, with `webhook` and `test-setup` sub-routes.
- Agent acts as a router with no embedded product implementation guide.
- MCP connection is **on demand** — scaffolding and local checks proceed offline; OAuth starts only immediately before a selected MCP tool.
## Hook: Credential Leak Prevention
Inspects supported Claude write/edit/Bash inputs for hardcoded Mercado Pago credentials. In detected Mercado Pago projects it also blocks direct Read and common Bash attempts to expose `.env`, `.env.*`, `.envrc`, and `*.env` files; examples and templates remain readable. This is defense in depth, not a replacement for secret scanning or credential rotation.
## MCP: Mercado Pago API
Connects to the official Mercado Pago MCP server (`https://mcp.mercadopago.com/mcp`) via HTTP transport. OAuth starts when an MCP-backed operation is selected; `/mp-connect` remains available for manual setup and diagnostics.
## Configuration
See [PLUGIN_SETTINGS.md](./PLUGIN_SETTINGS.md) for per-project configuration options (e.g., disabling the credential hook).
## Resources
The plugin resolves country-specific links during the wizard. General entry points:
- [Mercado Pago Developer Docs](https://www.mercadopago.com.ar/developers/en/docs)
- [API Reference](https://www.mercadopago.com.ar/developers/en/reference)
- [SDKs](https://www.mercadopago.com.ar/developers/en/docs/sdks-library/landing)
- [Developer Dashboard](https://www.mercadopago.com.ar/developers/panel/app)
- [Repository security policy](../../SECURITY.md)
- [Privacy and data flow](../../PRIVACY.md)
## skills/mp-integrate/SKILL.md
---
name: mp-integrate
description: Wizard that scaffolds a complete Mercado Pago integration from official and bundled sources, using MCP only for selected account actions or documentation gaps. Use whenever the developer wants to add or migrate a Mercado Pago payment flow.
license: Apache-2.0
copyright: "Copyright (c) 2026 Mercado Pago (MercadoLibre S.R.L.)"
metadata:
version: "4.3.2"
author: "Mercado Pago Developer Experience"
category: "development"
tags: "mercadopago, integration, wizard, checkout, bricks, qr, point, subscriptions, marketplace, payouts, smartapps, orders, sdk"
---
# mp-integrate
This skill is the single entry point for building a Mercado Pago integration. It collects the minimum context from the developer and assembles a ready-to-paste bundle using curated reference files and, as fallback, the MCP server.
## Reference files — read BEFORE generating any code
Use `${CLAUDE_PLUGIN_ROOT}` for every bundled reference and script. Claude Code resolves it to the active plugin version. Never scan an installation cache, load another marketplace copy, or copy the plugin's `.mcp.json` into the developer's project.
| File | Absolute path | Read when |
|---|---|---|
| `terminology-rules.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/terminology-rules.md` | **Always first** |
| `recommendation-template.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/recommendation-template.md` | **Always** — mandatory output structure |
| `guides/checkout-pro.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/guides/checkout-pro.md` | product = checkout-pro |
| `guides/checkout-api.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/guides/checkout-api.md` | product = checkout-api |
| `guides/bricks.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/guides/bricks.md` | product = bricks |
| `guides/qr.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/guides/qr.md` | product = qr |
| `guides/point.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/guides/point.md` | product = point |
| `guides/subscriptions.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/guides/subscriptions.md` | product = subscriptions |
| `guides/marketplace.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/guides/marketplace.md` | product = marketplace |
| `guides/wallet-connect.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/guides/wallet-connect.md` | product = wallet-connect |
| `guides/payouts.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/guides/payouts.md` | product = money-out (current name: Payouts) |
| `guides/smartapps.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/guides/smartapps.md` | product = smartapps |
| `guides/webhooks.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/guides/webhooks.md` | any product + webhooks |
| `products.md` | `${CLAUDE_PLUGIN_ROOT}/skills/mp-integrate/references/products.md` | test cards per country, API reference |
**Do NOT use MCP before reading all applicable files above.** For live documentation, WebFetch the official `{country_domain}/developers/llms.txt` (tier 1 — see Step 3), falling back to `products.md`.
---
⚠️ **IMPORTANT — when invoked via `/mp-integrate` command:** The command file already ran the environment check and readiness flow. **Start directly at Step 1.a** (auto-detect SDK/client/mode). Do not probe MCP state. Credentials are imported only if the developer explicitly selected that MCP-backed option.
---
## ⚠️ HARD LOCKS — read before doing anything else
These rules override any "what makes sense" judgement during the wizard. Past wizard runs have violated them; do not repeat the mistake.
### LOCK 1 — SDK is never a wizard question
The SDK / language is **NEVER** asked via `AskUserQuestion`. Period.
- Resolve it silently in Step 1.a by globbing the repo for a manifest (`package.json`, `pyproject.toml`, etc.).
- If a single manifest is found → record the SDK and **skip the question entirely**.
- If multiple manifests exist (real polyglot monorepo) → still don't ask. Pick the one that matches the directory the developer is currently editing, or default to `node`. Mention the choice in a single line of chat (`✓ SDK: node — from package.json`) and **continue without asking**.
- If no manifest exists at all → still don't ask. Default to `node`, mention it (`✓ SDK: node — defaulted (no manifest detected; we'll create package.json during scaffolding)`), and continue.
- Resolve the official package for that stack and query its official package registry for the current stable release. “Stable” means the registry's default/latest release, excluding alpha, beta, release-candidate, nightly, or preview builds.
- Compare the installed version with that stable release. Before installing or updating, show the package, current version (or “not installed”), proposed version, and the manifest/lockfile that will change, then request explicit authorization via `AskUserQuestion`.
- If authorized, install or update to the current stable release, adapt code affected by incompatible changes, update the lockfile, and run relevant tests. If declined, do not mutate dependencies and do not report the integration as ready while its required SDK is missing or outdated.
If you find yourself about to call `AskUserQuestion` with `header="SDK"` or `header="Stack"` or `header="Language"`, **stop immediately**. The SDK is never a picker. The Tabs row at the top of the wizard must NOT include "SDK" as one of the tabs.
### LOCK 2 — Product → Mode availability table (NON-NEGOTIABLE)
| Product | The ONLY valid `mode` values | Picker behavior |
|---------|------------------------------|-----------------|
| `checkout-pro` | `preferences` (the Orders API does **not** exist for Checkout Pro) | **Skip the mode question entirely.** Do not call `AskUserQuestion` with `header="Mode"`. Do not show "Orders API" as an option. Use `mode=preferences` silently. |
| `checkout-api` | `orders` | **Always `orders` in ALL countries.** |
| `bricks` | `payments` | Internal routing value. `card-payment` and `payment` create Payments API payments; `wallet` creates `/checkout/preferences`; `status-screen` only displays a `paymentId`. Never add `v1` to the preferences path. |
| `qr` | `orders` | **Always `orders` in ALL countries.** |
| `point` | `orders` | **Always `orders` in ALL countries.** |
| `marketplace` | `preferences` or `payments` | Resolve `marketplace-checkout=` first. Checkout Pro and Wallet Brick use Preferences; Checkout API uses Payments API. Marketplace is not a standalone Orders API mode. |
| `wallet-connect` | `orders` | Always `orders`. Never ask. |
| `subscriptions` | n/a (uses its own `preapproval` API) | Skip the mode question. |
| `money-out` | n/a (current product name: Payouts; country-specific API contract) | Skip the mode question. |
| `smartapps` | n/a | Skip the mode question. |
**If `product=checkout-pro` and you are about to render a Mode picker that includes `Orders API`, abort.** The Orders API is not available for Checkout Pro today. Period. Do not "future-proof" by offering it. Do not add a "Recommended" tag to it. Do not include it in any "Other" fallback.
### LOCK 3 — Always use `init_point`, never `sandbox_init_point`
Mercado Pago removed the sandbox environment. There is no staging URL. Every integration — including test-user flows — runs against the production API.
**Never generate code that references `sandbox_init_point`.** Always use `init_point` from the preference response. The difference between a test run and a production run is only which credentials are loaded (`APP_USR-` from a test user vs. a real account) — not the URL.
If you find `sandbox_init_point` in existing code, flag it as a bug: the redirect will fail silently or land on an error page.
**Also applies to test users:** test users created via `create_test_user` operate against the production API host using the `APP_USR-` credentials returned for that test-user account. There is no separate test base URL or sandbox toggle. This does **not** make `TEST-` credentials invalid: static test credentials for Checkout API, Bricks, and Payments API may use `TEST-`. Code using `sandbox_init_point` with any credential will not work.
### LOCK 4 — Tabs row must reflect only the questions that will actually be asked
The wizard's Tabs row at the top (the `□ Country □ Product □ Mode ✓ Submit` line) must include **only** the dimensions that are actually still unresolved AND non-skipped per LOCK 1 and LOCK 2. Concretely:
- Never include "SDK" in the tabs — see LOCK 1.
- Never include "Mode" in the tabs when `product` is `checkout-pro` / `bricks` / `wallet-connect` / `subscriptions` / `money-out` / `smartapps`.
- Never include "Environment" in the tabs.
### LOCK 5 — Checkout CTA is mandatory for Pro and API
Immediately after the product is resolved, normalize these aliases before any product branch:
- `checkout-api-orders`, `checkout-transparente`, `checkout-transparent`, `checkout_api` → `checkout-api`
- `checkout-pro` remains `checkout-pro`
For either normalized value, run this from the target project root before assembling or writing the checkout UI:
```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/resolve-checkout-cta.mjs" "{product}" .
```
Persist the returned `product`, `status`, `selected`, `candidates`, and `nextAction` for Step 2.5. Do not independently reinterpret `checkout-api-orders` as another product. `nextAction=wire_selected_cta` requires using `selected`; `nextAction=ask_user_for_cta_or_insertion_location` requires an immediate `AskUserQuestion` for a concrete target. A Checkout Pro or Checkout API scaffold may never finish successfully without a wired CTA. This lock applies equally to both products; do not change the working Checkout Pro behavior while fixing Checkout API.
### LOCK 6 — Checkout Pro local back URLs must never enable `auto_return`
When `product=checkout-pro`, `auto_return: "approved"` is valid only when the effective `APP_URL` is a public HTTPS origin. If `APP_URL` is missing, uses `localhost`, `127.0.0.1`, `0.0.0.0`, or is not HTTPS, omit `auto_return` from the preference body. Do not merely provide localhost `back_urls`: the Preferences API rejects that combination before creating the preference.
For applications that support local and production execution, derive an explicit `publicAppUrl` boolean from `APP_URL` (HTTPS and non-local) and conditionally spread `{ auto_return: "approved" }` only when it is true. Before reporting success, run `validate-checkout-pro-server.mjs` as required by Step 3.5.
### LOCK 7 — Point uses Orders API and supports hardware-free test mode
When `product=point`, scaffold only the current Orders API flow: `POST /v1/orders`, `type: "point"`, and `config.point.terminal_id`. Never generate `/point/integration-api/.../payment-intents`, `type: "instore"`, or `config.device.id`.
For a developer without hardware, support the official standard virtual terminal `NEWLAND_N950__SBX0000001`, but only behind an explicit `MP_POINT_TEST_MODE=true` guard. Production must require `MP_POINT_TERMINAL_ID`; it may never silently fall back to the virtual terminal. Include order lookup by ID so the application can reconcile asynchronous status changes. Before reporting success, run:
```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/validate-point-server.mjs" "{server_file}"
```
### LOCK 8 — QR uses Orders API with an existing Store and POS
When `product=qr`, scaffold only `POST /v1/orders` with `type: "qr"`, matching
`total_amount` and `transactions.payments[0].amount`, and
`config.qr.external_pos_id`. The only valid QR modes are `static`, `dynamic`, and
`hybrid`. Never generate `/instore/orders/qr/...`, `/instore/qr/...`, a redirect
Checkout order, or a QR whose content is a Checkout URL. Keep the request minimal:
do not invent a `payer` and remove legacy `items[].currency_id` and
`items[].total_amount` fields. Validate client-supplied prices, quantities, and
the computed total as finite positive values. QR cancellation must not copy the
Point-only `X-Allow-Cancelable-Status` header.
Store and POS provisioning is a prerequisite, not a hidden side effect of the
scaffold. Reuse an existing POS when one is explicitly configured. If none is
available, ask for the real Store location before creating persistent resources;
never invent an address. Dynamic and hybrid modes render
`type_response.qr_data` locally. Static mode renders the QR returned when the POS
was created. Include order lookup and cancellation, and run both acceptance
checks before reporting success:
```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/validate-qr-server.mjs" "{server_file}"
node "${CLAUDE_PLUGIN_ROOT}/scripts/validate-qr-client.mjs" "{client_file}" 'data-mp-qr-cta="create-order"' "/api/qr/orders"
```
### LOCK 9 — Bricks behavior is variant-specific
Resolve `brick=` before writing code and read `references/guides/bricks.md`. Never
apply one Brick's backend to all four variants:
- `card-payment`: `CardPayment`/`cardPayment` creates a Payments API payment.
- `payment`: `Payment`/`payment` creates the selected method via Payments API.
- `wallet`: `Wallet`/`wallet` creates a preference using exactly
`/checkout/preferences`; the path has no version segment.
- `status-screen`: `StatusScreen`/`statusScreen` renders a validated `paymentId`;
it does not create a payment and must not receive an order ID.
Use the application's actual framework and scan the whole project for a real
checkout CTA. When one exists, preserve its presentation and link it to the new
dedicated Brick page after removing the competing old handler. If none exists,
create the page anyway and report the exact route/invocation the developer must
link. Never collect raw card fields around a Brick. Before reporting success:
```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/validate-bricks-integration.mjs" . "{brick}"
```
### LOCK 10 — Subscriptions contracts never mix
When `product=subscriptions`, resolve `subscription-model=` before writing code
and read `references/guides/subscriptions.md`. The only valid values are
`with-plan`, `without-plan-authorized`, and `without-plan-pending`.
- `with-plan` uses a server-controlled `preapproval_plan_id`, a securely
tokenized `card_token_id`, and `status: "authorized"`. Never accept a plan ID
from the browser or create a plan from the buyer CTA.
- `without-plan-authorized` sends trusted server-side recurrence terms, a
securely tokenized `card_token_id`, and `status: "authorized"`.
- `without-plan-pending` sends trusted recurrence terms and `status: "pending"`,
omits `card_token_id`, and redirects only to the returned `init_point`.
Authorized flows must use MercadoPago.js CardForm or the official Card Payment
Brick. Never ask the buyer to paste a card token, never collect raw card data,
and never omit the CardForm lifecycle selects (`issuer`, `installments`, and
`identificationType`). Scan the whole application for every subscription CTA.
All marketing/entry CTAs must converge on the existing or generated dedicated
signup page; only its final CTA may create a preapproval. Remove competing demo
handlers and orphan server routes so exactly one preapproval creator remains.
Before reporting success:
```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/validate-subscriptions-integration.mjs" . "{subscription-model}"
```
### LOCK 11 — Marketplace is OAuth + one supported checkout
When `product=marketplace`, resolve `marketplace-checkout=` before writing code
and read `references/guides/marketplace.md`. The only supported values are
`checkout-pro`, `checkout-api`, and `bricks-wallet`.
- `checkout-pro` uses the connected seller OAuth access token, exactly
`/checkout/preferences`, and `marketplace_fee`.
- `checkout-api` uses the integrator public key, the connected seller OAuth
access token, `/v1/payments`, secure tokenization, and `application_fee`.
- `bricks-wallet` uses the integrator public key, seller OAuth access token,
exactly `/checkout/preferences`, `marketplace_fee`, a dynamic `preferenceId`,
and `marketplace: true`.
Every contract must implement one-time server-side OAuth state, exact redirect
URI matching, authorization-code exchange, encrypted persistent seller tokens,
refresh-token rotation, and trusted server-side seller/cart/commission
resolution. Never accept seller ID, amount, commission, collector ID, or OAuth
tokens from the browser. Marketplace is not a standalone Orders API flow and
must not silently fall back to the platform token. Before reporting success:
```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/validate-marketplace-integration.mjs" . "{marketplace-checkout}"
```
### LOCK 12 — Wallet Connect requires commercial access and server-only linkage
When `product=wallet-connect`, read
`references/guides/wallet-connect.md` before any scaffold decision.
1. Confirm that Mercado Pago enabled Wallet Connect commercially for the
developer's application. If the developer explicitly says it is not enabled,
stop with `BLOCKED: active Wallet Connect agreement required` and do not
write files. If enablement is unknown, ask once before writing.
2. Always use the fixed `orders` mode. Do not ask about mode and do not replace
this product with the Wallet Brick or Advanced Payments API.
3. Create a dedicated account-linking/payment page and scan the entire project
for the real final checkout CTA. Preserve and wire it when found; otherwise
report the exact new route and invocation that the developer must link.
4. Account linking, approval-code exchange, payer-token creation, encryption,
persistence, and Orders API payment creation all happen on the server. The
browser receives only safe linkage state, the approval redirect URI, and
final order status/ID.
5. Derive buyer identity and purchase amount from authenticated server-side
state. Never accept external user identity, payer token, amount, or stored
credential semantics as authoritative browser input.
6. Do not load MercadoPago.js, ask for a public key, mount a Wallet Brick, or
render card fields. Buyer approval happens in the Mercado Pago wallet UI.
Before reporting success, run:
```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/validate-wallet-connect-integration.mjs" .
```
### LOCK 13 — SmartApps requires commercial access, Android, and its private SDK
When `product=smartapps`, read `references/guides/smartapps.md` before any
scaffold decision.
1. Confirm that the developer has an active SmartApps agreement with the
Mercado Pago team. If not explicitly confirmed, stop with
`BLOCKED: active SmartApps agreement required` and do not write files.
2. Query `mcp__plugin_mercadopago_mcp__search_documentation` for the current
SmartApps guide even when tier-1 public documentation is available. If MCP
authentication is missing, run the normal inline authentication flow and
stop until it succeeds.
3. Require an Android target. Never convert or embed SmartApps into a web,
backend, desktop, or iOS application. If the repository has no Android app,
explain that a separate Android application/module is required and ask
before expanding scope.
4. Resolve `main` versus `mini` and `own` versus `third-party` before writing.
Main apps own the HOME launcher; mini apps do not. Third-party integrations
require the SDK OAuth mode.
5. The SDK is the private AAR delivered in the Mercado Pago integration kit.
Never substitute a public Mercado Pago SDK or invent a Maven coordinate.
Ask before copying/updating it, verify the latest artifact with the
integration team, and use only that latest version.
6. Payment methods, payments, printer, scanner/camera, and Bluetooth are used
through the SmartApps SDK. Do not call payment APIs directly from the
terminal or request prohibited direct Android permissions.
Before reporting a successful static scaffold, run:
```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/validate-smartapps-integration.mjs" . "{main|mini}" "{own|third-party}"
```
Passing this check is not device certification. Compilation requires the real
latest AAR; payment and hardware validation require the Mercado Pago development
terminal and the sandbox-flavor kit.
### LOCK 14 — Money Out is Payouts and its contract is country-specific
When `product=money-out`, read `references/guides/payouts.md` before any scaffold
decision and present the current product name as **Payouts**.
1. Never scaffold a `disbursements` API, Advanced Payments, Marketplace split,
checkout flow, buyer CTA, or card form. The old Money Out URL now redirects
to Payouts.
2. Resolve the contract from the country before writing. Argentina uses the
current batch Payouts contract; Brazil uses the current single Transaction
Intent contract. For another country, query the current country guide and
stop with `BLOCKED: verified Payouts country contract required` if it does
not return a verified contract.
3. Payout creation is server-only and privileged. Require authentication plus
explicit operator authorization, load amount and destination from a durable
trusted instruction repository, and write a durable audit trail. The caller
may provide only an opaque instruction ID.
4. Test mode must be explicit and must send the official Payouts test header.
Production must use Ed25519 signing of the exact serialized body. Never
hardcode test mode, a private key, a destination account, or an Access Token.
5. A successful HTTP response is asynchronous acceptance, not final
accreditation. Persist IDs/statuses and reconcile by lookup plus Webhooks.
6. Do not install an SDK solely for Payouts when the verified country contract
uses REST and the detected official SDK does not expose that resource. If an
official SDK is used, LOCK 1 still requires authorization and the latest
stable version.
Before reporting success, run:
```bash
node "${CLAUDE_PLUGIN_ROOT}/scripts/validate-payouts-integration.mjs" . "{AR|BR}"
```
---
## Step 1 — Parse `$ARGUMENTS` and ask for missing context
`$ARGUMENTS` may include any combination of these flags. Anything missing must be asked via `AskUserQuestion` in batches of ≤4.
| Flag | Values |
|------|--------|
| `country=` | `AR` / `BR` / `MX` / `CL` / `CO` / `PE` / `UY` |
| `product=` | `checkout-pro` / `checkout-api` / `bricks` / `qr` / `point` / `subscriptions` / `marketplace` / `wallet-connect` / `money-out` / `smartapps` |
| `mode=` | depends on product — see Product Matrix below |
| `sdk=` | `node` / `python` / `java` / `php` / `ruby` / `dotnet` / `go` (or `none` for raw REST) |
| `client=` | `vanilla-js` / `react` / `ios` / `android` / `flutter` / `react-native` (only for products with a client component) |
| `lang=` | `es` / `en` / `pt` (docs language) |
| `recurrent=` | `yes` / `no` (Checkout API, Bricks) |
| `3ds=` | `yes` / `no` (Checkout API, Bricks) |
| `marketplace=` | `yes` / `no` (split payments) |
| `brick=` | `payment` / `card-payment` / `wallet` / `status-screen` (only when `product=bricks`) |
| `qr-mode=` | `static` / `dynamic` / `hybrid` (only when `product=qr`) |
| `subscription-model=` | `with-plan` / `without-plan-authorized` / `without-plan-pending` (only when `product=subscriptions`) |
| `marketplace-checkout=` | `checkout-pro` / `checkout-api` / `bricks-wallet` (only when `product=marketplace`) |
| `smartapps-agreement=` | `confirmed` (only when `product=smartapps`; absence is never inferred as confirmation) |
| `smartapp-kind=` | `main` / `mini` (only when `product=smartapps`) |
| `smartapp-ownership=` | `own` / `third-party` (only when `product=smartapps`) |
After parsing or inferring `product`, apply LOCK 5 normalization immediately. Use only the normalized internal value for the Product Matrix, guide selection, CTA resolution, and scaffold branches. The presentation-only slug `checkout-api-orders` may appear in the final recommendation metadata, but it must never be used as an internal branch value.
### Step 1.a — Auto-resolve before asking (MANDATORY — exhaust this step first)
**You MUST run this step before any `AskUserQuestion` call.** Every dimension that resolves here is removed from the wizard. The developer should only be asked about dimensions that genuinely cannot be inferred. **Skipping the auto-detection and asking the developer anyway is the single most common mistake — do not do it.**
For every dimension, attempt these resolution sources **in order**:
| Dimension | 0th: agent inference (Step 1.a) | 1st: persisted | 2nd: repo signals | 3rd: ask |
|-----------|--------------------------------|----------------|-------------------|----------|
| `product` | If agent resolved from message keywords → **use it, skip question** | Read from `.mp-integrate-progress.md` | — | `AskUserQuestion` picker |
| `country` | If agent resolved from message keywords → **use it, skip question** | Read from `.mp-integrate-progress.md` | **None — do not grep for country** (unreliable, costs tokens) | `AskUserQuestion` picker. **Persist the answer**. |
| `sdk` | — | — | **MUST run `Glob` for**: `package.json`→node, `pyproject.toml`/`requirements.txt`→python, `pom.xml`/`build.gradle*`→java, `composer.json`→php, `Gemfile`→ruby, `*.csproj`/`Program.cs`→dotnet, `go.mod`→go. Single match → resolved. Multiple matches → choose the manifest in the active application area. No match → default to node. | **Never ask which SDK**; only ask authorization before an install/update. |
| `client` | — | — | Inspect `package.json` deps: `react`/`next`→react, `react-native`/`expo`→react-native, `*.xcodeproj`→ios, Android `build.gradle`→android, `pubspec.yaml`→flutter. Single match → resolved. | `AskUserQuestion` (only if product has client component AND ambiguous) |
| `lang` | — | — | Derive from country (BR→pt, others→es). | Almost never asked — defaulted from country |
| `mode` | — | Read from progress file | `Grep` for `/v1/orders`/`order.create`→orders; `/v1/payments`/`payment.create`→payments; `/checkout/preferences`/`preference.create`→preferences. Product Matrix may pin to single value (e.g. checkout-pro → always preferences). | `AskUserQuestion` (only when matrix allows >1 AND grep didn't disambiguate) |
**Concrete order of operations for the wizard (INFER FIRST, ASK LAST):**
0. **Check for legacy Instore APIs in repo (before any question).** Run `Grep` for legacy QR/Point patterns:
- `/mpmobile/instore/qr` (QR Instore)
- `/instore/qr/seller/collectors` (QR Instore V2)
- `/instore/orders/qr/seller/collectors` (QR Dinámico)
- `/point/integration-api/devices/.*/payment-intents` (Point PDV + Self Service)
If any found AND the project is not already fully on `/v1/orders`, ask **once** via `AskUserQuestion`:
- header: `"Existing integration"`
- Question: *"I found an existing legacy Instore integration in your project at {file}:{line}. Before scaffolding, would you like to migrate it to the Orders API first?"*
- Options: `"Yes, migrate first (/mp-integrate migrate)"` / `"No, scaffold the new integration"`
- If "Yes" → stop and instruct: *"Run `/mp-integrate migrate` to migrate the existing integration, then come back to scaffold the new one."*
- If "No" → continue normally. Do NOT suggest migration again in this session.
- **Skip this check entirely** if `$ARGUMENTS` already contains `migrate`.
1. **Check agent inference** — if the agent's Step 1.a resolved `product=` and/or `country=` from the developer's message, those dimensions are already resolved. Do NOT ask for them.
2. Read `.mp-integrate-progress.md` if it exists — pull any previously-resolved values.
3. **Do NOT grep for country.** Country is asked via `AskUserQuestion` unless already resolved by steps 1–2. No locale-string grep, no `mercadopago.com.<tld>` grep, no `currency_id` grep — they cost tokens and produce wrong matches.
4. Run `Glob` over the manifest patterns. **If a single SDK manifest matches, the SDK is RESOLVED — do NOT ask.** The official Mercado Pago SDK for the detected language is the one used. Never propose a third-party SDK.
5. If the product needs a client, run `Glob`/`Grep` on manifest deps. If a single client matches, **client resolved**. Skip the client question.
6. Default `lang` from country. Skip the lang question.
7. Now — and only now — call `AskUserQuestion` for whatever is still missing, one tool call at a time, in the order defined in Step 1.b. After each answer, **persist it** to `.mp-integrate-progress.md`.
**Known MCP limitation — country resolution:** The Mercado Pago MCP does not currently expose a tool that returns the developer's `site_id` (neither `application_list` nor `quality_checklist` nor `notifications_history` carry the country in their response). The OAuth access token would let us call `GET https://api.mercadopago.com/users/me` directly, but the token is held by the MCP server and is not exposed to the plugin client. Until MP ships a new MCP tool (e.g. `current_user_info` or a generic `proxy_request`), country resolution is **just**: read `.mp-integrate-progress.md` if it has a country, otherwise ask via `AskUserQuestion` and persist. **Do not** waste tokens grepping the repo for country signals (locales, URLs, `currency_id`, `site_id`, app-name heuristics) — they don't pay off, and asking the developer once is cheaper and more reliable.
### Step 1.a.iii — Confirm everything that was auto-resolved (mandatory)
After auto-resolving, render a single confirmation block listing every value that was inferred (not just country — also SDK, client, and any other dimension that came from the repo). Then, **before any wizard question**, ask the developer with one `AskUserQuestion`:
- `header="Confirm setup"`
- Question: `"I auto-detected the following from your repo. Is everything correct?"`
- Options:
- `"Yes, continue"` — proceed to Step 1.b with the auto-resolved values.
- `"No, let me correct"` — drop the user-selectable auto-resolved values back into the wizard queue. Do not add SDK/language to that queue: re-run repository detection for them and explain the selected official SDK without presenting an SDK picker.
Skip this confirmation **only** when there was nothing to auto-resolve (clean repo, no manifest, no locale, no existing MP URLs). In that case the wizard goes straight to asking.
Example block to render:
```
I auto-detected the following from your repo:
✓ App: My Store (123456789012345) — from application_list
✓ SDK: node — from backend/package.json (mercadopago v2.12.0 already installed)
✓ Client: react — from frontend/package.json
Country will be asked next (not auto-detected).
Confirm the above to continue, or correct.
```
The developer must explicitly opt-in to the auto-resolved set. Never proceed silently to Step 1.b after auto-resolving — that's how wrong assumptions propagate to the final bundle.
If the agent already passed flags (`country=`, `sdk=`, `mode=`, etc.), treat those as resolved too.
Anything still unresolved after 1.a goes into the wizard in 1.b.
**Always use the official Mercado Pago SDKs**, listed below, regardless of whether the developer mentions a wrapper or alternative library. The official SDKs are maintained by Mercado Pago and aligned with the live API.
### Step 1.b — Ask one question at a time, with the AskUserQuestion picker
This is the most-violated rule of the wizard. **The two screenshots that broke the v4 wizard were caused by violating this section.** Read it twice.
**STOP-TEST before writing any chat output:**
If your response includes ANY of these patterns, you are doing it wrong — abort and use `AskUserQuestion` instead:
- `Question N of M`
- `1. Country` / `2. Product` / `3. SDK` (numbered question list)
- A bullet list of option codes like `- checkout-pro — …`
- The phrase `Type the code` or `Reply with` or `Answer with`
- Any markdown that looks like a menu the developer is supposed to read and respond to in free text
These are all the v3 anti-pattern. The developer cannot click on plain text. They get a worse