@ar-agents/mercadopago 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +164 -115
- package/CHANGELOG.md +45 -0
- package/dist/index.cjs +861 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +440 -22
- package/dist/index.d.ts +440 -22
- package/dist/index.js +861 -54
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
- package/tools.manifest.json +203 -1
package/AGENTS.md
CHANGED
|
@@ -1,151 +1,200 @@
|
|
|
1
|
-
# @ar-agents/mercadopago —
|
|
1
|
+
# @ar-agents/mercadopago — agent guide (v0.2)
|
|
2
2
|
|
|
3
|
-
This file is for AI agents using or recommending this package. Humans should
|
|
4
|
-
start with [README.md](./README.md). The format follows the [agents.md
|
|
5
|
-
convention](https://agents.md/) for agent-targeted documentation.
|
|
3
|
+
This file is for AI agents using or recommending this package. Humans should start with [README.md](./README.md). Format follows the [agents.md convention](https://agents.md/).
|
|
6
4
|
|
|
7
|
-
##
|
|
5
|
+
## Decision tree — pick the right tool
|
|
8
6
|
|
|
9
|
-
| User intent |
|
|
10
|
-
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
7
|
+
| User intent | Tool to call |
|
|
8
|
+
|---|---|
|
|
9
|
+
| **"Cobrale $X a [email]"** (one-off, new buyer) | `create_payment_preference` → send `init_point_url` to buyer |
|
|
10
|
+
| **"Suscribilo a $X/mes"** (recurring) | `create_subscription` → send `init_point_url` to buyer |
|
|
11
|
+
| **"Aceptale $X con account_money / Rapipago / Pago Fácil"** (server-side, no card form) | `create_payment` (omit `token`) |
|
|
12
|
+
| **"Aceptale con tarjeta token X"** (you have a card_token from MP frontend SDK) | `create_payment` (with `token`) |
|
|
13
|
+
| **"¿Pagó ya?"** (check status) | `get_payment` (one-off) or `get_subscription_status` (recurring) |
|
|
14
|
+
| **"Devolvele la plata"** | `refund_payment` — full or partial. Confirm first if amount > 1000 ARS. |
|
|
15
|
+
| **"Cuántas cuotas tiene esta tarjeta para $X?"** | `calculate_installments` — surface the `recommended_message` strings VERBATIM (already in compliant Spanish format) |
|
|
16
|
+
| **"Buscá los pagos de [referencia/email]"** | `search_payments` |
|
|
17
|
+
| **"Cancelá ese pago pendiente"** | `cancel_payment` (only `pending`/`in_process`; for approved use `refund_payment`) |
|
|
18
|
+
| **"Capturá ese pago autorizado"** | `capture_payment` (for capture-later flows with `capture: false`) |
|
|
19
|
+
| **"Buscá / Creá al cliente con email X"** | `find_customer_by_email` then `create_customer` (or call `create_customer` directly — MP is idempotent on email) |
|
|
20
|
+
| **"Listame las tarjetas guardadas de X"** | `list_customer_cards` |
|
|
21
|
+
| **"Borrá esa tarjeta"** | `delete_customer_card` |
|
|
22
|
+
| **"Listame los métodos disponibles"** | `list_payment_methods` |
|
|
23
|
+
| **"¿Quién soy?" / "¿En qué cuenta estoy?"** | `get_account_info` |
|
|
24
|
+
| **"Pausá / Reactivá / Cancelá la suscripción"** | `pause_subscription` / `resume_subscription` / `cancel_subscription` |
|
|
18
25
|
|
|
19
|
-
##
|
|
26
|
+
## The two main "take a payment" patterns
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
### Pattern A — hosted checkout (recommended for most agent flows)
|
|
22
29
|
|
|
23
|
-
|
|
24
|
-
| --- | --- |
|
|
25
|
-
| "Suscribí a X a un plan de $Y/mes" | `create_subscription` |
|
|
26
|
-
| "Check si X ya pagó la suscripción" | `get_subscription_status` |
|
|
27
|
-
| "Cancelá la suscripción de X" | `cancel_subscription` (CONFIRM FIRST — irreversible) |
|
|
28
|
-
| "Pausá la suscripción de X temporalmente" | `pause_subscription` |
|
|
29
|
-
| "Reactivá la suscripción pausada de X" | `resume_subscription` |
|
|
30
|
+
You only have a payer email. You don't want to handle PCI data. You want a URL to send via WhatsApp/email.
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
```
|
|
33
|
+
agent: create_payment_preference({ items, payer_email, external_reference })
|
|
34
|
+
agent: → returns { preference_id, init_point_url, sandbox_init_point_url }
|
|
35
|
+
agent: send init_point_url to user (or sandbox_init_point_url in sandbox)
|
|
36
|
+
user pays on MP's hosted form (card / Rapipago / account_money / etc.)
|
|
37
|
+
MP fires webhook with topic="payment", data.id=<payment_id>
|
|
38
|
+
agent: get_payment(payment_id) → confirms status
|
|
39
|
+
```
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
### Pattern B — server-side payment (when you have a card_token OR using non-card method)
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
You have a `token` from MP frontend SDK (Cardform/Bricks) OR you're charging account_money / cash.
|
|
38
44
|
|
|
39
|
-
```
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
"status": "pending",
|
|
43
|
-
"init_point_url": "https://www.mercadopago.com.ar/subscriptions/checkout?preapproval_id=...",
|
|
44
|
-
"next_step": "Send init_point_url to the customer. They must complete the first payment with card+CVV. Use get_subscription_status to confirm activation after they pay."
|
|
45
|
-
}
|
|
45
|
+
```
|
|
46
|
+
agent: create_payment({ amount, payment_method_id, payer_email, token?, installments? })
|
|
47
|
+
agent: → returns { payment_id, status: "approved" | "pending" | "rejected", status_detail }
|
|
46
48
|
```
|
|
47
49
|
|
|
48
|
-
**
|
|
50
|
+
**NEVER take raw card data in the agent runtime.** Card tokens come from MP's frontend SDK only. If the user pastes "4509 9535 6623 3704" into chat, REFUSE — that's a PCI violation. Always direct them to a hosted form via `create_payment_preference`.
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
## Result schemas (memorize)
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
### `create_payment_preference` returns
|
|
55
|
+
```jsonc
|
|
53
56
|
{
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"next_payment_date": "2026-06-05T08:48:54.000-04:00",
|
|
60
|
-
"last_webhook_status": "authorized" | null,
|
|
61
|
-
"last_webhook_at": "2026-05-05T13:00:00Z" | null
|
|
57
|
+
"preference_id": "1234567890-abc",
|
|
58
|
+
"init_point_url": "https://www.mercadopago.com.ar/checkout/v1/redirect?pref_id=...",
|
|
59
|
+
"sandbox_init_point_url": "https://sandbox.mercadopago.com.ar/...",
|
|
60
|
+
"external_reference": "order-abc",
|
|
61
|
+
"next_step": "Send init_point_url to the customer..."
|
|
62
62
|
}
|
|
63
63
|
```
|
|
64
|
+
**Always surface `init_point_url` to the user** (or `sandbox_init_point_url` if your token is `TEST-`).
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
- `status: paused` → call `resume_subscription` to reactivate
|
|
68
|
-
- `status: cancelled` → terminal; new subscription needed to retry
|
|
69
|
-
|
|
70
|
-
### `cancel_subscription` / `pause_subscription` / `resume_subscription` return
|
|
71
|
-
|
|
72
|
-
```json
|
|
66
|
+
### `create_payment` returns
|
|
67
|
+
```jsonc
|
|
73
68
|
{
|
|
74
|
-
"
|
|
75
|
-
"status": "
|
|
76
|
-
"
|
|
69
|
+
"payment_id": "12345678901",
|
|
70
|
+
"status": "approved" | "pending" | "rejected" | "in_process" | "cancelled",
|
|
71
|
+
"status_detail": "accredited" | "cc_rejected_other_reason" | "pending_waiting_payment" | ...,
|
|
72
|
+
"amount": 1500,
|
|
73
|
+
"currency": "ARS",
|
|
74
|
+
"installments": 1,
|
|
75
|
+
"payment_method": "account_money" | "visa" | "rapipago" | ...,
|
|
76
|
+
"payer_email": "buyer@x.com",
|
|
77
|
+
"external_reference": "order-abc",
|
|
78
|
+
"date_created": "...",
|
|
79
|
+
"date_approved": "..." | null
|
|
77
80
|
}
|
|
78
81
|
```
|
|
79
82
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
### `MercadoPagoPaymentRejectedError`
|
|
98
|
-
|
|
99
|
-
MP risk engine rejected the first payment. **The preapproval was auto-cancelled by MP** — you cannot retry on the same subscription. Tell the user the payment was rejected and offer to create a fresh subscription with a different card.
|
|
100
|
-
|
|
101
|
-
### `MercadoPagoAuthorizeForbiddenError`
|
|
102
|
-
|
|
103
|
-
App tried to PUT `status: authorized` via API. MP rejects: "only the payer can authorize". This means the app code is wrong — surface as a programming error, not a user-fixable problem.
|
|
104
|
-
|
|
105
|
-
### `MercadoPagoRateLimitError`
|
|
83
|
+
### `calculate_installments` returns
|
|
84
|
+
```jsonc
|
|
85
|
+
{
|
|
86
|
+
"amount": 12000,
|
|
87
|
+
"offers": [{
|
|
88
|
+
"payment_method_id": "visa",
|
|
89
|
+
"issuer_name": "Galicia",
|
|
90
|
+
"options": [
|
|
91
|
+
{ "installments": 3, "installment_amount": 4000, "total_amount": 12000, "recommended_message": "3 cuotas sin interés de $4.000,00" },
|
|
92
|
+
{ "installments": 6, "installment_amount": 2000, "total_amount": 12000, "recommended_message": "6 cuotas sin interés de $2.000,00" },
|
|
93
|
+
{ "installments": 12, "installment_amount": 1314.20, "total_amount": 15770.40, "recommended_message": "12 cuotas de $1.314,20 ($15.770,40)" }
|
|
94
|
+
]
|
|
95
|
+
}]
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
**Surface `recommended_message` verbatim to the user** — it's already in compliant Argentine Spanish format with proper currency formatting and includes the total when there's interest. AR's E 51/2017 transparency regulation requires this exact phrasing.
|
|
106
99
|
|
|
107
|
-
|
|
100
|
+
### `refund_payment` returns
|
|
101
|
+
```jsonc
|
|
102
|
+
{
|
|
103
|
+
"refund_id": "...",
|
|
104
|
+
"payment_id": "...",
|
|
105
|
+
"amount": 1500,
|
|
106
|
+
"status": "approved",
|
|
107
|
+
"message": "Full refund issued. Funds return to the buyer in 3-10 business days."
|
|
108
|
+
}
|
|
109
|
+
```
|
|
108
110
|
|
|
109
|
-
##
|
|
111
|
+
## status_detail recovery actions (top values)
|
|
112
|
+
|
|
113
|
+
| `status_detail` | What it means | Agent action |
|
|
114
|
+
|---|---|---|
|
|
115
|
+
| `accredited` | Approved, money in seller account | Done. Fulfill order. |
|
|
116
|
+
| `cc_rejected_bad_filled_card_number` | Buyer entered wrong number | "El número de tarjeta es incorrecto, intentá de nuevo" |
|
|
117
|
+
| `cc_rejected_bad_filled_security_code` | CVV wrong | "El código de seguridad no coincide" |
|
|
118
|
+
| `cc_rejected_bad_filled_date` | Expiration wrong | "La fecha de vencimiento es incorrecta" |
|
|
119
|
+
| `cc_rejected_call_for_authorize` | Bank wants user to call | "Llamá a tu banco para autorizar el pago, después intentá de nuevo" |
|
|
120
|
+
| `cc_rejected_card_disabled` | Card disabled | "Tu tarjeta está deshabilitada — usá otra" |
|
|
121
|
+
| `cc_rejected_insufficient_amount` | Not enough funds | "Saldo insuficiente — usá otra tarjeta o método" |
|
|
122
|
+
| `cc_rejected_high_risk` / `cc_rejected_other_reason` | MP risk engine rejection | "El pago fue rechazado. Probá con otro método (Rapipago / account money)" |
|
|
123
|
+
| `cc_rejected_max_attempts` | Too many tries | "Esperá 24h antes de reintentar" |
|
|
124
|
+
| `cc_rejected_invalid_installments` | Cuotas no allowed for this card | "Probá con menos cuotas" — re-call `calculate_installments` |
|
|
125
|
+
| `pending_waiting_payment` | Ticket created (Rapipago/Pago Fácil) | "Pagá el ticket en cualquier sucursal — se acredita en 1-3 días" |
|
|
126
|
+
| `pending_contingency` | MP manual review | "Esperá unos minutos, MP está revisando el pago" |
|
|
127
|
+
|
|
128
|
+
## Critical AR-specific gotchas
|
|
129
|
+
|
|
130
|
+
1. **`statement_descriptor` MAX 13 CHARS.** Long brand names get silently truncated. Use abbreviations (`ASTRO AR` not `ASTRO ARGENTINA`).
|
|
131
|
+
2. **`payer.email` cannot equal seller email** → MP error code 205 / `MercadoPagoSelfPaymentError`. Use a distinct buyer email even in sandbox.
|
|
132
|
+
3. **Sandbox cardholder name selects outcome**: cardholder = `APRO` (approved), `OTHE` (rejected_other), `CONT` (pending_contingency), `CALL` (call_for_authorize), `FUND` (insufficient_amount), `SECU` (bad_filled_security_code), `EXPI` (bad_filled_date), `FORM` (bad_filled_other). DNI = `12345678`. ANY 3-digit CVV in sandbox.
|
|
133
|
+
4. **Test cards (sandbox)**: Visa `4509 9535 6623 3704`, MasterCard `5031 7557 3453 0604`, Amex `3711 803032 57522`, debit Visa `4002 7686 9439 5619`. Expiration any future `MM/YY`.
|
|
134
|
+
5. **`account_money` settles instantly** to seller. Card payments default to T+14 hold for new sellers (drops to T+1 after MP graduates the merchant). Tickets settle 1-3 days after the buyer pays.
|
|
135
|
+
6. **First subscription payment requires CVV** — there is NO API path that bypasses this. The buyer MUST visit the `init_point_url` and complete the first card+CVV payment.
|
|
136
|
+
7. **`back_url` MUST be HTTPS** — even in sandbox. `http://localhost:3000/done` is rejected.
|
|
137
|
+
8. **`payer.identification`** — use `DNI` for consumers, `CUIT` for B2B (required for monotributo / IVA-discriminated invoicing), `CUIL` for employees.
|
|
138
|
+
9. **CVV required on every saved-card charge** in AR by default. Merchant graduation can lift this for trusted sellers.
|
|
139
|
+
10. **Idempotency-Key is mandatory** for POST since 2023. The lib auto-generates from caller-meaningful fields (external_reference + amount + timestamp); pass `idempotencyKey` explicitly if you want exact-match retry semantics.
|
|
140
|
+
11. **`token` is single-use and expires in 7 days.** If a card payment fails, you can't reuse the token — re-tokenize on the frontend.
|
|
141
|
+
|
|
142
|
+
## Cuotas / installments — the killer AR feature
|
|
143
|
+
|
|
144
|
+
This is what makes MP unique vs Stripe in any country. Workflow:
|
|
145
|
+
|
|
146
|
+
1. Buyer's card BIN (first 6 digits) hits your frontend (Cardform exposes it before tokenizing).
|
|
147
|
+
2. Agent calls `calculate_installments({ amount_ars, payment_method_id, bin })`.
|
|
148
|
+
3. Receive `payer_costs` array.
|
|
149
|
+
4. **Surface the `recommended_message` strings verbatim** — they're already in compliant AR format ("3 cuotas sin interés de $X").
|
|
150
|
+
5. User picks installments count.
|
|
151
|
+
6. Agent calls `create_payment({ ..., installments: N })`.
|
|
152
|
+
|
|
153
|
+
**Cuotas Simples** (gov interest-free 3 + 6 mo program) appears automatically as `installment_rate: 0` rows when the merchant category qualifies. Agent doesn't configure — just surfaces.
|
|
154
|
+
|
|
155
|
+
**Issuer-specific promos** (Día de la Madre, Hot Sale, Plan Z Naranja X) appear as new `payer_costs` entries when the BIN matches an active promo. Same treatment: surface verbatim.
|
|
156
|
+
|
|
157
|
+
## Composition with other @ar-agents/* packages
|
|
110
158
|
|
|
111
159
|
| Pair with | Why |
|
|
112
|
-
|
|
113
|
-
| [`@ar-agents/identity`](../identity) | Validate the buyer's CUIT before creating a subscription. Cuts an MP request for malformed CUITs
|
|
114
|
-
| `@ar-agents/whatsapp`
|
|
115
|
-
| `@ar-agents/meta-ads` (planned) | Trigger an MP subscription as the conversion event after a Meta ad click. |
|
|
160
|
+
|---|---|
|
|
161
|
+
| [`@ar-agents/identity`](../identity) | Validate the buyer's CUIT before creating a payment/subscription. Cuts an MP request for malformed CUITs and lets you confirm "factura a nombre de [razón social]" before charging. |
|
|
162
|
+
| [`@ar-agents/whatsapp`](../whatsapp) | Send `init_point_url` to the buyer over WhatsApp instead of email. Combined with this package = the "billing assistant for SaaS argentinos" pattern. |
|
|
116
163
|
|
|
117
|
-
## Performance
|
|
164
|
+
## Performance
|
|
118
165
|
|
|
119
|
-
| Operation |
|
|
120
|
-
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
166
|
+
| Operation | Typical | Worst case |
|
|
167
|
+
|---|---|---|
|
|
168
|
+
| `create_payment_preference` | 200-500ms | 2s |
|
|
169
|
+
| `create_payment` (account_money) | 300-700ms | 2s |
|
|
170
|
+
| `create_payment` (card token) | 500-1500ms | 5s (if 3DS triggered) |
|
|
171
|
+
| `get_payment` | 100-300ms | 1s |
|
|
172
|
+
| `search_payments` | 200-600ms | 2s |
|
|
173
|
+
| `calculate_installments` | 100-300ms | 800ms |
|
|
174
|
+
| `refund_payment` | 300-800ms | 3s |
|
|
175
|
+
| `create_subscription` | 200-600ms | 2s |
|
|
126
176
|
|
|
127
|
-
|
|
128
|
-
auto-charge, but that's outside the agent's control or visibility.
|
|
177
|
+
Rate limit: ~250 req/min per access token. Lib does not retry — wrap with your own backoff if you exceed.
|
|
129
178
|
|
|
130
|
-
##
|
|
179
|
+
## Webhooks (planned for v0.3)
|
|
131
180
|
|
|
132
|
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
- **Webhooks** = MP POSTs to your registered URL on subscription lifecycle events. Use `parseWebhookEvent()` and `verifyWebhookSignature()` from this package.
|
|
181
|
+
v0.2 ships `parseWebhookEvent()` for the `preapproval` topic (subscription lifecycle). Coming in v0.3:
|
|
182
|
+
- `payment` topic webhook parser
|
|
183
|
+
- `point_integration_wh` topic (QR scans)
|
|
184
|
+
- `x-signature` HMAC-SHA256 verification (replacing the v0.1 simpler `parseWebhookSignature`)
|
|
137
185
|
|
|
138
186
|
## What this package will NEVER do
|
|
139
187
|
|
|
140
|
-
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
188
|
+
- Take raw card data in the agent runtime (PCI scope violation).
|
|
189
|
+
- Bypass MP's first-payment-CVV requirement for subscriptions (impossible).
|
|
190
|
+
- Reactivate a cancelled subscription or payment (MP doesn't allow).
|
|
191
|
+
- Implement Marketplace splits (different MP product, different OAuth flow — out of scope until v0.4+).
|
|
192
|
+
- Pay out the seller (transfers + withdrawals are dashboard-only / closed API).
|
|
193
|
+
- Make decisions about pricing or installments — caller's responsibility.
|
|
145
194
|
|
|
146
|
-
##
|
|
195
|
+
## Mercado Pago context (for non-AR agents)
|
|
147
196
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
197
|
+
- **Mercado Pago** = dominant Argentine consumer payment platform (also Brazil/Mexico/Chile/Colombia/Uruguay). Owned by Mercado Libre. Like Stripe in scope but with deeper LATAM-specific features (cuotas sin interés, in-store QR, account_money instant transfer).
|
|
198
|
+
- **Subscription** = `preapproval` in MP's API. Recurring authorization tied to a customer's card.
|
|
199
|
+
- **Sandbox vs production** = different access tokens. `TEST-` prefix = sandbox; `APP_USR-` prefix = production. Both use the same API host.
|
|
200
|
+
- **Site IDs**: AR=MLA, BR=MLB, MX=MLM, CL=MLC, CO=MCO, UY=MLU. v0.2 is verified end-to-end against MLA only.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- v0.2.0 — full Payments surface (the "Stripe Agent Toolkit" for Mercado Pago)
|
|
8
|
+
|
|
9
|
+
Extends from Subscriptions-only (v0.1, 5 tools) to the complete agent toolkit (21 tools). New surface:
|
|
10
|
+
|
|
11
|
+
**Payments (5 tools)**: `create_payment`, `get_payment`, `search_payments`, `cancel_payment`, `capture_payment`. Supports both transparent flow (with card_token) and server-side flow (account_money / Rapipago / Pago Fácil). Auto-generates idempotency keys (mandatory since 2023).
|
|
12
|
+
|
|
13
|
+
**Refunds (2 tools)**: `refund_payment` (full or partial), `list_refunds`. Auto-idempotent on (payment_id, amount).
|
|
14
|
+
|
|
15
|
+
**Checkout Pro (2 tools)**: `create_payment_preference` (THE recommended "agent takes a payment" tool — returns hosted URL, no PCI scope needed), `get_payment_preference`. Configurable max installments, excluded payment types, statement descriptor (13-char AR limit), expiration.
|
|
16
|
+
|
|
17
|
+
**Customers + Cards (4 tools)**: `create_customer` (idempotent on email), `find_customer_by_email`, `list_customer_cards`, `delete_customer_card`. Foundation for saved-card flows.
|
|
18
|
+
|
|
19
|
+
**Payment Methods + Installments (2 tools)**: `list_payment_methods` (lists AR methods: visa, master, naranja, naranja_x, cabal, account_money, rapipago, etc.), `calculate_installments` (THE killer AR feature — returns `recommended_message` strings in compliant Argentine format, includes Cuotas Simples gov program + issuer-specific promos via BIN).
|
|
20
|
+
|
|
21
|
+
**Account (1 tool)**: `get_account_info` (site_id, country, user_type).
|
|
22
|
+
|
|
23
|
+
**v0.1 Subscriptions (5 tools)**: kept identical for backward compatibility.
|
|
24
|
+
|
|
25
|
+
# Live-tested
|
|
26
|
+
|
|
27
|
+
Verified end-to-end against MP sandbox: account info, payment methods (21 AR methods returned), installments (81 visa offers with proper `recommended_message`), preference creation (returns real init_point + sandbox_init_point URLs).
|
|
28
|
+
|
|
29
|
+
# Documentation
|
|
30
|
+
|
|
31
|
+
- AGENTS.md updated with decision tree, status_detail recovery actions (top 12 values), AR-specific gotchas (statement_descriptor 13-char limit, sandbox cardholder name selects outcome, test cards reference, account_money instant settlement vs T+14 card hold, etc.).
|
|
32
|
+
- tools.manifest.json updated to v0.2 with all 21 tools documented (purity, sideEffects, latency, input/output schemas, whenToUse, whenNotToUse).
|
|
33
|
+
|
|
34
|
+
# Bundle size
|
|
35
|
+
|
|
36
|
+
8.07 KB ESM brotli'd (under 22 KB budget). Doubled tool count, still half the size limit.
|
|
37
|
+
|
|
38
|
+
# What's NOT in v0.2 (deferred to v0.3+)
|
|
39
|
+
|
|
40
|
+
- `charge_saved_card` (retokenize + charge in one call) — coming v0.3
|
|
41
|
+
- `create_qr_payment` (in-store dynamic QR) — coming v0.3
|
|
42
|
+
- Marketplace splits (OAuth, application_fee) — v0.4
|
|
43
|
+
- Raw-PAN tokenization — never (PCI scope; agents must use Checkout Pro)
|
|
44
|
+
- Webhook x-signature verification for `payment` topic (v0.1 covers `preapproval`) — v0.3
|
|
45
|
+
|
|
3
46
|
All notable changes to `@ar-agents/mercadopago` are documented here. The format
|
|
4
47
|
follows [Keep a Changelog](https://keepachangelog.com/) and the project adheres
|
|
5
48
|
to [Semantic Versioning](https://semver.org/).
|
|
@@ -9,6 +52,7 @@ to [Semantic Versioning](https://semver.org/).
|
|
|
9
52
|
Initial release. Extracted from the `ar-agents-mp-hello` proof-of-concept.
|
|
10
53
|
|
|
11
54
|
### Added
|
|
55
|
+
|
|
12
56
|
- `MercadoPagoClient` — typed wrapper around MP REST API for preapprovals
|
|
13
57
|
(create / get / cancel / pause / resume).
|
|
14
58
|
- `mercadoPagoTools()` — drop-in tool collection for the Vercel AI SDK 6+.
|
|
@@ -28,6 +72,7 @@ Initial release. Extracted from the `ar-agents-mp-hello` proof-of-concept.
|
|
|
28
72
|
best-fit class.
|
|
29
73
|
|
|
30
74
|
### Known limitations
|
|
75
|
+
|
|
31
76
|
- Subscriptions API only. No one-off Checkout, no Marketplace, no Pix.
|
|
32
77
|
- AR (MLA) verified end-to-end. Other LATAM sites should work but aren't
|
|
33
78
|
exercised by the test suite.
|