@ar-agents/mercadopago 0.15.2 → 0.16.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.
@@ -0,0 +1,1085 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Site IDs supported by Mercado Pago. The lib targets MLA (Argentina) primarily;
5
+ * other LATAM sites may work for the read paths but the full Subscriptions flow
6
+ * is only verified against MLA.
7
+ */
8
+ declare const SiteIdSchema: z.ZodEnum<{
9
+ MLA: "MLA";
10
+ MLB: "MLB";
11
+ MLM: "MLM";
12
+ MCO: "MCO";
13
+ MLC: "MLC";
14
+ MLU: "MLU";
15
+ }>;
16
+ type SiteId = z.infer<typeof SiteIdSchema>;
17
+ /**
18
+ * Currency identifiers MP exposes. ARS is the supported case for v0.1.
19
+ */
20
+ declare const CurrencyIdSchema: z.ZodEnum<{
21
+ ARS: "ARS";
22
+ USD: "USD";
23
+ BRL: "BRL";
24
+ MXN: "MXN";
25
+ }>;
26
+ type CurrencyId = z.infer<typeof CurrencyIdSchema>;
27
+ /**
28
+ * Recurrence frequency unit for a subscription's auto_recurring config.
29
+ */
30
+ declare const FrequencyTypeSchema: z.ZodEnum<{
31
+ months: "months";
32
+ days: "days";
33
+ }>;
34
+ type FrequencyType = z.infer<typeof FrequencyTypeSchema>;
35
+ /**
36
+ * Lifecycle states a Mercado Pago preapproval can be in. The string is the
37
+ * canonical MP value; we widen to `string` for forward compatibility because
38
+ * MP has historically introduced new states without notice.
39
+ */
40
+ declare const PreapprovalStatusSchema: z.ZodUnion<readonly [z.ZodLiteral<"pending">, z.ZodLiteral<"authorized">, z.ZodLiteral<"paused">, z.ZodLiteral<"cancelled">, z.ZodString]>;
41
+ type PreapprovalStatus = z.infer<typeof PreapprovalStatusSchema>;
42
+ declare const AutoRecurringSchema: z.ZodObject<{
43
+ frequency: z.ZodNumber;
44
+ frequency_type: z.ZodEnum<{
45
+ months: "months";
46
+ days: "days";
47
+ }>;
48
+ transaction_amount: z.ZodNumber;
49
+ currency_id: z.ZodEnum<{
50
+ ARS: "ARS";
51
+ USD: "USD";
52
+ BRL: "BRL";
53
+ MXN: "MXN";
54
+ }>;
55
+ start_date: z.ZodOptional<z.ZodString>;
56
+ end_date: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$strip>;
58
+ type AutoRecurring = z.infer<typeof AutoRecurringSchema>;
59
+ declare const PreapprovalSchema: z.ZodObject<{
60
+ id: z.ZodString;
61
+ status: z.ZodUnion<readonly [z.ZodLiteral<"pending">, z.ZodLiteral<"authorized">, z.ZodLiteral<"paused">, z.ZodLiteral<"cancelled">, z.ZodString]>;
62
+ payer_email: z.ZodString;
63
+ init_point: z.ZodString;
64
+ external_reference: z.ZodOptional<z.ZodString>;
65
+ date_created: z.ZodString;
66
+ last_modified: z.ZodString;
67
+ next_payment_date: z.ZodOptional<z.ZodString>;
68
+ payer_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
69
+ auto_recurring: z.ZodObject<{
70
+ frequency: z.ZodNumber;
71
+ frequency_type: z.ZodEnum<{
72
+ months: "months";
73
+ days: "days";
74
+ }>;
75
+ transaction_amount: z.ZodNumber;
76
+ currency_id: z.ZodEnum<{
77
+ ARS: "ARS";
78
+ USD: "USD";
79
+ BRL: "BRL";
80
+ MXN: "MXN";
81
+ }>;
82
+ start_date: z.ZodOptional<z.ZodString>;
83
+ end_date: z.ZodOptional<z.ZodString>;
84
+ }, z.core.$strip>;
85
+ }, z.core.$strip>;
86
+ type Preapproval = z.infer<typeof PreapprovalSchema>;
87
+ /**
88
+ * Input for creating a preapproval (subscription). Internal field names match
89
+ * MP API semantics; the public client method maps from camelCase Naza-friendly
90
+ * params to the snake_case payload MP expects.
91
+ */
92
+ interface CreatePreapprovalParams {
93
+ /** Short customer-facing description shown at checkout. */
94
+ reason: string;
95
+ /** Email of the buyer. Cannot equal the seller account's email (MP rejects). */
96
+ payerEmail: string;
97
+ /** Recurring amount per cycle. */
98
+ amount: number;
99
+ /** ARS for Argentina. Other currencies depend on the seller account's site. */
100
+ currency: CurrencyId;
101
+ /** Recurrence frequency (e.g., 1 + months = monthly). */
102
+ frequency: number;
103
+ frequencyType: FrequencyType;
104
+ /** HTTPS URL where MP redirects the buyer after first payment. localhost rejected. */
105
+ backUrl: string;
106
+ /** Optional client-side identifier for the subscription. */
107
+ externalReference?: string;
108
+ /**
109
+ * Optional explicit idempotency key. If omitted, the client auto-generates
110
+ * a UUID v4 per call. Pass a deterministic key (e.g., hash of inputs) when
111
+ * you need cross-retry idempotency from the agent layer.
112
+ */
113
+ idempotencyKey?: string;
114
+ }
115
+ /**
116
+ * The shape of an MP webhook notification body for `topic=preapproval`. MP's
117
+ * webhook payload varies by event type; this is the union of fields seen in
118
+ * production.
119
+ */
120
+ declare const WebhookBodySchema: z.ZodObject<{
121
+ type: z.ZodOptional<z.ZodString>;
122
+ topic: z.ZodOptional<z.ZodString>;
123
+ action: z.ZodOptional<z.ZodString>;
124
+ data: z.ZodOptional<z.ZodObject<{
125
+ id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
126
+ }, z.core.$strip>>;
127
+ resource: z.ZodOptional<z.ZodString>;
128
+ user_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
129
+ api_version: z.ZodOptional<z.ZodString>;
130
+ date_created: z.ZodOptional<z.ZodString>;
131
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
132
+ live_mode: z.ZodOptional<z.ZodBoolean>;
133
+ }, z.core.$loose>;
134
+ type WebhookBody = z.infer<typeof WebhookBodySchema>;
135
+ /**
136
+ * Normalized webhook event after parsing. The library extracts topic + dataId
137
+ * from either query params or body, since MP sends them in either location
138
+ * depending on integration version.
139
+ */
140
+ interface ParsedWebhookEvent {
141
+ /** Topic of the event, e.g., "preapproval", "payment", "subscription_authorized_payment". */
142
+ topic: string;
143
+ /** ID of the affected resource. */
144
+ dataId: string;
145
+ /** Action descriptor when present (e.g., "updated", "created"). */
146
+ action: string | null;
147
+ /** Raw body MP sent, for caller inspection / debugging. */
148
+ raw: WebhookBody;
149
+ }
150
+ /**
151
+ * Top-level lifecycle status of a payment. MP-canonical values; widened to
152
+ * string for forward compatibility.
153
+ */
154
+ declare const PaymentStatusSchema: z.ZodUnion<readonly [z.ZodLiteral<"pending">, z.ZodLiteral<"approved">, z.ZodLiteral<"authorized">, z.ZodLiteral<"in_process">, z.ZodLiteral<"in_mediation">, z.ZodLiteral<"rejected">, z.ZodLiteral<"cancelled">, z.ZodLiteral<"refunded">, z.ZodLiteral<"charged_back">, z.ZodString]>;
155
+ type PaymentStatus = z.infer<typeof PaymentStatusSchema>;
156
+ /**
157
+ * The full Payment object MP returns. Many fields are optional because they
158
+ * vary by payment method, status, and integration mode (Checkout Pro vs API).
159
+ */
160
+ declare const PaymentSchema: z.ZodObject<{
161
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
162
+ status: z.ZodUnion<readonly [z.ZodLiteral<"pending">, z.ZodLiteral<"approved">, z.ZodLiteral<"authorized">, z.ZodLiteral<"in_process">, z.ZodLiteral<"in_mediation">, z.ZodLiteral<"rejected">, z.ZodLiteral<"cancelled">, z.ZodLiteral<"refunded">, z.ZodLiteral<"charged_back">, z.ZodString]>;
163
+ status_detail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
164
+ date_created: z.ZodOptional<z.ZodNullable<z.ZodString>>;
165
+ date_approved: z.ZodOptional<z.ZodNullable<z.ZodString>>;
166
+ date_last_updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
167
+ transaction_amount: z.ZodNumber;
168
+ currency_id: z.ZodString;
169
+ installments: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
170
+ payment_method_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
171
+ payment_type_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
172
+ external_reference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
173
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
174
+ payer: z.ZodOptional<z.ZodObject<{
175
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
176
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
177
+ identification: z.ZodOptional<z.ZodNullable<z.ZodObject<{
178
+ type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
179
+ number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
180
+ }, z.core.$strip>>>;
181
+ }, z.core.$loose>>;
182
+ transaction_details: z.ZodOptional<z.ZodObject<{
183
+ net_received_amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
184
+ total_paid_amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
185
+ installment_amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
186
+ }, z.core.$loose>>;
187
+ }, z.core.$loose>;
188
+ type Payment = z.infer<typeof PaymentSchema>;
189
+ /** Params for creating a payment (Checkout API / transparent flow). */
190
+ interface CreatePaymentParams {
191
+ /** Amount in account currency. ARS for Argentina. */
192
+ transactionAmount: number;
193
+ /** Number of installments. Use 1 for no cuotas; AR cards typically allow up to 12. */
194
+ installments?: number;
195
+ /** MP payment_method_id — `visa`, `master`, `naranja`, `account_money`, etc. */
196
+ paymentMethodId: string;
197
+ /** Payer email — REQUIRED. Cannot equal seller email. */
198
+ payerEmail: string;
199
+ /** Card token from MP frontend SDK (Cardform). Required for credit/debit; omit for `account_money` etc. */
200
+ token?: string;
201
+ /** Description shown in payer's MP statement. */
202
+ description?: string;
203
+ /** Your-system identifier for correlation. */
204
+ externalReference?: string;
205
+ /** Optional payer identification (DNI/CUIT) — required for some payment types. */
206
+ identification?: {
207
+ type: "DNI" | "CUIT" | "CUIL";
208
+ number: string;
209
+ };
210
+ /** Webhook override URL. Falls back to dashboard config if omitted. */
211
+ notificationUrl?: string;
212
+ /**
213
+ * Additional information passed to MP for fraud scoring + receipt details.
214
+ *
215
+ * **Critical for fraud scoring**: every field you fill in here improves
216
+ * MP's risk model's confidence and reduces false-positive rejections.
217
+ * For card payments above ~$50k ARS, ALWAYS include `payer` + `ip_address`
218
+ * + `shipments` (when applicable) — payments without enrichment have a
219
+ * 3-5x higher rejection rate per MP's published guidance (RG 5286/2023).
220
+ */
221
+ additionalInfo?: {
222
+ /** Items in the cart — used for receipt + fraud scoring. */
223
+ items?: Array<{
224
+ id?: string;
225
+ title: string;
226
+ quantity: number;
227
+ unit_price: number;
228
+ description?: string;
229
+ picture_url?: string;
230
+ category_id?: string;
231
+ }>;
232
+ /**
233
+ * Buyer profile fields. The more fields populated, the better MP's
234
+ * risk engine can assess the transaction. `registration_date` is
235
+ * particularly impactful (newer accounts = higher risk).
236
+ */
237
+ payer?: {
238
+ first_name?: string;
239
+ last_name?: string;
240
+ phone?: {
241
+ area_code?: string;
242
+ number?: string;
243
+ };
244
+ address?: {
245
+ zip_code?: string;
246
+ street_name?: string;
247
+ street_number?: number;
248
+ };
249
+ /** ISO 8601 date — when the buyer registered on YOUR platform. */
250
+ registration_date?: string;
251
+ /**
252
+ * Whether the buyer is a returning customer. Strong fraud-scoring
253
+ * signal — repeat buyers are lower risk.
254
+ */
255
+ authentication_type?: "Cellphone" | "Email" | "Facebook" | "Gmail" | "Native app" | string;
256
+ /** Whether the buyer has set up 2FA on YOUR platform. */
257
+ is_prime_user?: boolean;
258
+ /** Whether the buyer has paid you successfully before. */
259
+ is_first_purchase_online?: boolean;
260
+ /** ISO 8601 — last successful purchase on your platform. */
261
+ last_purchase?: string;
262
+ };
263
+ /**
264
+ * Shipping info. Used by fraud engine to compare against payer address.
265
+ * Mismatch (different city/province) = higher risk score.
266
+ */
267
+ shipments?: {
268
+ receiver_address?: {
269
+ zip_code?: string;
270
+ street_name?: string;
271
+ street_number?: number;
272
+ floor?: string;
273
+ apartment?: string;
274
+ city_name?: string;
275
+ state_name?: string;
276
+ country_name?: string;
277
+ };
278
+ /** Express shipment flag — fraud engine treats high-value+express as suspicious. */
279
+ express_shipment?: boolean;
280
+ /** True if the buyer picks up at a store (no shipment). Reduces fraud risk. */
281
+ local_pickup?: boolean;
282
+ };
283
+ /**
284
+ * Buyer's IP address (from your X-Forwarded-For / req.headers).
285
+ * **Strongly recommended** for any card payment — MP's fraud engine
286
+ * checks IP geolocation, ASN reputation, proxy/VPN detection.
287
+ * Without IP, MP defaults to "unknown" which raises risk score.
288
+ */
289
+ ip_address?: string;
290
+ /** Referrer URL — useful for affiliate / channel attribution + fraud signal. */
291
+ referral_url?: string;
292
+ };
293
+ /** Statement descriptor — what shows on the buyer's card statement. Max 13 chars. */
294
+ statementDescriptor?: string;
295
+ /** When true, capture is deferred (only for credit cards) — useful for hold flows. */
296
+ capture?: boolean;
297
+ /** Idempotency key — pass the same value on retries to dedupe. Required for non-GET. */
298
+ idempotencyKey?: string;
299
+ }
300
+ interface SearchPaymentsParams {
301
+ /** Filter by external_reference (your-system id). */
302
+ externalReference?: string;
303
+ /** Filter by payment status. */
304
+ status?: PaymentStatus;
305
+ /** Filter by payer email. */
306
+ payerEmail?: string;
307
+ /** Date range for date_created (ISO 8601). */
308
+ beginDate?: string;
309
+ endDate?: string;
310
+ /** Result page (default 0). */
311
+ offset?: number;
312
+ /** Page size (default 30, max 100). */
313
+ limit?: number;
314
+ /** Sort: e.g. "date_created" desc. */
315
+ sort?: string;
316
+ criteria?: "asc" | "desc";
317
+ }
318
+ declare const PaymentsSearchResultSchema: z.ZodObject<{
319
+ paging: z.ZodObject<{
320
+ total: z.ZodNumber;
321
+ limit: z.ZodNumber;
322
+ offset: z.ZodNumber;
323
+ }, z.core.$strip>;
324
+ results: z.ZodArray<z.ZodObject<{
325
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
326
+ status: z.ZodUnion<readonly [z.ZodLiteral<"pending">, z.ZodLiteral<"approved">, z.ZodLiteral<"authorized">, z.ZodLiteral<"in_process">, z.ZodLiteral<"in_mediation">, z.ZodLiteral<"rejected">, z.ZodLiteral<"cancelled">, z.ZodLiteral<"refunded">, z.ZodLiteral<"charged_back">, z.ZodString]>;
327
+ status_detail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
328
+ date_created: z.ZodOptional<z.ZodNullable<z.ZodString>>;
329
+ date_approved: z.ZodOptional<z.ZodNullable<z.ZodString>>;
330
+ date_last_updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
331
+ transaction_amount: z.ZodNumber;
332
+ currency_id: z.ZodString;
333
+ installments: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
334
+ payment_method_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
335
+ payment_type_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
336
+ external_reference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
337
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
338
+ payer: z.ZodOptional<z.ZodObject<{
339
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
340
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
341
+ identification: z.ZodOptional<z.ZodNullable<z.ZodObject<{
342
+ type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
343
+ number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
344
+ }, z.core.$strip>>>;
345
+ }, z.core.$loose>>;
346
+ transaction_details: z.ZodOptional<z.ZodObject<{
347
+ net_received_amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
348
+ total_paid_amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
349
+ installment_amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
350
+ }, z.core.$loose>>;
351
+ }, z.core.$loose>>;
352
+ }, z.core.$strip>;
353
+ type PaymentsSearchResult = z.infer<typeof PaymentsSearchResultSchema>;
354
+ declare const RefundSchema: z.ZodObject<{
355
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
356
+ payment_id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
357
+ amount: z.ZodNumber;
358
+ source: z.ZodOptional<z.ZodNullable<z.ZodObject<{
359
+ id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
360
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
361
+ type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
362
+ }, z.core.$strip>>>;
363
+ date_created: z.ZodOptional<z.ZodNullable<z.ZodString>>;
364
+ status: z.ZodOptional<z.ZodNullable<z.ZodString>>;
365
+ }, z.core.$loose>;
366
+ type Refund = z.infer<typeof RefundSchema>;
367
+ interface CreateRefundParams {
368
+ paymentId: string;
369
+ /** Partial refund amount. Omit for full refund. */
370
+ amount?: number;
371
+ /** Idempotency key — required for retry-safety. */
372
+ idempotencyKey?: string;
373
+ }
374
+ declare const PreferenceItemSchema: z.ZodObject<{
375
+ id: z.ZodOptional<z.ZodString>;
376
+ title: z.ZodString;
377
+ description: z.ZodOptional<z.ZodString>;
378
+ picture_url: z.ZodOptional<z.ZodString>;
379
+ category_id: z.ZodOptional<z.ZodString>;
380
+ quantity: z.ZodNumber;
381
+ unit_price: z.ZodNumber;
382
+ currency_id: z.ZodOptional<z.ZodEnum<{
383
+ ARS: "ARS";
384
+ USD: "USD";
385
+ BRL: "BRL";
386
+ MXN: "MXN";
387
+ }>>;
388
+ }, z.core.$strip>;
389
+ type PreferenceItem = z.infer<typeof PreferenceItemSchema>;
390
+ declare const PreferenceSchema: z.ZodObject<{
391
+ id: z.ZodString;
392
+ init_point: z.ZodOptional<z.ZodString>;
393
+ sandbox_init_point: z.ZodOptional<z.ZodString>;
394
+ client_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
395
+ collector_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
396
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
397
+ id: z.ZodOptional<z.ZodString>;
398
+ title: z.ZodString;
399
+ description: z.ZodOptional<z.ZodString>;
400
+ picture_url: z.ZodOptional<z.ZodString>;
401
+ category_id: z.ZodOptional<z.ZodString>;
402
+ quantity: z.ZodNumber;
403
+ unit_price: z.ZodNumber;
404
+ currency_id: z.ZodOptional<z.ZodEnum<{
405
+ ARS: "ARS";
406
+ USD: "USD";
407
+ BRL: "BRL";
408
+ MXN: "MXN";
409
+ }>>;
410
+ }, z.core.$strip>>>;
411
+ external_reference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
412
+ date_created: z.ZodOptional<z.ZodNullable<z.ZodString>>;
413
+ expires: z.ZodOptional<z.ZodBoolean>;
414
+ expiration_date_from: z.ZodOptional<z.ZodNullable<z.ZodString>>;
415
+ expiration_date_to: z.ZodOptional<z.ZodNullable<z.ZodString>>;
416
+ }, z.core.$loose>;
417
+ type Preference = z.infer<typeof PreferenceSchema>;
418
+ interface CreatePreferenceParams {
419
+ items: Array<{
420
+ title: string;
421
+ quantity: number;
422
+ unit_price: number;
423
+ currency_id?: CurrencyId;
424
+ description?: string;
425
+ picture_url?: string;
426
+ }>;
427
+ payer?: {
428
+ name?: string;
429
+ surname?: string;
430
+ email?: string;
431
+ phone?: {
432
+ area_code?: string;
433
+ number?: string;
434
+ };
435
+ identification?: {
436
+ type: string;
437
+ number: string;
438
+ };
439
+ address?: {
440
+ street_name?: string;
441
+ street_number?: number;
442
+ zip_code?: string;
443
+ };
444
+ };
445
+ /** Where to send the buyer after success/failure/pending. */
446
+ backUrls?: {
447
+ success?: string;
448
+ failure?: string;
449
+ pending?: string;
450
+ };
451
+ /** "approved" → auto-redirect on success; "all" → always; "" → never. */
452
+ autoReturn?: "approved" | "all";
453
+ /** Webhook URL. */
454
+ notificationUrl?: string;
455
+ /** Your-system id for correlation. */
456
+ externalReference?: string;
457
+ /** Max installments offered. Defaults to MP account config. */
458
+ paymentMethods?: {
459
+ excluded_payment_types?: Array<{
460
+ id: string;
461
+ }>;
462
+ excluded_payment_methods?: Array<{
463
+ id: string;
464
+ }>;
465
+ installments?: number;
466
+ default_installments?: number;
467
+ };
468
+ /** Statement descriptor — shows on buyer's card statement. */
469
+ statementDescriptor?: string;
470
+ /** Expiration window for the link itself. */
471
+ expires?: boolean;
472
+ expirationDateFrom?: string;
473
+ expirationDateTo?: string;
474
+ /**
475
+ * Marketplace split — if set, funds route to `collector_id` (the seller)
476
+ * and `marketplaceFee` (in ARS) is credited to the marketplace's MP
477
+ * account. v0.5+. See `MarketplaceParams` for details.
478
+ */
479
+ marketplace?: string;
480
+ marketplaceFee?: number;
481
+ /** Seller's MP user_id. Funds route here when set. */
482
+ collectorId?: string | number;
483
+ /**
484
+ * Optional explicit idempotency key. If omitted, the client auto-generates
485
+ * a UUID v4 per call. Pass a deterministic key (e.g., hash of items +
486
+ * external_reference) when you need cross-retry idempotency from the
487
+ * agent layer.
488
+ */
489
+ idempotencyKey?: string;
490
+ }
491
+ declare const CustomerSchema: z.ZodObject<{
492
+ id: z.ZodString;
493
+ email: z.ZodString;
494
+ first_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
495
+ last_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
496
+ phone: z.ZodOptional<z.ZodNullable<z.ZodObject<{
497
+ area_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
498
+ number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
499
+ }, z.core.$strip>>>;
500
+ identification: z.ZodOptional<z.ZodNullable<z.ZodObject<{
501
+ type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
502
+ number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
503
+ }, z.core.$strip>>>;
504
+ date_created: z.ZodOptional<z.ZodNullable<z.ZodString>>;
505
+ date_last_updated: z.ZodOptional<z.ZodNullable<z.ZodString>>;
506
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
507
+ }, z.core.$loose>;
508
+ type Customer = z.infer<typeof CustomerSchema>;
509
+ declare const CustomerCardSchema: z.ZodObject<{
510
+ id: z.ZodString;
511
+ customer_id: z.ZodString;
512
+ expiration_month: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
513
+ expiration_year: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
514
+ first_six_digits: z.ZodOptional<z.ZodNullable<z.ZodString>>;
515
+ last_four_digits: z.ZodOptional<z.ZodNullable<z.ZodString>>;
516
+ payment_method: z.ZodOptional<z.ZodNullable<z.ZodObject<{
517
+ id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
518
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
519
+ payment_type_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
520
+ }, z.core.$strip>>>;
521
+ date_created: z.ZodOptional<z.ZodNullable<z.ZodString>>;
522
+ }, z.core.$loose>;
523
+ type CustomerCard = z.infer<typeof CustomerCardSchema>;
524
+ interface CreateCustomerParams {
525
+ email: string;
526
+ firstName?: string;
527
+ lastName?: string;
528
+ phone?: {
529
+ areaCode?: string;
530
+ number?: string;
531
+ };
532
+ identification?: {
533
+ type: "DNI" | "CUIT" | "CUIL";
534
+ number: string;
535
+ };
536
+ description?: string;
537
+ }
538
+ declare const PaymentMethodSchema: z.ZodObject<{
539
+ id: z.ZodString;
540
+ name: z.ZodString;
541
+ payment_type_id: z.ZodString;
542
+ status: z.ZodString;
543
+ thumbnail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
544
+ secure_thumbnail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
545
+ min_allowed_amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
546
+ max_allowed_amount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
547
+ }, z.core.$loose>;
548
+ type PaymentMethod = z.infer<typeof PaymentMethodSchema>;
549
+ declare const InstallmentOfferSchema: z.ZodObject<{
550
+ payment_method_id: z.ZodString;
551
+ payment_type_id: z.ZodString;
552
+ issuer: z.ZodOptional<z.ZodNullable<z.ZodObject<{
553
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
554
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
555
+ }, z.core.$strip>>>;
556
+ payer_costs: z.ZodArray<z.ZodObject<{
557
+ installments: z.ZodNumber;
558
+ installment_rate: z.ZodNumber;
559
+ discount_rate: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
560
+ installment_amount: z.ZodNumber;
561
+ total_amount: z.ZodNumber;
562
+ recommended_message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
563
+ }, z.core.$loose>>;
564
+ }, z.core.$loose>;
565
+ type InstallmentOffer = z.infer<typeof InstallmentOfferSchema>;
566
+ declare const QrOrderSchema: z.ZodObject<{
567
+ in_store_order_id: z.ZodString;
568
+ qr_data: z.ZodString;
569
+ }, z.core.$loose>;
570
+ type QrOrder = z.infer<typeof QrOrderSchema>;
571
+ interface CreateQrPaymentParams {
572
+ /** Pre-configured POS external_id from MP dashboard. Required. */
573
+ externalPosId: string;
574
+ /** Total amount in ARS. */
575
+ totalAmount: number;
576
+ /** Display title shown to the buyer when scanning. */
577
+ title: string;
578
+ description?: string;
579
+ /** Webhook URL — MP fires `point_integration_wh` then `payment` topic. */
580
+ notificationUrl?: string;
581
+ /** Your-system identifier for correlation. */
582
+ externalReference?: string;
583
+ /** ISO 8601 expiration (default 10 min from now). */
584
+ expirationDate?: string;
585
+ /** Itemized line items (optional but improves analytics). */
586
+ items?: Array<{
587
+ title: string;
588
+ quantity: number;
589
+ unit_price: number;
590
+ unit_measure?: string;
591
+ total_amount?: number;
592
+ }>;
593
+ }
594
+ declare const CardTokenSchema: z.ZodObject<{
595
+ id: z.ZodString;
596
+ status: z.ZodOptional<z.ZodString>;
597
+ date_due: z.ZodOptional<z.ZodString>;
598
+ card_id: z.ZodOptional<z.ZodString>;
599
+ cardholder: z.ZodOptional<z.ZodUnknown>;
600
+ }, z.core.$loose>;
601
+ type CardToken = z.infer<typeof CardTokenSchema>;
602
+ interface CreateCardTokenParams {
603
+ /** Saved card id (from list_customer_cards). */
604
+ cardId: string;
605
+ /** Customer that owns the card. */
606
+ customerId: string;
607
+ /** CVV — required for AR; MP doesn't store CVV. */
608
+ securityCode: string;
609
+ }
610
+ declare const AccountInfoSchema: z.ZodObject<{
611
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
612
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
613
+ nickname: z.ZodOptional<z.ZodNullable<z.ZodString>>;
614
+ country_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
615
+ site_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
616
+ user_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
617
+ status: z.ZodOptional<z.ZodNullable<z.ZodObject<{
618
+ user_type: z.ZodOptional<z.ZodNullable<z.ZodString>>;
619
+ }, z.core.$loose>>>;
620
+ }, z.core.$loose>;
621
+ type AccountInfo = z.infer<typeof AccountInfoSchema>;
622
+ /**
623
+ * A reusable subscription plan. Different from a per-customer subscription:
624
+ * a plan defines the price + frequency once, then customers subscribe to it
625
+ * via `subscribe_to_plan` (which creates a preapproval pointing at the plan).
626
+ *
627
+ * Use plans for SaaS-style billing where you have a fixed set of tiers
628
+ * (Básico/Pro/Enterprise) instead of negotiating amounts per customer.
629
+ */
630
+ declare const SubscriptionPlanSchema: z.ZodObject<{
631
+ id: z.ZodString;
632
+ status: z.ZodString;
633
+ reason: z.ZodString;
634
+ back_url: z.ZodOptional<z.ZodString>;
635
+ external_reference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
636
+ date_created: z.ZodString;
637
+ last_modified: z.ZodString;
638
+ auto_recurring: z.ZodObject<{
639
+ frequency: z.ZodNumber;
640
+ frequency_type: z.ZodEnum<{
641
+ months: "months";
642
+ days: "days";
643
+ }>;
644
+ transaction_amount: z.ZodNumber;
645
+ currency_id: z.ZodEnum<{
646
+ ARS: "ARS";
647
+ USD: "USD";
648
+ BRL: "BRL";
649
+ MXN: "MXN";
650
+ }>;
651
+ start_date: z.ZodOptional<z.ZodString>;
652
+ end_date: z.ZodOptional<z.ZodString>;
653
+ }, z.core.$strip>;
654
+ }, z.core.$loose>;
655
+ type SubscriptionPlan = z.infer<typeof SubscriptionPlanSchema>;
656
+ interface CreateSubscriptionPlanParams {
657
+ /** Customer-facing plan name shown at checkout. */
658
+ reason: string;
659
+ /** Where MP redirects buyer after first payment. HTTPS only. */
660
+ backUrl: string;
661
+ /** Recurrence (e.g., 1 + months = monthly). */
662
+ frequency: number;
663
+ frequencyType: FrequencyType;
664
+ /** Amount per cycle. */
665
+ amount: number;
666
+ /** ARS for AR. */
667
+ currency: CurrencyId;
668
+ /** Optional plan-level identifier from your system. */
669
+ externalReference?: string;
670
+ /** Free trial days before first charge. */
671
+ freeTrialFrequency?: number;
672
+ freeTrialFrequencyType?: FrequencyType;
673
+ }
674
+ declare const StoreSchema: z.ZodObject<{
675
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
676
+ name: z.ZodOptional<z.ZodString>;
677
+ external_id: z.ZodOptional<z.ZodString>;
678
+ date_creation: z.ZodOptional<z.ZodString>;
679
+ location: z.ZodOptional<z.ZodObject<{
680
+ address_line: z.ZodOptional<z.ZodString>;
681
+ city_name: z.ZodOptional<z.ZodString>;
682
+ state_name: z.ZodOptional<z.ZodString>;
683
+ country_id: z.ZodOptional<z.ZodString>;
684
+ latitude: z.ZodOptional<z.ZodNumber>;
685
+ longitude: z.ZodOptional<z.ZodNumber>;
686
+ }, z.core.$loose>>;
687
+ }, z.core.$loose>;
688
+ type Store = z.infer<typeof StoreSchema>;
689
+ interface CreateStoreParams {
690
+ /** Display name for the store. */
691
+ name: string;
692
+ /** Caller-defined identifier (must be unique within the seller's stores). */
693
+ externalId: string;
694
+ /** Optional physical location. */
695
+ location?: {
696
+ addressLine?: string;
697
+ cityName?: string;
698
+ stateName?: string;
699
+ countryId?: string;
700
+ latitude?: number;
701
+ longitude?: number;
702
+ };
703
+ }
704
+ declare const PosSchema: z.ZodObject<{
705
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
706
+ name: z.ZodOptional<z.ZodString>;
707
+ external_id: z.ZodOptional<z.ZodString>;
708
+ store_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
709
+ category: z.ZodOptional<z.ZodNumber>;
710
+ fixed_amount: z.ZodOptional<z.ZodBoolean>;
711
+ qr: z.ZodOptional<z.ZodObject<{
712
+ template_image: z.ZodOptional<z.ZodString>;
713
+ image: z.ZodOptional<z.ZodString>;
714
+ }, z.core.$loose>>;
715
+ date_creation: z.ZodOptional<z.ZodString>;
716
+ }, z.core.$loose>;
717
+ type Pos = z.infer<typeof PosSchema>;
718
+ interface CreatePosParams {
719
+ /** Display name. */
720
+ name: string;
721
+ /** Caller-defined POS id (used in QR endpoints; unique within store). */
722
+ externalId: string;
723
+ /** Parent store id (number from createStore). */
724
+ storeId: string | number;
725
+ /** MP category code (default 621102 = Other Food and Beverage Services). */
726
+ category?: number;
727
+ /** If true, the QR has a fixed amount; if false, dynamic per-order. */
728
+ fixedAmount?: boolean;
729
+ }
730
+ declare const DisputeSchema: z.ZodObject<{
731
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
732
+ status: z.ZodString;
733
+ resource: z.ZodOptional<z.ZodString>;
734
+ resource_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
735
+ amount: z.ZodOptional<z.ZodNumber>;
736
+ date_created: z.ZodOptional<z.ZodString>;
737
+ reason: z.ZodOptional<z.ZodString>;
738
+ resolution: z.ZodOptional<z.ZodObject<{
739
+ reason: z.ZodOptional<z.ZodString>;
740
+ result: z.ZodOptional<z.ZodString>;
741
+ date: z.ZodOptional<z.ZodString>;
742
+ }, z.core.$loose>>;
743
+ documents: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
744
+ reason_description: z.ZodOptional<z.ZodString>;
745
+ }, z.core.$loose>;
746
+ type Dispute = z.infer<typeof DisputeSchema>;
747
+ declare const SubscriptionPaymentSchema: z.ZodObject<{
748
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
749
+ preapproval_id: z.ZodOptional<z.ZodString>;
750
+ status: z.ZodString;
751
+ payment_id: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
752
+ transaction_amount: z.ZodOptional<z.ZodNumber>;
753
+ currency_id: z.ZodOptional<z.ZodString>;
754
+ date_created: z.ZodOptional<z.ZodString>;
755
+ debit_date: z.ZodOptional<z.ZodString>;
756
+ next_retry_date: z.ZodOptional<z.ZodNullable<z.ZodString>>;
757
+ retry_attempt: z.ZodOptional<z.ZodNumber>;
758
+ reason: z.ZodOptional<z.ZodString>;
759
+ }, z.core.$loose>;
760
+ type SubscriptionPayment = z.infer<typeof SubscriptionPaymentSchema>;
761
+ declare const IdentificationTypeSchema: z.ZodObject<{
762
+ id: z.ZodString;
763
+ name: z.ZodString;
764
+ type: z.ZodString;
765
+ min_length: z.ZodOptional<z.ZodNumber>;
766
+ max_length: z.ZodOptional<z.ZodNumber>;
767
+ }, z.core.$loose>;
768
+ type IdentificationType = z.infer<typeof IdentificationTypeSchema>;
769
+ declare const IssuerSchema: z.ZodObject<{
770
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
771
+ name: z.ZodString;
772
+ secure_thumbnail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
773
+ thumbnail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
774
+ processing_mode: z.ZodOptional<z.ZodString>;
775
+ status: z.ZodOptional<z.ZodString>;
776
+ }, z.core.$loose>;
777
+ type Issuer = z.infer<typeof IssuerSchema>;
778
+ /** Topics MP can fire webhooks for. Add more as MP exposes them. */
779
+ declare const WebhookTopicSchema: z.ZodEnum<{
780
+ payment: "payment";
781
+ subscription_authorized_payment: "subscription_authorized_payment";
782
+ subscription_preapproval: "subscription_preapproval";
783
+ merchant_order: "merchant_order";
784
+ point_integration_wh: "point_integration_wh";
785
+ stop_delivery_op_wh: "stop_delivery_op_wh";
786
+ }>;
787
+ type WebhookTopic = z.infer<typeof WebhookTopicSchema>;
788
+ declare const WebhookConfigSchema: z.ZodObject<{
789
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
790
+ url: z.ZodOptional<z.ZodString>;
791
+ status: z.ZodOptional<z.ZodString>;
792
+ topic: z.ZodOptional<z.ZodString>;
793
+ date_created: z.ZodOptional<z.ZodString>;
794
+ date_modified: z.ZodOptional<z.ZodString>;
795
+ }, z.core.$loose>;
796
+ type WebhookConfig = z.infer<typeof WebhookConfigSchema>;
797
+ interface CreateWebhookParams {
798
+ url: string;
799
+ /** Topic to subscribe to. */
800
+ topic: WebhookTopic | string;
801
+ }
802
+ /**
803
+ * Token response from MP's OAuth `/oauth/token` endpoint. The `access_token`
804
+ * is what you use to make API calls AS the linked seller; the `refresh_token`
805
+ * is what you use to refresh the access_token before expiration (~6 hours).
806
+ *
807
+ * **Persist the refresh_token**: it does NOT expire and is the only way to
808
+ * keep the integration alive long-term.
809
+ *
810
+ * **Always store `user_id`** alongside the tokens — it identifies WHICH
811
+ * seller these tokens belong to (you'll have many in a marketplace).
812
+ */
813
+ declare const OAuthTokenSchema: z.ZodObject<{
814
+ access_token: z.ZodString;
815
+ token_type: z.ZodOptional<z.ZodString>;
816
+ expires_in: z.ZodOptional<z.ZodNumber>;
817
+ scope: z.ZodOptional<z.ZodString>;
818
+ user_id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
819
+ refresh_token: z.ZodOptional<z.ZodString>;
820
+ public_key: z.ZodOptional<z.ZodString>;
821
+ live_mode: z.ZodOptional<z.ZodBoolean>;
822
+ }, z.core.$loose>;
823
+ type OAuthToken = z.infer<typeof OAuthTokenSchema>;
824
+ /**
825
+ * Status of an Order. Distinct from Payment status — an Order can have
826
+ * multiple payments and the Order status reflects the aggregate state.
827
+ */
828
+ declare const OrderStatusSchema: z.ZodUnion<readonly [z.ZodLiteral<"created">, z.ZodLiteral<"processed">, z.ZodLiteral<"action_required">, z.ZodLiteral<"canceled">, z.ZodLiteral<"expired">, z.ZodLiteral<"refunded">, z.ZodString]>;
829
+ type OrderStatus = z.infer<typeof OrderStatusSchema>;
830
+ declare const OrderItemSchema: z.ZodObject<{
831
+ title: z.ZodString;
832
+ unit_price: z.ZodNumber;
833
+ quantity: z.ZodNumber;
834
+ description: z.ZodOptional<z.ZodString>;
835
+ id: z.ZodOptional<z.ZodString>;
836
+ category_id: z.ZodOptional<z.ZodString>;
837
+ picture_url: z.ZodOptional<z.ZodString>;
838
+ }, z.core.$loose>;
839
+ type OrderItem = z.infer<typeof OrderItemSchema>;
840
+ declare const OrderSchema: z.ZodObject<{
841
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
842
+ type: z.ZodOptional<z.ZodString>;
843
+ status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"created">, z.ZodLiteral<"processed">, z.ZodLiteral<"action_required">, z.ZodLiteral<"canceled">, z.ZodLiteral<"expired">, z.ZodLiteral<"refunded">, z.ZodString]>>;
844
+ status_detail: z.ZodOptional<z.ZodString>;
845
+ external_reference: z.ZodOptional<z.ZodString>;
846
+ total_amount: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
847
+ currency_id: z.ZodOptional<z.ZodString>;
848
+ date_created: z.ZodOptional<z.ZodString>;
849
+ date_last_updated: z.ZodOptional<z.ZodString>;
850
+ items: z.ZodOptional<z.ZodArray<z.ZodObject<{
851
+ title: z.ZodString;
852
+ unit_price: z.ZodNumber;
853
+ quantity: z.ZodNumber;
854
+ description: z.ZodOptional<z.ZodString>;
855
+ id: z.ZodOptional<z.ZodString>;
856
+ category_id: z.ZodOptional<z.ZodString>;
857
+ picture_url: z.ZodOptional<z.ZodString>;
858
+ }, z.core.$loose>>>;
859
+ transactions: z.ZodOptional<z.ZodObject<{
860
+ payments: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
861
+ refunds: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
862
+ }, z.core.$loose>>;
863
+ capture_mode: z.ZodOptional<z.ZodString>;
864
+ }, z.core.$loose>;
865
+ type Order = z.infer<typeof OrderSchema>;
866
+ interface CreateOrderParams {
867
+ /**
868
+ * Order type. Common values:
869
+ * - "online" — checkout-style (the most common)
870
+ * - "in_store" — POS QR / in-person
871
+ */
872
+ type: "online" | "in_store" | string;
873
+ /** Currency (e.g. "ARS"). */
874
+ currency_id?: string;
875
+ /** External reference for reconciliation (your internal id). */
876
+ external_reference?: string;
877
+ /** Items being ordered. */
878
+ items?: OrderItem[];
879
+ /** Total amount if you'd rather not itemize. */
880
+ total_amount?: number;
881
+ /** Customer info (payer). */
882
+ payer?: {
883
+ email?: string;
884
+ first_name?: string;
885
+ last_name?: string;
886
+ identification?: {
887
+ type?: string;
888
+ number?: string;
889
+ };
890
+ };
891
+ /**
892
+ * Capture mode:
893
+ * - "automatic" (default) — charge immediately when paid.
894
+ * - "manual" — authorize only, capture later via captureOrder().
895
+ */
896
+ capture_mode?: "automatic" | "manual";
897
+ /**
898
+ * Notification URL — MP fires webhooks for order lifecycle events here.
899
+ */
900
+ notification_url?: string;
901
+ /**
902
+ * Marketplace fee + collector — required for marketplace integrations
903
+ * where YOU collect on behalf of a third-party seller (you take a fee,
904
+ * the rest goes to the seller).
905
+ */
906
+ marketplace?: string;
907
+ marketplace_fee?: number;
908
+ collector_id?: string | number;
909
+ }
910
+ /**
911
+ * Marketplace fee + collector params, applied to a Preference or Order.
912
+ *
913
+ * **How it works**: when you create a Preference or Order with
914
+ * `collector_id` set to a SELLER's MP user_id (not yours), and you have a
915
+ * valid OAuth access_token for that seller, MP routes the funds to the
916
+ * seller's MP account, and credits `marketplace_fee` (in ARS, not %) to
917
+ * YOUR marketplace account.
918
+ *
919
+ * Used for two-sided platforms (Rappi, MercadoLibre, Tienda Nube, etc.)
920
+ * where your platform takes a fee and the seller keeps the rest.
921
+ */
922
+ interface MarketplaceParams {
923
+ /**
924
+ * Marketplace identifier — your application's marketplace name (you set
925
+ * this when registering your app in MP's dev panel).
926
+ */
927
+ marketplace?: string;
928
+ /**
929
+ * Fee in ARS (NOT a percentage) that goes to your marketplace account.
930
+ * Compute it from your own commission rate before passing.
931
+ */
932
+ marketplace_fee?: number;
933
+ /**
934
+ * The SELLER's MP user_id. The funds go to this account; the
935
+ * `marketplace_fee` is split off and goes to YOUR account.
936
+ * Get this from `OAuthToken.user_id` after the seller authorizes your app.
937
+ */
938
+ collector_id?: string | number;
939
+ /**
940
+ * Optional: split among multiple sellers. If set, `collector_id` /
941
+ * `marketplace_fee` are ignored.
942
+ */
943
+ application_fee?: number;
944
+ }
945
+ /**
946
+ * Account balance snapshot. Sum of `available + unavailable` is the seller's
947
+ * total Mercado Pago balance.
948
+ *
949
+ * - `available` — funds the seller can withdraw or pay with right now.
950
+ * - `unavailable` — funds in retention (typically 14-21 days for new sellers
951
+ * or for risk-flagged transactions). Becomes `available` automatically.
952
+ */
953
+ declare const AccountBalanceSchema: z.ZodObject<{
954
+ user_id: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>;
955
+ available_balance: z.ZodNumber;
956
+ unavailable_balance: z.ZodNumber;
957
+ total_amount: z.ZodNumber;
958
+ currency_id: z.ZodDefault<z.ZodString>;
959
+ }, z.core.$loose>;
960
+ type AccountBalance = z.infer<typeof AccountBalanceSchema>;
961
+ /**
962
+ * Account movement (a single line in the seller's MP "movements" log).
963
+ * Includes incoming payments, outgoing transfers, refunds, holdings, etc.
964
+ */
965
+ declare const AccountMovementSchema: z.ZodObject<{
966
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
967
+ type: z.ZodString;
968
+ description: z.ZodOptional<z.ZodString>;
969
+ amount: z.ZodNumber;
970
+ currency_id: z.ZodOptional<z.ZodString>;
971
+ status: z.ZodOptional<z.ZodString>;
972
+ date_created: z.ZodOptional<z.ZodString>;
973
+ date_released: z.ZodOptional<z.ZodString>;
974
+ reference_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
975
+ payment_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
976
+ }, z.core.$loose>;
977
+ type AccountMovement = z.infer<typeof AccountMovementSchema>;
978
+ /**
979
+ * A scheduled or completed transfer from the MP account to the seller's
980
+ * registered bank account (CBU). Settlements are the core of "when do I
981
+ * actually get paid".
982
+ */
983
+ declare const SettlementSchema: z.ZodObject<{
984
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
985
+ status: z.ZodOptional<z.ZodString>;
986
+ amount: z.ZodOptional<z.ZodNumber>;
987
+ currency_id: z.ZodOptional<z.ZodString>;
988
+ date_created: z.ZodOptional<z.ZodString>;
989
+ date_scheduled: z.ZodOptional<z.ZodString>;
990
+ date_processed: z.ZodOptional<z.ZodString>;
991
+ bank_account: z.ZodOptional<z.ZodObject<{
992
+ cbu: z.ZodOptional<z.ZodString>;
993
+ bank_name: z.ZodOptional<z.ZodString>;
994
+ }, z.core.$loose>>;
995
+ }, z.core.$loose>;
996
+ type Settlement = z.infer<typeof SettlementSchema>;
997
+ type ThreeDSStatus = "not_required" | "frictionless" | "challenge_required" | "rejected" | "unknown";
998
+ interface ThreeDSInfo {
999
+ /** High-level status — the field most agents care about. */
1000
+ status: ThreeDSStatus;
1001
+ /** Raw `three_d_secure_mode` field from the payment, if present. */
1002
+ mode: string | null;
1003
+ /**
1004
+ * URL the buyer must visit to complete the 3DS challenge, if one was
1005
+ * triggered. `null` for frictionless/not_required.
1006
+ */
1007
+ challengeUrl: string | null;
1008
+ /** Human-readable explanation suitable for surfacing to the user. */
1009
+ description: string;
1010
+ }
1011
+ declare const MerchantOrderSchema: z.ZodObject<{
1012
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
1013
+ status: z.ZodOptional<z.ZodString>;
1014
+ external_reference: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1015
+ preference_id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
1016
+ payments: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
1017
+ shipments: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
1018
+ payer: z.ZodOptional<z.ZodUnknown>;
1019
+ collector: z.ZodOptional<z.ZodUnknown>;
1020
+ marketplace: z.ZodOptional<z.ZodString>;
1021
+ total_amount: z.ZodOptional<z.ZodNumber>;
1022
+ paid_amount: z.ZodOptional<z.ZodNumber>;
1023
+ refunded_amount: z.ZodOptional<z.ZodNumber>;
1024
+ shipping_cost: z.ZodOptional<z.ZodNumber>;
1025
+ date_created: z.ZodOptional<z.ZodString>;
1026
+ last_updated: z.ZodOptional<z.ZodString>;
1027
+ site_id: z.ZodOptional<z.ZodString>;
1028
+ order_status: z.ZodOptional<z.ZodString>;
1029
+ }, z.core.$loose>;
1030
+ type MerchantOrder = z.infer<typeof MerchantOrderSchema>;
1031
+ declare const BankAccountSchema: z.ZodObject<{
1032
+ id: z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>;
1033
+ cbu: z.ZodOptional<z.ZodString>;
1034
+ alias: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1035
+ bank_name: z.ZodOptional<z.ZodString>;
1036
+ account_type: z.ZodOptional<z.ZodString>;
1037
+ status: z.ZodOptional<z.ZodString>;
1038
+ is_default: z.ZodOptional<z.ZodBoolean>;
1039
+ date_created: z.ZodOptional<z.ZodString>;
1040
+ }, z.core.$loose>;
1041
+ type BankAccount = z.infer<typeof BankAccountSchema>;
1042
+ declare const PointDeviceSchema: z.ZodObject<{
1043
+ id: z.ZodString;
1044
+ pos_id: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
1045
+ store_id: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
1046
+ external_pos_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1047
+ operating_mode: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"PDV">, z.ZodLiteral<"STANDALONE">, z.ZodString]>>;
1048
+ }, z.core.$loose>;
1049
+ type PointDevice = z.infer<typeof PointDeviceSchema>;
1050
+ type PointPaymentIntentState = "OPEN" | "PROCESSING" | "FINISHED" | "CANCELED" | "ERROR" | string;
1051
+ declare const PointPaymentIntentSchema: z.ZodObject<{
1052
+ id: z.ZodString;
1053
+ device_id: z.ZodOptional<z.ZodString>;
1054
+ amount: z.ZodOptional<z.ZodNumber>;
1055
+ state: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"OPEN">, z.ZodLiteral<"PROCESSING">, z.ZodLiteral<"FINISHED">, z.ZodLiteral<"CANCELED">, z.ZodLiteral<"ERROR">, z.ZodString]>>;
1056
+ payment: z.ZodOptional<z.ZodObject<{
1057
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
1058
+ type: z.ZodOptional<z.ZodString>;
1059
+ installments: z.ZodOptional<z.ZodNumber>;
1060
+ installments_cost: z.ZodOptional<z.ZodString>;
1061
+ print_on_terminal: z.ZodOptional<z.ZodBoolean>;
1062
+ }, z.core.$loose>>;
1063
+ additional_info: z.ZodOptional<z.ZodUnknown>;
1064
+ }, z.core.$loose>;
1065
+ type PointPaymentIntent = z.infer<typeof PointPaymentIntentSchema>;
1066
+ interface CreatePointPaymentIntentParams {
1067
+ /** Amount in centavos (yes, centavos — Point API differs from Payments API). */
1068
+ amount: number;
1069
+ /** Description shown on the device screen + the buyer's receipt. */
1070
+ description?: string;
1071
+ /** Your-system reference (echoed back in the resulting Payment). */
1072
+ externalReference?: string;
1073
+ /** Number of installments (default 1). */
1074
+ installments?: number;
1075
+ /** "seller" or "buyer" — who pays the installment cost. */
1076
+ installmentsCost?: "seller" | "buyer";
1077
+ /**
1078
+ * Print receipt on the terminal (default true). Some kiosks set false.
1079
+ */
1080
+ printOnTerminal?: boolean;
1081
+ /** Ticket number (your sequential receipt number). */
1082
+ ticketNumber?: string;
1083
+ }
1084
+
1085
+ export type { PreapprovalStatus as $, AccountInfo as A, Settlement as B, CreatePreapprovalParams as C, Dispute as D, BankAccount as E, PointDevice as F, CreatePointPaymentIntentParams as G, PointPaymentIntent as H, InstallmentOffer as I, ParsedWebhookEvent as J, OAuthToken as K, AutoRecurring as L, MerchantOrder as M, CurrencyId as N, Order as O, Preapproval as P, QrOrder as Q, Refund as R, SearchPaymentsParams as S, ThreeDSInfo as T, FrequencyType as U, MarketplaceParams as V, WebhookConfig as W, OrderItem as X, OrderStatus as Y, PaymentStatus as Z, PointPaymentIntentState as _, CreatePaymentParams as a, PreferenceItem as a0, SiteId as a1, ThreeDSStatus as a2, WebhookBody as a3, WebhookTopic as a4, Payment as b, PaymentsSearchResult as c, CreateRefundParams as d, CreatePreferenceParams as e, Preference as f, CreateCustomerParams as g, Customer as h, CustomerCard as i, PaymentMethod as j, CreateCardTokenParams as k, CardToken as l, CreateQrPaymentParams as m, CreateSubscriptionPlanParams as n, SubscriptionPlan as o, SubscriptionPayment as p, CreateStoreParams as q, Store as r, CreatePosParams as s, Pos as t, IdentificationType as u, Issuer as v, CreateWebhookParams as w, CreateOrderParams as x, AccountBalance as y, AccountMovement as z };