@naturalpay/sdk 0.9.0 → 0.11.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 (113) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/agents.d.mts +33 -26
  10. package/resources/agents.d.mts.map +1 -1
  11. package/resources/agents.d.ts +33 -26
  12. package/resources/agents.d.ts.map +1 -1
  13. package/resources/agents.js +1 -1
  14. package/resources/agents.mjs +1 -1
  15. package/resources/api-keys.d.mts +16 -16
  16. package/resources/api-keys.d.mts.map +1 -1
  17. package/resources/api-keys.d.ts +16 -16
  18. package/resources/api-keys.d.ts.map +1 -1
  19. package/resources/approvals.d.mts +16 -16
  20. package/resources/approvals.d.mts.map +1 -1
  21. package/resources/approvals.d.ts +16 -16
  22. package/resources/approvals.d.ts.map +1 -1
  23. package/resources/counterparties.d.mts +1 -1
  24. package/resources/counterparties.d.mts.map +1 -1
  25. package/resources/counterparties.d.ts +1 -1
  26. package/resources/counterparties.d.ts.map +1 -1
  27. package/resources/customers.d.mts +6 -6
  28. package/resources/customers.d.mts.map +1 -1
  29. package/resources/customers.d.ts +6 -6
  30. package/resources/customers.d.ts.map +1 -1
  31. package/resources/external-accounts.d.mts +4 -4
  32. package/resources/external-accounts.d.mts.map +1 -1
  33. package/resources/external-accounts.d.ts +4 -4
  34. package/resources/external-accounts.d.ts.map +1 -1
  35. package/resources/index.d.mts +1 -1
  36. package/resources/index.d.mts.map +1 -1
  37. package/resources/index.d.ts +1 -1
  38. package/resources/index.d.ts.map +1 -1
  39. package/resources/index.js.map +1 -1
  40. package/resources/index.mjs.map +1 -1
  41. package/resources/invitations.d.mts +3 -3
  42. package/resources/invitations.d.mts.map +1 -1
  43. package/resources/invitations.d.ts +3 -3
  44. package/resources/invitations.d.ts.map +1 -1
  45. package/resources/parties.d.mts +4 -4
  46. package/resources/parties.d.mts.map +1 -1
  47. package/resources/parties.d.ts +4 -4
  48. package/resources/parties.d.ts.map +1 -1
  49. package/resources/payment-requests.d.mts +374 -82
  50. package/resources/payment-requests.d.mts.map +1 -1
  51. package/resources/payment-requests.d.ts +374 -82
  52. package/resources/payment-requests.d.ts.map +1 -1
  53. package/resources/payment-requests.js +35 -48
  54. package/resources/payment-requests.js.map +1 -1
  55. package/resources/payment-requests.mjs +35 -48
  56. package/resources/payment-requests.mjs.map +1 -1
  57. package/resources/payments.d.mts +433 -44
  58. package/resources/payments.d.mts.map +1 -1
  59. package/resources/payments.d.ts +433 -44
  60. package/resources/payments.d.ts.map +1 -1
  61. package/resources/payments.js +40 -22
  62. package/resources/payments.js.map +1 -1
  63. package/resources/payments.mjs +40 -22
  64. package/resources/payments.mjs.map +1 -1
  65. package/resources/transactions.d.mts +26 -28
  66. package/resources/transactions.d.mts.map +1 -1
  67. package/resources/transactions.d.ts +26 -28
  68. package/resources/transactions.d.ts.map +1 -1
  69. package/resources/transactions.js +6 -18
  70. package/resources/transactions.js.map +1 -1
  71. package/resources/transactions.mjs +6 -18
  72. package/resources/transactions.mjs.map +1 -1
  73. package/resources/transfers.d.mts +64 -57
  74. package/resources/transfers.d.mts.map +1 -1
  75. package/resources/transfers.d.ts +64 -57
  76. package/resources/transfers.d.ts.map +1 -1
  77. package/resources/transfers.js +20 -29
  78. package/resources/transfers.js.map +1 -1
  79. package/resources/transfers.mjs +20 -29
  80. package/resources/transfers.mjs.map +1 -1
  81. package/resources/wallet.d.mts +4 -4
  82. package/resources/wallet.d.mts.map +1 -1
  83. package/resources/wallet.d.ts +4 -4
  84. package/resources/wallet.d.ts.map +1 -1
  85. package/resources/webhooks.d.mts +12 -12
  86. package/resources/webhooks.d.mts.map +1 -1
  87. package/resources/webhooks.d.ts +12 -12
  88. package/resources/webhooks.d.ts.map +1 -1
  89. package/src/client.ts +4 -0
  90. package/src/resources/agents.ts +39 -26
  91. package/src/resources/api-keys.ts +16 -16
  92. package/src/resources/approvals.ts +16 -16
  93. package/src/resources/counterparties.ts +1 -1
  94. package/src/resources/customers.ts +6 -6
  95. package/src/resources/external-accounts.ts +4 -4
  96. package/src/resources/index.ts +2 -0
  97. package/src/resources/invitations.ts +3 -3
  98. package/src/resources/parties.ts +4 -4
  99. package/src/resources/payment-requests.ts +484 -126
  100. package/src/resources/payments.ts +531 -67
  101. package/src/resources/transactions.ts +32 -49
  102. package/src/resources/transfers.ts +72 -88
  103. package/src/resources/wallet.ts +4 -4
  104. package/src/resources/webhooks.ts +12 -12
  105. package/src/version.ts +1 -1
  106. package/version.d.mts +1 -1
  107. package/version.d.mts.map +1 -1
  108. package/version.d.ts +1 -1
  109. package/version.d.ts.map +1 -1
  110. package/version.js +1 -1
  111. package/version.js.map +1 -1
  112. package/version.mjs +1 -1
  113. package/version.mjs.map +1 -1
@@ -18,10 +18,12 @@ export class Payments extends APIResource {
18
18
  * const payment = await client.payments.create({
19
19
  * amount: 1,
20
20
  * counterparty: {
21
- * type: 'type',
21
+ * type: 'email',
22
22
  * value: 'dev@stainless.com',
23
23
  * },
24
24
  * 'Idempotency-Key': 'Idempotency-Key',
25
+ * 'X-Agent-ID': 'X-Agent-ID',
26
+ * 'X-Instance-ID': 'X-Instance-ID',
25
27
  * });
26
28
  * ```
27
29
  */
@@ -36,11 +38,7 @@ export class Payments extends APIResource {
36
38
  body,
37
39
  ...options,
38
40
  headers: buildHeaders([
39
- {
40
- 'Idempotency-Key': idempotencyKey,
41
- ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
42
- ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
43
- },
41
+ { 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
44
42
  options?.headers,
45
43
  ]),
46
44
  });
@@ -51,22 +49,50 @@ export class Payments extends APIResource {
51
49
  *
52
50
  * @example
53
51
  * ```ts
54
- * const payments = await client.payments.list();
52
+ * const payments = await client.payments.list({
53
+ * 'X-Agent-ID': 'X-Agent-ID',
54
+ * 'X-Instance-ID': 'X-Instance-ID',
55
+ * });
55
56
  * ```
56
57
  */
57
- list(
58
- params: PaymentListParams | null | undefined = {},
59
- options?: RequestOptions,
60
- ): APIPromise<PaymentListResponse> {
61
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
58
+ list(params: PaymentListParams, options?: RequestOptions): APIPromise<PaymentListResponse> {
59
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
62
60
  return this._client.get('/payments', {
63
61
  query,
62
+ ...options,
63
+ headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
64
+ });
65
+ }
66
+
67
+ /**
68
+ * Cancel a pending-claim payment before the recipient starts claiming it.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const response = await client.payments.cancel(
73
+ * 'pay_ecc2efdd09bd231a9ad9bd2aada37aa7',
74
+ * {
75
+ * 'Idempotency-Key': 'Idempotency-Key',
76
+ * 'X-Agent-ID': 'X-Agent-ID',
77
+ * 'X-Instance-ID': 'X-Instance-ID',
78
+ * },
79
+ * );
80
+ * ```
81
+ */
82
+ cancel(
83
+ paymentID: string,
84
+ params: PaymentCancelParams,
85
+ options?: RequestOptions,
86
+ ): APIPromise<PaymentCancelResponse> {
87
+ const {
88
+ 'Idempotency-Key': idempotencyKey,
89
+ 'X-Agent-ID': xAgentID,
90
+ 'X-Instance-ID': xInstanceID,
91
+ } = params;
92
+ return this._client.post(path`/payments/${paymentID}/cancel`, {
64
93
  ...options,
65
94
  headers: buildHeaders([
66
- {
67
- ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
68
- ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
69
- },
95
+ { 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
70
96
  options?.headers,
71
97
  ]),
72
98
  });
@@ -79,25 +105,19 @@ export class Payments extends APIResource {
79
105
  * ```ts
80
106
  * const payment = await client.payments.get(
81
107
  * 'pay_ecc2efdd09bd231a9ad9bd2aada37aa7',
108
+ * {
109
+ * 'X-Agent-ID': 'X-Agent-ID',
110
+ * 'X-Instance-ID': 'X-Instance-ID',
111
+ * },
82
112
  * );
83
113
  * ```
84
114
  */
85
- get(
86
- paymentID: string,
87
- params: PaymentGetParams | null | undefined = {},
88
- options?: RequestOptions,
89
- ): APIPromise<PaymentGetResponse> {
90
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
115
+ get(paymentID: string, params: PaymentGetParams, options?: RequestOptions): APIPromise<PaymentGetResponse> {
116
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
91
117
  return this._client.get(path`/payments/${paymentID}`, {
92
118
  query,
93
119
  ...options,
94
- headers: buildHeaders([
95
- {
96
- ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
97
- ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
98
- },
99
- options?.headers,
100
- ]),
120
+ headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
101
121
  });
102
122
  }
103
123
  }
@@ -120,7 +140,7 @@ export namespace PaymentCreateResponse {
120
140
  */
121
141
  relationships: Data.Relationships;
122
142
 
123
- type: string;
143
+ type: 'payment';
124
144
  }
125
145
 
126
146
  export namespace Data {
@@ -158,6 +178,7 @@ export namespace PaymentCreateResponse {
158
178
  | 'IN_REVIEW'
159
179
  | 'COMPLETED'
160
180
  | 'FAILED'
181
+ | 'RETURNED'
161
182
  | 'APPROVAL_DENIED'
162
183
  | 'CANCELLED';
163
184
 
@@ -171,11 +192,22 @@ export namespace PaymentCreateResponse {
171
192
  * Resource relationships
172
193
  */
173
194
  export interface Relationships {
195
+ /**
196
+ * Payment request that produced this payment, when applicable.
197
+ */
198
+ paymentRequest: Relationships.PaymentRequest;
199
+
174
200
  /**
175
201
  * Recipient party for this payment, when known.
176
202
  */
177
203
  recipient: Relationships.Recipient;
178
204
 
205
+ /**
206
+ * Recipient agent when the caller addressed an agent ID. Null otherwise, including
207
+ * when the recipient was addressed as an email, phone, or party ID.
208
+ */
209
+ recipientAgent: Relationships.RecipientAgent;
210
+
179
211
  /**
180
212
  * Party that initiated the payment
181
213
  */
@@ -188,6 +220,30 @@ export namespace PaymentCreateResponse {
188
220
  }
189
221
 
190
222
  export namespace Relationships {
223
+ /**
224
+ * Payment request that produced this payment, when applicable.
225
+ */
226
+ export interface PaymentRequest {
227
+ /**
228
+ * Related resource identifier
229
+ */
230
+ data: PaymentRequest.Data | null;
231
+ }
232
+
233
+ export namespace PaymentRequest {
234
+ /**
235
+ * Related resource identifier
236
+ */
237
+ export interface Data {
238
+ id: string;
239
+
240
+ /**
241
+ * Resource type
242
+ */
243
+ type: 'paymentRequest';
244
+ }
245
+ }
246
+
191
247
  /**
192
248
  * Recipient party for this payment, when known.
193
249
  */
@@ -208,7 +264,32 @@ export namespace PaymentCreateResponse {
208
264
  /**
209
265
  * Resource type
210
266
  */
211
- type: string;
267
+ type: 'party';
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Recipient agent when the caller addressed an agent ID. Null otherwise, including
273
+ * when the recipient was addressed as an email, phone, or party ID.
274
+ */
275
+ export interface RecipientAgent {
276
+ /**
277
+ * Related resource identifier
278
+ */
279
+ data: RecipientAgent.Data | null;
280
+ }
281
+
282
+ export namespace RecipientAgent {
283
+ /**
284
+ * Related resource identifier
285
+ */
286
+ export interface Data {
287
+ id: string;
288
+
289
+ /**
290
+ * Resource type
291
+ */
292
+ type: 'agent';
212
293
  }
213
294
  }
214
295
 
@@ -232,7 +313,7 @@ export namespace PaymentCreateResponse {
232
313
  /**
233
314
  * Resource type
234
315
  */
235
- type: string;
316
+ type: 'party';
236
317
  }
237
318
  }
238
319
 
@@ -256,7 +337,7 @@ export namespace PaymentCreateResponse {
256
337
  /**
257
338
  * Resource type
258
339
  */
259
- type: string;
340
+ type: 'transaction';
260
341
  }
261
342
  }
262
343
  }
@@ -283,7 +364,7 @@ export namespace PaymentListResponse {
283
364
  */
284
365
  relationships: Data.Relationships;
285
366
 
286
- type: string;
367
+ type: 'payment';
287
368
  }
288
369
 
289
370
  export namespace Data {
@@ -321,6 +402,7 @@ export namespace PaymentListResponse {
321
402
  | 'IN_REVIEW'
322
403
  | 'COMPLETED'
323
404
  | 'FAILED'
405
+ | 'RETURNED'
324
406
  | 'APPROVAL_DENIED'
325
407
  | 'CANCELLED';
326
408
 
@@ -334,11 +416,22 @@ export namespace PaymentListResponse {
334
416
  * Resource relationships
335
417
  */
336
418
  export interface Relationships {
419
+ /**
420
+ * Payment request that produced this payment, when applicable.
421
+ */
422
+ paymentRequest: Relationships.PaymentRequest;
423
+
337
424
  /**
338
425
  * Recipient party for this payment, when known.
339
426
  */
340
427
  recipient: Relationships.Recipient;
341
428
 
429
+ /**
430
+ * Recipient agent when the caller addressed an agent ID. Null otherwise, including
431
+ * when the recipient was addressed as an email, phone, or party ID.
432
+ */
433
+ recipientAgent: Relationships.RecipientAgent;
434
+
342
435
  /**
343
436
  * Party that initiated the payment
344
437
  */
@@ -351,6 +444,30 @@ export namespace PaymentListResponse {
351
444
  }
352
445
 
353
446
  export namespace Relationships {
447
+ /**
448
+ * Payment request that produced this payment, when applicable.
449
+ */
450
+ export interface PaymentRequest {
451
+ /**
452
+ * Related resource identifier
453
+ */
454
+ data: PaymentRequest.Data | null;
455
+ }
456
+
457
+ export namespace PaymentRequest {
458
+ /**
459
+ * Related resource identifier
460
+ */
461
+ export interface Data {
462
+ id: string;
463
+
464
+ /**
465
+ * Resource type
466
+ */
467
+ type: 'paymentRequest';
468
+ }
469
+ }
470
+
354
471
  /**
355
472
  * Recipient party for this payment, when known.
356
473
  */
@@ -371,7 +488,32 @@ export namespace PaymentListResponse {
371
488
  /**
372
489
  * Resource type
373
490
  */
374
- type: string;
491
+ type: 'party';
492
+ }
493
+ }
494
+
495
+ /**
496
+ * Recipient agent when the caller addressed an agent ID. Null otherwise, including
497
+ * when the recipient was addressed as an email, phone, or party ID.
498
+ */
499
+ export interface RecipientAgent {
500
+ /**
501
+ * Related resource identifier
502
+ */
503
+ data: RecipientAgent.Data | null;
504
+ }
505
+
506
+ export namespace RecipientAgent {
507
+ /**
508
+ * Related resource identifier
509
+ */
510
+ export interface Data {
511
+ id: string;
512
+
513
+ /**
514
+ * Resource type
515
+ */
516
+ type: 'agent';
375
517
  }
376
518
  }
377
519
 
@@ -395,7 +537,7 @@ export namespace PaymentListResponse {
395
537
  /**
396
538
  * Resource type
397
539
  */
398
- type: string;
540
+ type: 'party';
399
541
  }
400
542
  }
401
543
 
@@ -419,7 +561,7 @@ export namespace PaymentListResponse {
419
561
  /**
420
562
  * Resource type
421
563
  */
422
- type: string;
564
+ type: 'transaction';
423
565
  }
424
566
  }
425
567
  }
@@ -438,6 +580,228 @@ export namespace PaymentListResponse {
438
580
  }
439
581
  }
440
582
 
583
+ export interface PaymentCancelResponse {
584
+ data: PaymentCancelResponse.Data;
585
+ }
586
+
587
+ export namespace PaymentCancelResponse {
588
+ export interface Data {
589
+ id: string;
590
+
591
+ /**
592
+ * Resource attributes
593
+ */
594
+ attributes: Data.Attributes;
595
+
596
+ /**
597
+ * Resource relationships
598
+ */
599
+ relationships: Data.Relationships;
600
+
601
+ type: 'payment';
602
+ }
603
+
604
+ export namespace Data {
605
+ /**
606
+ * Resource attributes
607
+ */
608
+ export interface Attributes {
609
+ /**
610
+ * Amount in cents
611
+ */
612
+ amount: number;
613
+
614
+ /**
615
+ * When this payment was created
616
+ */
617
+ createdAt: string;
618
+
619
+ /**
620
+ * Currency code
621
+ */
622
+ currency: string;
623
+
624
+ /**
625
+ * Payment description
626
+ */
627
+ description: string | null;
628
+
629
+ /**
630
+ * Payment status
631
+ */
632
+ status:
633
+ | 'CREATED'
634
+ | 'PROCESSING'
635
+ | 'PENDING_CLAIM'
636
+ | 'IN_REVIEW'
637
+ | 'COMPLETED'
638
+ | 'FAILED'
639
+ | 'RETURNED'
640
+ | 'APPROVAL_DENIED'
641
+ | 'CANCELLED';
642
+
643
+ /**
644
+ * When this payment was last updated
645
+ */
646
+ updatedAt: string | null;
647
+ }
648
+
649
+ /**
650
+ * Resource relationships
651
+ */
652
+ export interface Relationships {
653
+ /**
654
+ * Payment request that produced this payment, when applicable.
655
+ */
656
+ paymentRequest: Relationships.PaymentRequest;
657
+
658
+ /**
659
+ * Recipient party for this payment, when known.
660
+ */
661
+ recipient: Relationships.Recipient;
662
+
663
+ /**
664
+ * Recipient agent when the caller addressed an agent ID. Null otherwise, including
665
+ * when the recipient was addressed as an email, phone, or party ID.
666
+ */
667
+ recipientAgent: Relationships.RecipientAgent;
668
+
669
+ /**
670
+ * Party that initiated the payment
671
+ */
672
+ sender: Relationships.Sender;
673
+
674
+ /**
675
+ * Sender-side transaction row for this payment, when available.
676
+ */
677
+ transaction: Relationships.Transaction;
678
+ }
679
+
680
+ export namespace Relationships {
681
+ /**
682
+ * Payment request that produced this payment, when applicable.
683
+ */
684
+ export interface PaymentRequest {
685
+ /**
686
+ * Related resource identifier
687
+ */
688
+ data: PaymentRequest.Data | null;
689
+ }
690
+
691
+ export namespace PaymentRequest {
692
+ /**
693
+ * Related resource identifier
694
+ */
695
+ export interface Data {
696
+ id: string;
697
+
698
+ /**
699
+ * Resource type
700
+ */
701
+ type: 'paymentRequest';
702
+ }
703
+ }
704
+
705
+ /**
706
+ * Recipient party for this payment, when known.
707
+ */
708
+ export interface Recipient {
709
+ /**
710
+ * Related resource identifier
711
+ */
712
+ data: Recipient.Data | null;
713
+ }
714
+
715
+ export namespace Recipient {
716
+ /**
717
+ * Related resource identifier
718
+ */
719
+ export interface Data {
720
+ id: string;
721
+
722
+ /**
723
+ * Resource type
724
+ */
725
+ type: 'party';
726
+ }
727
+ }
728
+
729
+ /**
730
+ * Recipient agent when the caller addressed an agent ID. Null otherwise, including
731
+ * when the recipient was addressed as an email, phone, or party ID.
732
+ */
733
+ export interface RecipientAgent {
734
+ /**
735
+ * Related resource identifier
736
+ */
737
+ data: RecipientAgent.Data | null;
738
+ }
739
+
740
+ export namespace RecipientAgent {
741
+ /**
742
+ * Related resource identifier
743
+ */
744
+ export interface Data {
745
+ id: string;
746
+
747
+ /**
748
+ * Resource type
749
+ */
750
+ type: 'agent';
751
+ }
752
+ }
753
+
754
+ /**
755
+ * Party that initiated the payment
756
+ */
757
+ export interface Sender {
758
+ /**
759
+ * Related resource identifier
760
+ */
761
+ data: Sender.Data;
762
+ }
763
+
764
+ export namespace Sender {
765
+ /**
766
+ * Related resource identifier
767
+ */
768
+ export interface Data {
769
+ id: string;
770
+
771
+ /**
772
+ * Resource type
773
+ */
774
+ type: 'party';
775
+ }
776
+ }
777
+
778
+ /**
779
+ * Sender-side transaction row for this payment, when available.
780
+ */
781
+ export interface Transaction {
782
+ /**
783
+ * Related resource identifier
784
+ */
785
+ data: Transaction.Data | null;
786
+ }
787
+
788
+ export namespace Transaction {
789
+ /**
790
+ * Related resource identifier
791
+ */
792
+ export interface Data {
793
+ id: string;
794
+
795
+ /**
796
+ * Resource type
797
+ */
798
+ type: 'transaction';
799
+ }
800
+ }
801
+ }
802
+ }
803
+ }
804
+
441
805
  export interface PaymentGetResponse {
442
806
  data: PaymentGetResponse.Data;
443
807
  }
@@ -456,7 +820,7 @@ export namespace PaymentGetResponse {
456
820
  */
457
821
  relationships: Data.Relationships;
458
822
 
459
- type: string;
823
+ type: 'payment';
460
824
  }
461
825
 
462
826
  export namespace Data {
@@ -494,6 +858,7 @@ export namespace PaymentGetResponse {
494
858
  | 'IN_REVIEW'
495
859
  | 'COMPLETED'
496
860
  | 'FAILED'
861
+ | 'RETURNED'
497
862
  | 'APPROVAL_DENIED'
498
863
  | 'CANCELLED';
499
864
 
@@ -507,11 +872,22 @@ export namespace PaymentGetResponse {
507
872
  * Resource relationships
508
873
  */
509
874
  export interface Relationships {
875
+ /**
876
+ * Payment request that produced this payment, when applicable.
877
+ */
878
+ paymentRequest: Relationships.PaymentRequest;
879
+
510
880
  /**
511
881
  * Recipient party for this payment, when known.
512
882
  */
513
883
  recipient: Relationships.Recipient;
514
884
 
885
+ /**
886
+ * Recipient agent when the caller addressed an agent ID. Null otherwise, including
887
+ * when the recipient was addressed as an email, phone, or party ID.
888
+ */
889
+ recipientAgent: Relationships.RecipientAgent;
890
+
515
891
  /**
516
892
  * Party that initiated the payment
517
893
  */
@@ -524,6 +900,30 @@ export namespace PaymentGetResponse {
524
900
  }
525
901
 
526
902
  export namespace Relationships {
903
+ /**
904
+ * Payment request that produced this payment, when applicable.
905
+ */
906
+ export interface PaymentRequest {
907
+ /**
908
+ * Related resource identifier
909
+ */
910
+ data: PaymentRequest.Data | null;
911
+ }
912
+
913
+ export namespace PaymentRequest {
914
+ /**
915
+ * Related resource identifier
916
+ */
917
+ export interface Data {
918
+ id: string;
919
+
920
+ /**
921
+ * Resource type
922
+ */
923
+ type: 'paymentRequest';
924
+ }
925
+ }
926
+
527
927
  /**
528
928
  * Recipient party for this payment, when known.
529
929
  */
@@ -544,7 +944,32 @@ export namespace PaymentGetResponse {
544
944
  /**
545
945
  * Resource type
546
946
  */
547
- type: string;
947
+ type: 'party';
948
+ }
949
+ }
950
+
951
+ /**
952
+ * Recipient agent when the caller addressed an agent ID. Null otherwise, including
953
+ * when the recipient was addressed as an email, phone, or party ID.
954
+ */
955
+ export interface RecipientAgent {
956
+ /**
957
+ * Related resource identifier
958
+ */
959
+ data: RecipientAgent.Data | null;
960
+ }
961
+
962
+ export namespace RecipientAgent {
963
+ /**
964
+ * Related resource identifier
965
+ */
966
+ export interface Data {
967
+ id: string;
968
+
969
+ /**
970
+ * Resource type
971
+ */
972
+ type: 'agent';
548
973
  }
549
974
  }
550
975
 
@@ -568,7 +993,7 @@ export namespace PaymentGetResponse {
568
993
  /**
569
994
  * Resource type
570
995
  */
571
- type: string;
996
+ type: 'party';
572
997
  }
573
998
  }
574
999
 
@@ -592,7 +1017,7 @@ export namespace PaymentGetResponse {
592
1017
  /**
593
1018
  * Resource type
594
1019
  */
595
- type: string;
1020
+ type: 'transaction';
596
1021
  }
597
1022
  }
598
1023
  }
@@ -609,7 +1034,11 @@ export interface PaymentCreateParams {
609
1034
  * Body param: Recipient identifier. Provide exactly one typed email, phone, party
610
1035
  * ID, or agent ID value.
611
1036
  */
612
- counterparty: PaymentCreateParams.UnionMember0 | PaymentCreateParams.UnionMember1;
1037
+ counterparty:
1038
+ | PaymentCreateParams.UnionMember0
1039
+ | PaymentCreateParams.UnionMember1
1040
+ | PaymentCreateParams.UnionMember2
1041
+ | PaymentCreateParams.UnionMember3;
613
1042
 
614
1043
  /**
615
1044
  * Header param: Unique key for idempotent request handling. If a request with the
@@ -617,6 +1046,16 @@ export interface PaymentCreateParams {
617
1046
  */
618
1047
  'Idempotency-Key': string;
619
1048
 
1049
+ /**
1050
+ * Header param: Agent ID (agt_xxx) used for attribution and audit.
1051
+ */
1052
+ 'X-Agent-ID': string;
1053
+
1054
+ /**
1055
+ * Header param: Stable run, session, or conversation ID for agent observability.
1056
+ */
1057
+ 'X-Instance-ID': string;
1058
+
620
1059
  /**
621
1060
  * Body param: Currency code
622
1061
  */
@@ -632,22 +1071,11 @@ export interface PaymentCreateParams {
632
1071
  * Body param: Payment description. Maximum 500 characters.
633
1072
  */
634
1073
  description?: string;
635
-
636
- /**
637
- * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
638
- */
639
- 'X-Agent-ID'?: string;
640
-
641
- /**
642
- * Header param: Required when X-Agent-ID is present. Session or conversation ID
643
- * for agent observability.
644
- */
645
- 'X-Instance-ID'?: string;
646
1074
  }
647
1075
 
648
1076
  export namespace PaymentCreateParams {
649
1077
  export interface UnionMember0 {
650
- type: string;
1078
+ type: 'email';
651
1079
 
652
1080
  /**
653
1081
  * Email address
@@ -656,16 +1084,44 @@ export namespace PaymentCreateParams {
656
1084
  }
657
1085
 
658
1086
  export interface UnionMember1 {
659
- type: string;
1087
+ type: 'phone';
660
1088
 
661
1089
  /**
662
1090
  * Phone number in E.164 format
663
1091
  */
664
1092
  value: string;
665
1093
  }
1094
+
1095
+ export interface UnionMember2 {
1096
+ type: 'party_id';
1097
+
1098
+ /**
1099
+ * Natural party ID (pty\_\*)
1100
+ */
1101
+ value: string;
1102
+ }
1103
+
1104
+ export interface UnionMember3 {
1105
+ type: 'agent_id';
1106
+
1107
+ /**
1108
+ * Natural agent ID (agt\_\*)
1109
+ */
1110
+ value: string;
1111
+ }
666
1112
  }
667
1113
 
668
1114
  export interface PaymentListParams {
1115
+ /**
1116
+ * Header param: Agent ID (agt_xxx) used for attribution and audit.
1117
+ */
1118
+ 'X-Agent-ID': string;
1119
+
1120
+ /**
1121
+ * Header param: Stable run, session, or conversation ID for agent observability.
1122
+ */
1123
+ 'X-Instance-ID': string;
1124
+
669
1125
  /**
670
1126
  * Query param: Pagination cursor from previous response
671
1127
  */
@@ -680,44 +1136,52 @@ export interface PaymentListParams {
680
1136
  * Query param: Party ID for delegated payment lookup
681
1137
  */
682
1138
  partyId?: string;
1139
+ }
1140
+
1141
+ export interface PaymentCancelParams {
1142
+ /**
1143
+ * Unique key for idempotent request handling. If a request with the same key was
1144
+ * already processed, the original response is returned.
1145
+ */
1146
+ 'Idempotency-Key': string;
683
1147
 
684
1148
  /**
685
- * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1149
+ * Agent ID (agt_xxx) used for attribution and audit.
686
1150
  */
687
- 'X-Agent-ID'?: string;
1151
+ 'X-Agent-ID': string;
688
1152
 
689
1153
  /**
690
- * Header param: Required when X-Agent-ID is present. Session or conversation ID
691
- * for agent observability.
1154
+ * Stable run, session, or conversation ID for agent observability.
692
1155
  */
693
- 'X-Instance-ID'?: string;
1156
+ 'X-Instance-ID': string;
694
1157
  }
695
1158
 
696
1159
  export interface PaymentGetParams {
697
1160
  /**
698
- * Query param: Party ID for delegated payment lookup
1161
+ * Header param: Agent ID (agt_xxx) used for attribution and audit.
699
1162
  */
700
- partyId?: string;
1163
+ 'X-Agent-ID': string;
701
1164
 
702
1165
  /**
703
- * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1166
+ * Header param: Stable run, session, or conversation ID for agent observability.
704
1167
  */
705
- 'X-Agent-ID'?: string;
1168
+ 'X-Instance-ID': string;
706
1169
 
707
1170
  /**
708
- * Header param: Required when X-Agent-ID is present. Session or conversation ID
709
- * for agent observability.
1171
+ * Query param: Party ID for delegated payment lookup
710
1172
  */
711
- 'X-Instance-ID'?: string;
1173
+ partyId?: string;
712
1174
  }
713
1175
 
714
1176
  export declare namespace Payments {
715
1177
  export {
716
1178
  type PaymentCreateResponse as PaymentCreateResponse,
717
1179
  type PaymentListResponse as PaymentListResponse,
1180
+ type PaymentCancelResponse as PaymentCancelResponse,
718
1181
  type PaymentGetResponse as PaymentGetResponse,
719
1182
  type PaymentCreateParams as PaymentCreateParams,
720
1183
  type PaymentListParams as PaymentListParams,
1184
+ type PaymentCancelParams as PaymentCancelParams,
721
1185
  type PaymentGetParams as PaymentGetParams,
722
1186
  };
723
1187
  }