@sly_ai/sdk 0.1.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.
Files changed (60) hide show
  1. package/README.md +346 -0
  2. package/dist/a2a.d.mts +108 -0
  3. package/dist/a2a.d.ts +108 -0
  4. package/dist/a2a.js +173 -0
  5. package/dist/a2a.js.map +1 -0
  6. package/dist/a2a.mjs +171 -0
  7. package/dist/a2a.mjs.map +1 -0
  8. package/dist/acp.d.mts +201 -0
  9. package/dist/acp.d.ts +201 -0
  10. package/dist/acp.js +143 -0
  11. package/dist/acp.js.map +1 -0
  12. package/dist/acp.mjs +141 -0
  13. package/dist/acp.mjs.map +1 -0
  14. package/dist/ap2.d.mts +188 -0
  15. package/dist/ap2.d.ts +188 -0
  16. package/dist/ap2.js +135 -0
  17. package/dist/ap2.js.map +1 -0
  18. package/dist/ap2.mjs +133 -0
  19. package/dist/ap2.mjs.map +1 -0
  20. package/dist/cards.d.mts +750 -0
  21. package/dist/cards.d.ts +750 -0
  22. package/dist/cards.js +373 -0
  23. package/dist/cards.js.map +1 -0
  24. package/dist/cards.mjs +369 -0
  25. package/dist/cards.mjs.map +1 -0
  26. package/dist/client-Cwe2CLU7.d.mts +41 -0
  27. package/dist/client-CyJe3uWO.d.ts +41 -0
  28. package/dist/index.d.mts +662 -0
  29. package/dist/index.d.ts +662 -0
  30. package/dist/index.js +2709 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/index.mjs +2700 -0
  33. package/dist/index.mjs.map +1 -0
  34. package/dist/langchain.d.mts +11 -0
  35. package/dist/langchain.d.ts +11 -0
  36. package/dist/langchain.js +25 -0
  37. package/dist/langchain.js.map +1 -0
  38. package/dist/langchain.mjs +23 -0
  39. package/dist/langchain.mjs.map +1 -0
  40. package/dist/types-df1EICn_.d.mts +165 -0
  41. package/dist/types-df1EICn_.d.ts +165 -0
  42. package/dist/ucp.d.mts +844 -0
  43. package/dist/ucp.d.ts +844 -0
  44. package/dist/ucp.js +616 -0
  45. package/dist/ucp.js.map +1 -0
  46. package/dist/ucp.mjs +614 -0
  47. package/dist/ucp.mjs.map +1 -0
  48. package/dist/vercel.d.mts +178 -0
  49. package/dist/vercel.d.ts +178 -0
  50. package/dist/vercel.js +143 -0
  51. package/dist/vercel.js.map +1 -0
  52. package/dist/vercel.mjs +138 -0
  53. package/dist/vercel.mjs.map +1 -0
  54. package/dist/x402.d.mts +209 -0
  55. package/dist/x402.d.ts +209 -0
  56. package/dist/x402.js +476 -0
  57. package/dist/x402.js.map +1 -0
  58. package/dist/x402.mjs +471 -0
  59. package/dist/x402.mjs.map +1 -0
  60. package/package.json +118 -0
package/dist/ucp.d.ts ADDED
@@ -0,0 +1,844 @@
1
+ import { S as SlyClient } from './client-CyJe3uWO.js';
2
+ import './types-df1EICn_.js';
3
+
4
+ /**
5
+ * UCP (Universal Commerce Protocol) Types for SDK
6
+ *
7
+ * Types for interacting with PayOS UCP settlement and merchant discovery.
8
+ *
9
+ * @see Story 43.9: UCP Client Module
10
+ */
11
+ /**
12
+ * UCP Profile - fetched from /.well-known/ucp
13
+ */
14
+ interface UCPProfile {
15
+ ucp: {
16
+ version: string;
17
+ services: Record<string, UCPService>;
18
+ capabilities: UCPCapability[];
19
+ };
20
+ business?: {
21
+ name: string;
22
+ logo_url?: string;
23
+ support_email?: string;
24
+ };
25
+ payment?: {
26
+ handlers: UCPPaymentHandler[];
27
+ };
28
+ checkout?: {
29
+ endpoint: string;
30
+ supported_currencies: string[];
31
+ payment_handlers: string[];
32
+ };
33
+ }
34
+ interface UCPService {
35
+ version: string;
36
+ spec?: string;
37
+ rest?: {
38
+ schema: string;
39
+ endpoint: string;
40
+ };
41
+ mcp?: {
42
+ endpoint: string;
43
+ tools: string[];
44
+ };
45
+ }
46
+ interface UCPCapability {
47
+ name: string;
48
+ version: string;
49
+ description?: string;
50
+ }
51
+ interface UCPPaymentHandler {
52
+ id: string;
53
+ name: string;
54
+ version: string;
55
+ spec?: string;
56
+ supported_currencies: string[];
57
+ supported_corridors: UCPCorridor[];
58
+ }
59
+ interface UCPCorridor {
60
+ id: string;
61
+ name: string;
62
+ source_currency: string;
63
+ destination_currency: string;
64
+ destination_country: string;
65
+ rail: 'pix' | 'spei' | 'wire' | 'usdc';
66
+ estimated_settlement: string;
67
+ }
68
+ interface UCPQuoteRequest {
69
+ corridor: 'pix' | 'spei';
70
+ amount: number;
71
+ currency: 'USD' | 'USDC';
72
+ }
73
+ interface UCPQuote {
74
+ from_amount: number;
75
+ from_currency: string;
76
+ to_amount: number;
77
+ to_currency: string;
78
+ fx_rate: number;
79
+ fees: number;
80
+ expires_at: string;
81
+ }
82
+ interface UCPTokenRequest {
83
+ corridor: 'pix' | 'spei';
84
+ amount: number;
85
+ currency: 'USD' | 'USDC';
86
+ recipient: UCPRecipient;
87
+ metadata?: Record<string, unknown>;
88
+ }
89
+ type UCPRecipient = UCPPixRecipient | UCPSpeiRecipient;
90
+ interface UCPPixRecipient {
91
+ type: 'pix';
92
+ pix_key: string;
93
+ pix_key_type: 'cpf' | 'cnpj' | 'email' | 'phone' | 'evp';
94
+ name: string;
95
+ tax_id?: string;
96
+ }
97
+ interface UCPSpeiRecipient {
98
+ type: 'spei';
99
+ clabe: string;
100
+ name: string;
101
+ rfc?: string;
102
+ }
103
+ interface UCPToken {
104
+ token: string;
105
+ settlement_id: string;
106
+ quote: UCPQuote;
107
+ expires_at: string;
108
+ created_at: string;
109
+ }
110
+ interface UCPSettleRequest {
111
+ token: string;
112
+ idempotency_key?: string;
113
+ }
114
+ interface UCPSettlement {
115
+ id: string;
116
+ status: 'pending' | 'processing' | 'completed' | 'failed';
117
+ token: string;
118
+ transfer_id?: string;
119
+ amount: {
120
+ source: number;
121
+ source_currency: string;
122
+ destination: number;
123
+ destination_currency: string;
124
+ fx_rate: number;
125
+ fees: number;
126
+ };
127
+ recipient: UCPRecipient;
128
+ corridor: 'pix' | 'spei';
129
+ estimated_completion?: string;
130
+ completed_at?: string;
131
+ failed_at?: string;
132
+ failure_reason?: string;
133
+ created_at: string;
134
+ updated_at: string;
135
+ }
136
+ interface ListSettlementsOptions {
137
+ status?: string;
138
+ corridor?: string;
139
+ limit?: number;
140
+ offset?: number;
141
+ }
142
+ interface ListSettlementsResponse {
143
+ data: UCPSettlement[];
144
+ pagination: {
145
+ limit: number;
146
+ offset: number;
147
+ total: number;
148
+ };
149
+ }
150
+ interface UCPCheckoutRequest {
151
+ line_items: UCPLineItem[];
152
+ buyer?: {
153
+ email?: string;
154
+ name?: string;
155
+ phone?: string;
156
+ };
157
+ shipping_address?: UCPAddress;
158
+ }
159
+ interface UCPLineItem {
160
+ product_id?: string;
161
+ name?: string;
162
+ description?: string;
163
+ quantity: number;
164
+ unit_price?: number;
165
+ currency?: string;
166
+ variant?: Record<string, string>;
167
+ }
168
+ interface UCPAddress {
169
+ line1: string;
170
+ line2?: string;
171
+ city: string;
172
+ state?: string;
173
+ postal_code: string;
174
+ country: string;
175
+ }
176
+ interface UCPCheckout {
177
+ id: string;
178
+ merchant_url: string;
179
+ status: 'open' | 'completed' | 'cancelled' | 'expired';
180
+ line_items: UCPLineItem[];
181
+ totals: {
182
+ subtotal: number;
183
+ tax: number;
184
+ shipping: number;
185
+ total: number;
186
+ currency: string;
187
+ };
188
+ payment_handlers: string[];
189
+ expires_at: string;
190
+ created_at: string;
191
+ }
192
+ interface UCPCompleteCheckoutRequest {
193
+ payment_handler: string;
194
+ payment_data: {
195
+ token: string;
196
+ };
197
+ shipping_address?: UCPAddress;
198
+ }
199
+ interface UCPOrder {
200
+ id: string;
201
+ checkout_id: string;
202
+ status: 'confirmed' | 'processing' | 'shipped' | 'delivered' | 'cancelled';
203
+ line_items: UCPLineItem[];
204
+ totals: {
205
+ subtotal: number;
206
+ tax: number;
207
+ shipping: number;
208
+ total: number;
209
+ currency: string;
210
+ };
211
+ payment: {
212
+ handler_id: string;
213
+ status: string;
214
+ settlement_id?: string;
215
+ };
216
+ created_at: string;
217
+ }
218
+ interface UCPHandlerInfo {
219
+ handler: {
220
+ id: string;
221
+ name: string;
222
+ version: string;
223
+ };
224
+ supported_corridors: string[];
225
+ supported_currencies: string[];
226
+ token_expiry_seconds: number;
227
+ }
228
+ /**
229
+ * Checkout status state machine
230
+ */
231
+ type PayOSCheckoutStatus = 'incomplete' | 'requires_escalation' | 'ready_for_complete' | 'complete_in_progress' | 'completed' | 'canceled';
232
+ /**
233
+ * PayOS-hosted checkout session
234
+ */
235
+ interface PayOSCheckout {
236
+ id: string;
237
+ tenant_id: string;
238
+ status: PayOSCheckoutStatus;
239
+ currency: string;
240
+ line_items: PayOSLineItem[];
241
+ totals: PayOSTotal[];
242
+ buyer?: PayOSBuyer | null;
243
+ shipping_address?: UCPAddress | null;
244
+ billing_address?: UCPAddress | null;
245
+ payment_config: PayOSPaymentConfig;
246
+ payment_instruments: PayOSPaymentInstrument[];
247
+ selected_instrument_id?: string | null;
248
+ messages: PayOSCheckoutMessage[];
249
+ continue_url?: string | null;
250
+ cancel_url?: string | null;
251
+ links: PayOSLink[];
252
+ metadata: Record<string, unknown>;
253
+ order_id?: string | null;
254
+ expires_at: string;
255
+ created_at: string;
256
+ updated_at: string;
257
+ }
258
+ interface PayOSLineItem {
259
+ id: string;
260
+ name: string;
261
+ description?: string;
262
+ quantity: number;
263
+ unit_price: number;
264
+ total_price: number;
265
+ currency: string;
266
+ image_url?: string;
267
+ product_url?: string;
268
+ }
269
+ interface PayOSTotal {
270
+ type: 'subtotal' | 'tax' | 'shipping' | 'discount' | 'total' | string;
271
+ amount: number;
272
+ label: string;
273
+ currency?: string;
274
+ }
275
+ interface PayOSBuyer {
276
+ email?: string;
277
+ name?: string;
278
+ phone?: string;
279
+ }
280
+ interface PayOSPaymentConfig {
281
+ handlers: string[];
282
+ default_handler?: string;
283
+ capture_method?: 'automatic' | 'manual';
284
+ }
285
+ interface PayOSPaymentInstrument {
286
+ id: string;
287
+ handler: string;
288
+ type: string;
289
+ last4?: string;
290
+ brand?: string;
291
+ created_at: string;
292
+ metadata?: Record<string, unknown>;
293
+ }
294
+ interface PayOSCheckoutMessage {
295
+ id: string;
296
+ type: 'error' | 'warning' | 'info';
297
+ code: string;
298
+ severity?: 'recoverable' | 'requires_buyer_input' | 'requires_buyer_review';
299
+ path?: string;
300
+ content: string;
301
+ content_type: 'plain' | 'markdown';
302
+ created_at: string;
303
+ }
304
+ interface PayOSLink {
305
+ rel: string;
306
+ href: string;
307
+ title?: string;
308
+ }
309
+ interface CreatePayOSCheckoutRequest {
310
+ currency: string;
311
+ line_items?: PayOSLineItem[];
312
+ totals?: PayOSTotal[];
313
+ buyer?: PayOSBuyer;
314
+ shipping_address?: UCPAddress;
315
+ billing_address?: UCPAddress;
316
+ payment_config?: Partial<PayOSPaymentConfig>;
317
+ continue_url?: string;
318
+ cancel_url?: string;
319
+ links?: PayOSLink[];
320
+ metadata?: Record<string, unknown>;
321
+ expires_in_hours?: number;
322
+ }
323
+ interface UpdatePayOSCheckoutRequest {
324
+ line_items?: PayOSLineItem[];
325
+ totals?: PayOSTotal[];
326
+ buyer?: PayOSBuyer;
327
+ shipping_address?: UCPAddress | null;
328
+ billing_address?: UCPAddress | null;
329
+ selected_instrument_id?: string | null;
330
+ continue_url?: string;
331
+ cancel_url?: string;
332
+ metadata?: Record<string, unknown>;
333
+ }
334
+ type PayOSOrderStatus = 'confirmed' | 'processing' | 'shipped' | 'delivered' | 'cancelled' | 'refunded';
335
+ interface PayOSOrder {
336
+ id: string;
337
+ tenant_id: string;
338
+ checkout_id: string;
339
+ status: PayOSOrderStatus;
340
+ currency: string;
341
+ line_items: PayOSLineItem[];
342
+ totals: PayOSTotal[];
343
+ buyer?: PayOSBuyer | null;
344
+ shipping_address?: UCPAddress | null;
345
+ billing_address?: UCPAddress | null;
346
+ payment: PayOSOrderPayment;
347
+ expectations: PayOSExpectation[];
348
+ events: PayOSFulfillmentEvent[];
349
+ adjustments: PayOSAdjustment[];
350
+ permalink_url?: string | null;
351
+ metadata: Record<string, unknown>;
352
+ created_at: string;
353
+ updated_at: string;
354
+ }
355
+ interface PayOSOrderPayment {
356
+ handler: string;
357
+ instrument_id?: string;
358
+ transaction_id?: string;
359
+ status: 'pending' | 'captured' | 'failed';
360
+ captured_at?: string;
361
+ }
362
+ interface PayOSExpectation {
363
+ id: string;
364
+ type: string;
365
+ description: string;
366
+ estimated_date?: string;
367
+ tracking_url?: string;
368
+ }
369
+ interface PayOSFulfillmentEvent {
370
+ id: string;
371
+ type: string;
372
+ timestamp: string;
373
+ description: string;
374
+ tracking_number?: string;
375
+ carrier?: string;
376
+ }
377
+ interface PayOSAdjustment {
378
+ id: string;
379
+ type: 'refund' | 'return' | 'credit';
380
+ amount: number;
381
+ reason?: string;
382
+ created_at: string;
383
+ }
384
+ interface ListPayOSOrdersOptions {
385
+ status?: PayOSOrderStatus;
386
+ limit?: number;
387
+ offset?: number;
388
+ }
389
+ interface ListPayOSOrdersResponse {
390
+ data: PayOSOrder[];
391
+ pagination: {
392
+ limit: number;
393
+ offset: number;
394
+ total: number;
395
+ total_pages: number;
396
+ };
397
+ }
398
+ type UCPIdentityScope = 'profile.read' | 'profile.write' | 'addresses.read' | 'addresses.write' | 'payment_methods.read' | 'payment_methods.write' | 'orders.read' | 'checkout.create' | 'checkout.complete';
399
+ interface UCPOAuthClient {
400
+ id: string;
401
+ client_id: string;
402
+ name: string;
403
+ logo_url?: string;
404
+ redirect_uris: string[];
405
+ allowed_scopes: UCPIdentityScope[];
406
+ client_type: 'public' | 'confidential';
407
+ is_active: boolean;
408
+ created_at: string;
409
+ updated_at: string;
410
+ }
411
+ interface RegisterOAuthClientRequest {
412
+ name: string;
413
+ redirect_uris: string[];
414
+ allowed_scopes?: UCPIdentityScope[];
415
+ client_type?: 'public' | 'confidential';
416
+ logo_url?: string;
417
+ }
418
+ interface RegisterOAuthClientResponse {
419
+ client: UCPOAuthClient;
420
+ client_secret?: string;
421
+ }
422
+ interface UCPLinkedAccount {
423
+ id: string;
424
+ platform_id: string;
425
+ platform_name: string;
426
+ buyer_id?: string;
427
+ buyer_email?: string;
428
+ scopes: UCPIdentityScope[];
429
+ linked_at: string;
430
+ last_used_at?: string;
431
+ }
432
+ interface UCPTokenResponse {
433
+ access_token: string;
434
+ token_type: 'Bearer';
435
+ expires_in: number;
436
+ refresh_token: string;
437
+ scope: string;
438
+ }
439
+ interface UCPAuthorizationInfo {
440
+ client: {
441
+ id: string;
442
+ name: string;
443
+ logo_url?: string;
444
+ };
445
+ requested_scopes: string[];
446
+ redirect_uri: string;
447
+ state: string;
448
+ code_challenge?: string;
449
+ code_challenge_method?: 'S256' | 'plain';
450
+ }
451
+ interface UCPConsentRequest {
452
+ client_id: string;
453
+ redirect_uri: string;
454
+ scope: string;
455
+ state: string;
456
+ code_challenge?: string;
457
+ code_challenge_method?: 'S256' | 'plain';
458
+ buyer_id: string;
459
+ approved: boolean;
460
+ }
461
+ interface UCPConsentResponse {
462
+ redirect_uri: string;
463
+ }
464
+ interface UCPScopeInfo {
465
+ name: UCPIdentityScope;
466
+ description: string;
467
+ }
468
+
469
+ /**
470
+ * UCP Client - Universal Commerce Protocol
471
+ *
472
+ * Wraps PayOS UCP API endpoints for settlement and merchant discovery.
473
+ *
474
+ * @see Story 43.9: UCP Client Module
475
+ * @see https://ucp.dev/specification/overview/
476
+ */
477
+
478
+ declare class UCPClient {
479
+ private client;
480
+ constructor(client: SlyClient);
481
+ /**
482
+ * Discover a UCP merchant's capabilities
483
+ *
484
+ * Fetches and caches the merchant's UCP profile from /.well-known/ucp
485
+ *
486
+ * @example
487
+ * ```typescript
488
+ * const merchant = await payos.ucp.discover('https://shop.example.com');
489
+ * console.log(merchant.ucp.version);
490
+ * console.log(merchant.payment?.handlers);
491
+ * ```
492
+ */
493
+ discover(merchantUrl: string): Promise<UCPProfile>;
494
+ /**
495
+ * Get PayOS's own UCP profile
496
+ *
497
+ * @example
498
+ * ```typescript
499
+ * const profile = await payos.ucp.getProfile();
500
+ * console.log(profile.payment?.handlers);
501
+ * ```
502
+ */
503
+ getProfile(): Promise<UCPProfile>;
504
+ /**
505
+ * Get available settlement corridors
506
+ *
507
+ * @example
508
+ * ```typescript
509
+ * const corridors = await payos.ucp.getCorridors();
510
+ * console.log(corridors.find(c => c.rail === 'pix'));
511
+ * ```
512
+ */
513
+ getCorridors(): Promise<UCPCorridor[]>;
514
+ /**
515
+ * Get UCP handler info
516
+ *
517
+ * @example
518
+ * ```typescript
519
+ * const info = await payos.ucp.getHandlerInfo();
520
+ * console.log(info.handler.name); // com.payos.latam_settlement
521
+ * ```
522
+ */
523
+ getHandlerInfo(): Promise<UCPHandlerInfo>;
524
+ /**
525
+ * Get an FX quote for a settlement corridor
526
+ *
527
+ * @example
528
+ * ```typescript
529
+ * const quote = await payos.ucp.getQuote({
530
+ * corridor: 'pix',
531
+ * amount: 100,
532
+ * currency: 'USD',
533
+ * });
534
+ * console.log(`${quote.from_amount} USD = ${quote.to_amount} BRL`);
535
+ * ```
536
+ */
537
+ getQuote(request: UCPQuoteRequest): Promise<UCPQuote>;
538
+ /**
539
+ * Acquire a settlement token for completing a UCP checkout
540
+ *
541
+ * Tokens are valid for 15 minutes and lock in the FX rate.
542
+ *
543
+ * @example
544
+ * ```typescript
545
+ * const token = await payos.ucp.acquireToken({
546
+ * corridor: 'pix',
547
+ * amount: 100,
548
+ * currency: 'USD',
549
+ * recipient: {
550
+ * type: 'pix',
551
+ * pix_key: '12345678901',
552
+ * pix_key_type: 'cpf',
553
+ * name: 'Maria Silva',
554
+ * },
555
+ * });
556
+ *
557
+ * console.log(token.token); // ucp_tok_...
558
+ * console.log(token.quote.to_amount); // 595.00 BRL
559
+ * ```
560
+ */
561
+ acquireToken(request: UCPTokenRequest): Promise<UCPToken>;
562
+ /**
563
+ * Complete settlement using a previously acquired token
564
+ *
565
+ * @example
566
+ * ```typescript
567
+ * const settlement = await payos.ucp.settle({
568
+ * token: 'ucp_tok_...',
569
+ * idempotency_key: 'checkout_12345',
570
+ * });
571
+ *
572
+ * console.log(settlement.status); // pending
573
+ * console.log(settlement.id); // Use this to track status
574
+ * ```
575
+ */
576
+ settle(request: UCPSettleRequest): Promise<UCPSettlement>;
577
+ /**
578
+ * Get settlement status by ID
579
+ *
580
+ * @example
581
+ * ```typescript
582
+ * const settlement = await payos.ucp.getSettlement('uuid');
583
+ * if (settlement.status === 'completed') {
584
+ * console.log(`Completed at ${settlement.completed_at}`);
585
+ * }
586
+ * ```
587
+ */
588
+ getSettlement(settlementId: string): Promise<UCPSettlement>;
589
+ /**
590
+ * List settlements with optional filtering
591
+ *
592
+ * @example
593
+ * ```typescript
594
+ * const { data, pagination } = await payos.ucp.listSettlements({
595
+ * status: 'completed',
596
+ * corridor: 'pix',
597
+ * limit: 50,
598
+ * });
599
+ * ```
600
+ */
601
+ listSettlements(options?: ListSettlementsOptions): Promise<ListSettlementsResponse>;
602
+ /**
603
+ * Create a checkout session with a UCP merchant
604
+ *
605
+ * @example
606
+ * ```typescript
607
+ * const checkout = await payos.ucp.createCheckout('https://shop.example.com', {
608
+ * line_items: [
609
+ * { product_id: 'prod_123', quantity: 2 },
610
+ * ],
611
+ * buyer: { email: 'buyer@example.com' },
612
+ * });
613
+ *
614
+ * console.log(checkout.totals.total);
615
+ * ```
616
+ */
617
+ createCheckout(merchantUrl: string, request: UCPCheckoutRequest): Promise<UCPCheckout>;
618
+ /**
619
+ * Complete a checkout with PayOS LATAM settlement
620
+ *
621
+ * This is a convenience method that:
622
+ * 1. Acquires a settlement token
623
+ * 2. Completes the checkout with the merchant
624
+ *
625
+ * @example
626
+ * ```typescript
627
+ * const order = await payos.ucp.completeCheckout(
628
+ * 'https://shop.example.com',
629
+ * checkout.id,
630
+ * {
631
+ * corridor: 'pix',
632
+ * recipient: {
633
+ * type: 'pix',
634
+ * pix_key: '12345678901',
635
+ * pix_key_type: 'cpf',
636
+ * name: 'Maria Silva',
637
+ * },
638
+ * }
639
+ * );
640
+ *
641
+ * console.log(order.id);
642
+ * console.log(order.payment.settlement_id);
643
+ * ```
644
+ */
645
+ completeCheckout(merchantUrl: string, checkoutId: string, settlement: {
646
+ corridor: 'pix' | 'spei';
647
+ recipient: UCPTokenRequest['recipient'];
648
+ }): Promise<UCPOrder>;
649
+ /**
650
+ * Clear the profile cache (useful for testing)
651
+ */
652
+ clearCache(): void;
653
+ /**
654
+ * Check if PayOS supports a specific corridor
655
+ *
656
+ * @example
657
+ * ```typescript
658
+ * if (await payos.ucp.supportsCorridors('USD', 'BRL', 'pix')) {
659
+ * // Can settle via Pix
660
+ * }
661
+ * ```
662
+ */
663
+ supportsCorridor(sourceCurrency: string, destinationCurrency: string, rail: string): Promise<boolean>;
664
+ /**
665
+ * Create Pix recipient helper
666
+ *
667
+ * @example
668
+ * ```typescript
669
+ * const recipient = payos.ucp.createPixRecipient({
670
+ * pix_key: '12345678901',
671
+ * pix_key_type: 'cpf',
672
+ * name: 'Maria Silva',
673
+ * });
674
+ * ```
675
+ */
676
+ createPixRecipient(params: {
677
+ pix_key: string;
678
+ pix_key_type: 'cpf' | 'cnpj' | 'email' | 'phone' | 'evp';
679
+ name: string;
680
+ tax_id?: string;
681
+ }): UCPTokenRequest['recipient'];
682
+ /**
683
+ * Create SPEI recipient helper
684
+ *
685
+ * @example
686
+ * ```typescript
687
+ * const recipient = payos.ucp.createSpeiRecipient({
688
+ * clabe: '012345678901234567',
689
+ * name: 'Juan Garcia',
690
+ * });
691
+ * ```
692
+ */
693
+ createSpeiRecipient(params: {
694
+ clabe: string;
695
+ name: string;
696
+ rfc?: string;
697
+ }): UCPTokenRequest['recipient'];
698
+ /**
699
+ * Create a PayOS-hosted checkout session
700
+ *
701
+ * @example
702
+ * ```typescript
703
+ * const checkout = await payos.ucp.checkouts.create({
704
+ * currency: 'USD',
705
+ * line_items: [
706
+ * { id: 'item_1', name: 'Product', quantity: 1, unit_price: 1000, total_price: 1000, currency: 'USD' }
707
+ * ],
708
+ * buyer: { email: 'buyer@example.com' },
709
+ * });
710
+ * ```
711
+ */
712
+ get checkouts(): {
713
+ create: (request: CreatePayOSCheckoutRequest) => Promise<PayOSCheckout>;
714
+ get: (checkoutId: string) => Promise<PayOSCheckout>;
715
+ update: (checkoutId: string, request: UpdatePayOSCheckoutRequest) => Promise<PayOSCheckout>;
716
+ complete: (checkoutId: string) => Promise<PayOSCheckout>;
717
+ cancel: (checkoutId: string) => Promise<PayOSCheckout>;
718
+ addPaymentInstrument: (checkoutId: string, instrument: {
719
+ id: string;
720
+ handler: string;
721
+ type: string;
722
+ last4?: string;
723
+ brand?: string;
724
+ }) => Promise<PayOSCheckout>;
725
+ };
726
+ /**
727
+ * Manage PayOS orders
728
+ *
729
+ * @example
730
+ * ```typescript
731
+ * const order = await payos.ucp.orders.get('ord_123');
732
+ * const orders = await payos.ucp.orders.list({ status: 'processing' });
733
+ * ```
734
+ */
735
+ get orders(): {
736
+ get: (orderId: string) => Promise<PayOSOrder>;
737
+ list: (options?: ListPayOSOrdersOptions) => Promise<ListPayOSOrdersResponse>;
738
+ updateStatus: (orderId: string, status: PayOSOrderStatus) => Promise<PayOSOrder>;
739
+ cancel: (orderId: string, reason?: string) => Promise<PayOSOrder>;
740
+ addExpectation: (orderId: string, expectation: Omit<PayOSExpectation, "id">) => Promise<PayOSOrder>;
741
+ updateExpectation: (orderId: string, expectationId: string, updates: Partial<Omit<PayOSExpectation, "id">>) => Promise<PayOSOrder>;
742
+ addEvent: (orderId: string, event: Omit<PayOSFulfillmentEvent, "id" | "timestamp">) => Promise<PayOSOrder>;
743
+ getEvents: (orderId: string) => Promise<{
744
+ data: PayOSFulfillmentEvent[];
745
+ }>;
746
+ addAdjustment: (orderId: string, adjustment: Omit<PayOSAdjustment, "id" | "created_at">) => Promise<PayOSOrder>;
747
+ };
748
+ /**
749
+ * OAuth 2.0 identity linking for AI agents/platforms
750
+ *
751
+ * @example
752
+ * ```typescript
753
+ * // Register an OAuth client
754
+ * const { client, client_secret } = await payos.ucp.identity.registerClient({
755
+ * name: 'My AI Agent',
756
+ * redirect_uris: ['https://myagent.com/callback'],
757
+ * });
758
+ *
759
+ * // List linked accounts
760
+ * const accounts = await payos.ucp.identity.listLinkedAccounts({ buyer_id: 'buyer_123' });
761
+ * ```
762
+ */
763
+ get identity(): {
764
+ /**
765
+ * Register an OAuth client (platform/agent)
766
+ */
767
+ registerClient: (request: RegisterOAuthClientRequest) => Promise<RegisterOAuthClientResponse>;
768
+ /**
769
+ * Get authorization info for consent screen
770
+ */
771
+ getAuthorizationInfo: (params: {
772
+ response_type: "code";
773
+ client_id: string;
774
+ redirect_uri: string;
775
+ scope: string;
776
+ state: string;
777
+ code_challenge?: string;
778
+ code_challenge_method?: "S256" | "plain";
779
+ }) => Promise<UCPAuthorizationInfo>;
780
+ /**
781
+ * Submit consent decision (after user authenticates)
782
+ */
783
+ submitConsent: (request: UCPConsentRequest) => Promise<UCPConsentResponse>;
784
+ /**
785
+ * Exchange authorization code for tokens
786
+ */
787
+ exchangeCode: (params: {
788
+ client_id: string;
789
+ client_secret?: string;
790
+ code: string;
791
+ redirect_uri: string;
792
+ code_verifier?: string;
793
+ }) => Promise<UCPTokenResponse>;
794
+ /**
795
+ * Refresh tokens
796
+ */
797
+ refreshTokens: (params: {
798
+ client_id: string;
799
+ client_secret?: string;
800
+ refresh_token: string;
801
+ }) => Promise<UCPTokenResponse>;
802
+ /**
803
+ * Revoke a token
804
+ */
805
+ revokeToken: (params: {
806
+ token: string;
807
+ token_type_hint?: "access_token" | "refresh_token";
808
+ client_id: string;
809
+ client_secret?: string;
810
+ }) => Promise<{
811
+ success: boolean;
812
+ }>;
813
+ /**
814
+ * List linked accounts
815
+ */
816
+ listLinkedAccounts: (params: {
817
+ buyer_id?: string;
818
+ platform_id?: string;
819
+ limit?: number;
820
+ offset?: number;
821
+ }) => Promise<{
822
+ data: UCPLinkedAccount[];
823
+ pagination?: {
824
+ limit: number;
825
+ offset: number;
826
+ total: number;
827
+ };
828
+ }>;
829
+ /**
830
+ * Unlink an account
831
+ */
832
+ unlinkAccount: (accountId: string, buyerId: string) => Promise<{
833
+ success: boolean;
834
+ }>;
835
+ /**
836
+ * Get available scopes
837
+ */
838
+ getScopes: () => Promise<{
839
+ data: UCPScopeInfo[];
840
+ }>;
841
+ };
842
+ }
843
+
844
+ export { type CreatePayOSCheckoutRequest, type ListPayOSOrdersOptions, type ListPayOSOrdersResponse, type ListSettlementsOptions, type ListSettlementsResponse, type PayOSAdjustment, type PayOSBuyer, type PayOSCheckout, type PayOSCheckoutMessage, type PayOSCheckoutStatus, type PayOSExpectation, type PayOSFulfillmentEvent, type PayOSLineItem, type PayOSLink, type PayOSOrder, type PayOSOrderPayment, type PayOSOrderStatus, type PayOSPaymentConfig, type PayOSPaymentInstrument, type PayOSTotal, type RegisterOAuthClientRequest, type RegisterOAuthClientResponse, type UCPAddress, type UCPAuthorizationInfo, type UCPCapability, type UCPCheckout, type UCPCheckoutRequest, UCPClient, type UCPCompleteCheckoutRequest, type UCPConsentRequest, type UCPConsentResponse, type UCPCorridor, type UCPHandlerInfo, type UCPIdentityScope, type UCPLineItem, type UCPLinkedAccount, type UCPOAuthClient, type UCPOrder, type UCPPaymentHandler, type UCPPixRecipient, type UCPProfile, type UCPQuote, type UCPQuoteRequest, type UCPRecipient, type UCPScopeInfo, type UCPService, type UCPSettleRequest, type UCPSettlement, type UCPSpeiRecipient, type UCPToken, type UCPTokenRequest, type UCPTokenResponse, type UpdatePayOSCheckoutRequest };