@ar-agents/mercadopago 0.1.0 → 0.3.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 +98 -0
- package/dist/index.cjs +1213 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +576 -22
- package/dist/index.d.ts +576 -22
- package/dist/index.js +1212 -61
- package/dist/index.js.map +1 -1
- package/package.json +16 -12
- package/tools.manifest.json +203 -1
package/tools.manifest.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://github.com/ar-agents/ar-agents/blob/main/tools-manifest.schema.json",
|
|
3
3
|
"package": "@ar-agents/mercadopago",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"factory": "mercadoPagoTools",
|
|
6
6
|
"tools": [
|
|
7
7
|
{
|
|
@@ -139,6 +139,208 @@
|
|
|
139
139
|
"whenNotToUse": [
|
|
140
140
|
"Subscription is cancelled — MP doesn't allow resuming cancelled subs (throws MercadoPagoAuthorizeForbiddenError). Create a new subscription instead."
|
|
141
141
|
]
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "create_payment",
|
|
145
|
+
"summary": "Create a one-off payment. Two flows: (a) with `token` from MP frontend SDK for cards, (b) without token for account_money/rapipago/pagofacil.",
|
|
146
|
+
"purity": "io",
|
|
147
|
+
"sideEffects": ["Creates a payment on MP", "May charge buyer if account_money/card token"],
|
|
148
|
+
"constraints": {
|
|
149
|
+
"envVars": ["MP_ACCESS_TOKEN"],
|
|
150
|
+
"externalIO": ["MP REST API POST /v1/payments"],
|
|
151
|
+
"latencyMs": "300-1500 (cards), 200-700 (account_money)",
|
|
152
|
+
"costPerCall": "$0 (creation); MP charges merchant per-transaction fee on success"
|
|
153
|
+
},
|
|
154
|
+
"input": {
|
|
155
|
+
"amount_ars": "number positive",
|
|
156
|
+
"payment_method_id": "string (visa | master | naranja | account_money | rapipago | ...)",
|
|
157
|
+
"payer_email": "string (cannot equal seller email)",
|
|
158
|
+
"token": "string | undefined (required for cards)",
|
|
159
|
+
"installments": "number 1-24 | undefined",
|
|
160
|
+
"external_reference": "string | undefined",
|
|
161
|
+
"identification": "{type: DNI|CUIT|CUIL, number: string} | undefined"
|
|
162
|
+
},
|
|
163
|
+
"output": {
|
|
164
|
+
"payment_id": "string",
|
|
165
|
+
"status": "approved | pending | rejected | in_process | cancelled",
|
|
166
|
+
"status_detail": "string (see AGENTS.md for recovery actions per value)",
|
|
167
|
+
"amount": "number", "currency": "ARS",
|
|
168
|
+
"installments": "number", "payment_method": "string",
|
|
169
|
+
"external_reference": "string | null",
|
|
170
|
+
"date_created": "ISO date", "date_approved": "ISO date | null"
|
|
171
|
+
},
|
|
172
|
+
"whenToUse": [
|
|
173
|
+
"User wants to charge a specific payer email with account_money / Rapipago / Pago Fácil",
|
|
174
|
+
"User has a valid card token from MP frontend SDK and wants server-side charge"
|
|
175
|
+
],
|
|
176
|
+
"whenNotToUse": [
|
|
177
|
+
"User pasted raw card data — REFUSE (PCI scope violation). Use create_payment_preference instead.",
|
|
178
|
+
"User wants recurring billing — use create_subscription"
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "get_payment",
|
|
183
|
+
"summary": "Fetch a single payment by ID. Use after webhook to confirm status.",
|
|
184
|
+
"purity": "io",
|
|
185
|
+
"sideEffects": [],
|
|
186
|
+
"constraints": { "latencyMs": "100-300", "externalIO": ["MP REST GET /v1/payments/:id"] },
|
|
187
|
+
"input": { "payment_id": "string" },
|
|
188
|
+
"output": "Same shape as create_payment output, plus net_received"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"name": "search_payments",
|
|
192
|
+
"summary": "Search payments by external_reference / status / date range. Paginated.",
|
|
193
|
+
"purity": "io",
|
|
194
|
+
"sideEffects": [],
|
|
195
|
+
"constraints": { "latencyMs": "200-600", "externalIO": ["MP REST GET /v1/payments/search"] },
|
|
196
|
+
"input": {
|
|
197
|
+
"external_reference": "string?", "status": "string?",
|
|
198
|
+
"payer_email": "string?", "begin_date": "ISO?", "end_date": "ISO?",
|
|
199
|
+
"limit": "number 1-100, default 30", "offset": "number, default 0"
|
|
200
|
+
},
|
|
201
|
+
"output": { "total": "number", "returned": "number", "offset": "number", "payments": "array of {payment_id, status, amount, currency, payer_email, external_reference, date_created}" }
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"name": "cancel_payment",
|
|
205
|
+
"summary": "Cancel a pending or in_process payment. For approved use refund_payment.",
|
|
206
|
+
"purity": "io",
|
|
207
|
+
"sideEffects": ["Mutates payment status to cancelled on MP"],
|
|
208
|
+
"input": { "payment_id": "string" },
|
|
209
|
+
"output": { "payment_id": "string", "status": "cancelled", "message": "string" }
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "capture_payment",
|
|
213
|
+
"summary": "Capture an authorized credit-card payment created with capture=false. Optional partial amount.",
|
|
214
|
+
"purity": "io",
|
|
215
|
+
"sideEffects": ["Captures funds; settles to seller per MP rules"],
|
|
216
|
+
"input": { "payment_id": "string", "amount_ars": "number? (partial capture)" },
|
|
217
|
+
"output": { "payment_id": "string", "status": "approved", "amount": "number" }
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"name": "refund_payment",
|
|
221
|
+
"summary": "Refund an approved payment. Partial (with amount) or full (omit). Auto-idempotent on (payment_id, amount).",
|
|
222
|
+
"purity": "io",
|
|
223
|
+
"sideEffects": ["Returns funds to buyer; debits seller balance"],
|
|
224
|
+
"constraints": { "latencyMs": "300-800", "externalIO": ["MP REST POST /v1/payments/:id/refunds"] },
|
|
225
|
+
"input": { "payment_id": "string", "amount_ars": "number? (omit for full refund)" },
|
|
226
|
+
"output": { "refund_id": "string", "payment_id": "string", "amount": "number", "status": "approved", "message": "string" },
|
|
227
|
+
"whenToUse": ["User explicitly requests a refund (full or partial)"],
|
|
228
|
+
"whenNotToUse": [
|
|
229
|
+
"Payment is still pending/in_process — use cancel_payment instead",
|
|
230
|
+
"More than 30 days since payment — MP refund window expired"
|
|
231
|
+
],
|
|
232
|
+
"irreversibility": "Refund is irreversible. Confirm amount and payment_id with user first."
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"name": "list_refunds",
|
|
236
|
+
"summary": "List all refunds for a given payment.",
|
|
237
|
+
"purity": "io",
|
|
238
|
+
"sideEffects": [],
|
|
239
|
+
"input": { "payment_id": "string" },
|
|
240
|
+
"output": { "payment_id": "string", "count": "number", "refunds": "array of {refund_id, amount, status, date_created}" }
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"name": "create_payment_preference",
|
|
244
|
+
"summary": "Create a Checkout Pro hosted payment URL. RECOMMENDED for agent flows where you don't have a card token — buyer enters card on MP-hosted form (no PCI scope needed).",
|
|
245
|
+
"purity": "io",
|
|
246
|
+
"sideEffects": ["Creates a preference on MP"],
|
|
247
|
+
"constraints": { "latencyMs": "200-500", "externalIO": ["MP REST POST /checkout/preferences"] },
|
|
248
|
+
"input": {
|
|
249
|
+
"items": "array of {title, quantity, unit_price, description?, picture_url?}",
|
|
250
|
+
"payer_email": "string?", "external_reference": "string?",
|
|
251
|
+
"max_installments": "number 1-24?",
|
|
252
|
+
"statement_descriptor": "string max 13 chars?",
|
|
253
|
+
"excluded_payment_types": "array of (credit_card|debit_card|ticket|atm|bank_transfer)?"
|
|
254
|
+
},
|
|
255
|
+
"output": {
|
|
256
|
+
"preference_id": "string",
|
|
257
|
+
"init_point_url": "string (production)",
|
|
258
|
+
"sandbox_init_point_url": "string (sandbox — use this if your token is TEST-)",
|
|
259
|
+
"external_reference": "string | null",
|
|
260
|
+
"next_step": "Send init_point_url to the customer..."
|
|
261
|
+
},
|
|
262
|
+
"whenToUse": [
|
|
263
|
+
"User wants to charge a payer over WhatsApp/email/SMS",
|
|
264
|
+
"User says 'cobrale $X a [email]' and you don't have a card token"
|
|
265
|
+
],
|
|
266
|
+
"whenNotToUse": [
|
|
267
|
+
"Recurring subscription — use create_subscription",
|
|
268
|
+
"User pasted raw card data — REFUSE (PCI violation)"
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"name": "get_payment_preference",
|
|
273
|
+
"summary": "Fetch a Checkout Pro preference by ID.",
|
|
274
|
+
"purity": "io", "sideEffects": [],
|
|
275
|
+
"input": { "preference_id": "string" },
|
|
276
|
+
"output": "Same as create_payment_preference output, plus items array"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"name": "create_customer",
|
|
280
|
+
"summary": "Create or upsert an MP customer for saving cards / repeat charges. Idempotent on email.",
|
|
281
|
+
"purity": "io",
|
|
282
|
+
"sideEffects": ["Creates customer record on MP if not exists"],
|
|
283
|
+
"input": {
|
|
284
|
+
"email": "string",
|
|
285
|
+
"first_name": "string?", "last_name": "string?",
|
|
286
|
+
"identification": "{type: DNI|CUIT|CUIL, number: string}?"
|
|
287
|
+
},
|
|
288
|
+
"output": { "customer_id": "string", "email": "string", "first_name": "string|null", "last_name": "string|null", "date_created": "ISO" }
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"name": "find_customer_by_email",
|
|
292
|
+
"summary": "Find existing customer by email. Returns null if not found.",
|
|
293
|
+
"purity": "io", "sideEffects": [],
|
|
294
|
+
"input": { "email": "string" },
|
|
295
|
+
"output": { "found": "boolean", "customer_id": "string | null", "email": "string?", "first_name": "string?", "last_name": "string?" }
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
"name": "list_customer_cards",
|
|
299
|
+
"summary": "List saved cards for a customer.",
|
|
300
|
+
"purity": "io", "sideEffects": [],
|
|
301
|
+
"input": { "customer_id": "string" },
|
|
302
|
+
"output": { "customer_id": "string", "count": "number", "cards": "array of {card_id, last_four_digits, expiration_month, expiration_year, payment_method, payment_method_name}" }
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"name": "delete_customer_card",
|
|
306
|
+
"summary": "Delete a saved card. Irreversible.",
|
|
307
|
+
"purity": "io", "sideEffects": ["Removes card from MP customer"],
|
|
308
|
+
"input": { "customer_id": "string", "card_id": "string" },
|
|
309
|
+
"output": { "customer_id": "string", "card_id": "string", "deleted": "true" }
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"name": "list_payment_methods",
|
|
313
|
+
"summary": "List all payment methods enabled for the seller's MP account (visa, master, naranja, naranja_x, cabal, account_money, rapipago, pagofacil, etc.).",
|
|
314
|
+
"purity": "io", "sideEffects": [],
|
|
315
|
+
"input": {},
|
|
316
|
+
"output": { "count": "number", "methods": "array of {id, name, payment_type, status, min_amount, max_amount}" }
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"name": "calculate_installments",
|
|
320
|
+
"summary": "Calculate cuotas options for an amount. THE killer AR feature. Returns recommended_message strings ('12 cuotas sin interés de $X') ready to surface VERBATIM to the user.",
|
|
321
|
+
"purity": "io", "sideEffects": [],
|
|
322
|
+
"constraints": { "latencyMs": "100-300" },
|
|
323
|
+
"input": {
|
|
324
|
+
"amount_ars": "number positive",
|
|
325
|
+
"payment_method_id": "string? (e.g. visa, master, naranja)",
|
|
326
|
+
"bin": "string? 6-8 chars (first digits of card for issuer-specific promos)"
|
|
327
|
+
},
|
|
328
|
+
"output": {
|
|
329
|
+
"amount": "number",
|
|
330
|
+
"offers": "array of {payment_method_id, payment_type_id, issuer_name, options: [{installments, installment_amount, total_amount, installment_rate, recommended_message}]}"
|
|
331
|
+
},
|
|
332
|
+
"whenToUse": [
|
|
333
|
+
"User asks 'cuántas cuotas tiene esta tarjeta?'",
|
|
334
|
+
"Before create_payment with installments > 1 to validate available options",
|
|
335
|
+
"Show options BEFORE the user picks (AR transparency regulation E 51/2017 compliance)"
|
|
336
|
+
]
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
"name": "get_account_info",
|
|
340
|
+
"summary": "Get info about the MP account that owns the access token (site_id, country, user_type).",
|
|
341
|
+
"purity": "io", "sideEffects": [],
|
|
342
|
+
"input": {},
|
|
343
|
+
"output": { "account_id": "string", "email": "string|null", "nickname": "string|null", "country_id": "string|null (AR for Argentina)", "site_id": "string|null (MLA for Argentina)", "user_type": "string|null" }
|
|
142
344
|
}
|
|
143
345
|
]
|
|
144
346
|
}
|