@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
@@ -17,8 +17,10 @@ export class PaymentRequests extends APIResource {
17
17
  * ```ts
18
18
  * const paymentRequest = await client.paymentRequests.create({
19
19
  * amount: 1,
20
- * payer: { type: 'type', value: 'dev@stainless.com' },
20
+ * payer: { type: 'email', value: 'dev@stainless.com' },
21
21
  * 'Idempotency-Key': 'Idempotency-Key',
22
+ * 'X-Agent-ID': 'X-Agent-ID',
23
+ * 'X-Instance-ID': 'X-Instance-ID',
22
24
  * });
23
25
  * ```
24
26
  */
@@ -36,11 +38,7 @@ export class PaymentRequests 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,24 +49,18 @@ export class PaymentRequests extends APIResource {
51
49
  *
52
50
  * @example
53
51
  * ```ts
54
- * const paymentRequests = await client.paymentRequests.list();
52
+ * const paymentRequests = await client.paymentRequests.list({
53
+ * 'X-Agent-ID': 'X-Agent-ID',
54
+ * 'X-Instance-ID': 'X-Instance-ID',
55
+ * });
55
56
  * ```
56
57
  */
57
- list(
58
- params: PaymentRequestListParams | null | undefined = {},
59
- options?: RequestOptions,
60
- ): APIPromise<PaymentRequestListResponse> {
61
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
58
+ list(params: PaymentRequestListParams, options?: RequestOptions): APIPromise<PaymentRequestListResponse> {
59
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
62
60
  return this._client.get('/payment-requests', {
63
61
  query,
64
62
  ...options,
65
- headers: buildHeaders([
66
- {
67
- ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
68
- ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
69
- },
70
- options?.headers,
71
- ]),
63
+ headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
72
64
  });
73
65
  }
74
66
 
@@ -80,7 +72,11 @@ export class PaymentRequests extends APIResource {
80
72
  * ```ts
81
73
  * const response = await client.paymentRequests.decline(
82
74
  * 'prq_ecc2efdd09bd231a9ad9bd2aada37aa7',
83
- * { 'Idempotency-Key': 'Idempotency-Key' },
75
+ * {
76
+ * 'Idempotency-Key': 'Idempotency-Key',
77
+ * 'X-Agent-ID': 'X-Agent-ID',
78
+ * 'X-Instance-ID': 'X-Instance-ID',
79
+ * },
84
80
  * );
85
81
  * ```
86
82
  */
@@ -97,11 +93,7 @@ export class PaymentRequests extends APIResource {
97
93
  return this._client.post(path`/payment-requests/${paymentRequestID}/decline`, {
98
94
  ...options,
99
95
  headers: buildHeaders([
100
- {
101
- 'Idempotency-Key': idempotencyKey,
102
- ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
103
- ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
104
- },
96
+ { 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
105
97
  options?.headers,
106
98
  ]),
107
99
  });
@@ -116,10 +108,12 @@ export class PaymentRequests extends APIResource {
116
108
  * 'prq_ecc2efdd09bd231a9ad9bd2aada37aa7',
117
109
  * {
118
110
  * paymentSource: {
119
- * type: 'type',
111
+ * type: 'wallet',
120
112
  * walletId: 'wal_ecc2efdd09bd231a9ad9bd2aada37aa7',
121
113
  * },
122
114
  * 'Idempotency-Key': 'Idempotency-Key',
115
+ * 'X-Agent-ID': 'X-Agent-ID',
116
+ * 'X-Instance-ID': 'X-Instance-ID',
123
117
  * },
124
118
  * );
125
119
  * ```
@@ -139,11 +133,7 @@ export class PaymentRequests extends APIResource {
139
133
  body,
140
134
  ...options,
141
135
  headers: buildHeaders([
142
- {
143
- 'Idempotency-Key': idempotencyKey,
144
- ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
145
- ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
146
- },
136
+ { 'Idempotency-Key': idempotencyKey, 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID },
147
137
  options?.headers,
148
138
  ]),
149
139
  });
@@ -156,24 +146,22 @@ export class PaymentRequests extends APIResource {
156
146
  * ```ts
157
147
  * const paymentRequest = await client.paymentRequests.get(
158
148
  * 'prq_ecc2efdd09bd231a9ad9bd2aada37aa7',
149
+ * {
150
+ * 'X-Agent-ID': 'X-Agent-ID',
151
+ * 'X-Instance-ID': 'X-Instance-ID',
152
+ * },
159
153
  * );
160
154
  * ```
161
155
  */
162
156
  get(
163
157
  paymentRequestID: string,
164
- params: PaymentRequestGetParams | null | undefined = {},
158
+ params: PaymentRequestGetParams,
165
159
  options?: RequestOptions,
166
160
  ): APIPromise<PaymentRequestGetResponse> {
167
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params ?? {};
161
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params;
168
162
  return this._client.get(path`/payment-requests/${paymentRequestID}`, {
169
163
  ...options,
170
- headers: buildHeaders([
171
- {
172
- ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
173
- ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
174
- },
175
- options?.headers,
176
- ]),
164
+ headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
177
165
  });
178
166
  }
179
167
 
@@ -182,25 +170,21 @@ export class PaymentRequests extends APIResource {
182
170
  *
183
171
  * @example
184
172
  * ```ts
185
- * const response =
186
- * await client.paymentRequests.listIncoming();
173
+ * const response = await client.paymentRequests.listIncoming({
174
+ * 'X-Agent-ID': 'X-Agent-ID',
175
+ * 'X-Instance-ID': 'X-Instance-ID',
176
+ * });
187
177
  * ```
188
178
  */
189
179
  listIncoming(
190
- params: PaymentRequestListIncomingParams | null | undefined = {},
180
+ params: PaymentRequestListIncomingParams,
191
181
  options?: RequestOptions,
192
182
  ): APIPromise<PaymentRequestListIncomingResponse> {
193
- const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
183
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
194
184
  return this._client.get('/payment-requests/incoming', {
195
185
  query,
196
186
  ...options,
197
- headers: buildHeaders([
198
- {
199
- ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
200
- ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
201
- },
202
- options?.headers,
203
- ]),
187
+ headers: buildHeaders([{ 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID }, options?.headers]),
204
188
  });
205
189
  }
206
190
  }
@@ -229,7 +213,7 @@ export namespace PaymentRequestCreateResponse {
229
213
  /**
230
214
  * Resource type
231
215
  */
232
- type: string;
216
+ type: 'paymentRequest';
233
217
  }
234
218
 
235
219
  export namespace Data {
@@ -305,7 +289,15 @@ export namespace PaymentRequestCreateResponse {
305
289
  /**
306
290
  * Current status of the payment request
307
291
  */
308
- status: 'OPEN' | 'PROCESSING' | 'COMPLETED' | 'CANCELLED' | 'DECLINED' | 'EXPIRED';
292
+ status:
293
+ | 'OPEN'
294
+ | 'PROCESSING'
295
+ | 'COMPLETED'
296
+ | 'FAILED'
297
+ | 'RETURNED'
298
+ | 'CANCELLED'
299
+ | 'DECLINED'
300
+ | 'EXPIRED';
309
301
 
310
302
  /**
311
303
  * ID of the transaction created by the most recent payment attempt, or null if no
@@ -355,7 +347,7 @@ export namespace PaymentRequestCreateResponse {
355
347
  /**
356
348
  * Resource type
357
349
  */
358
- type: string;
350
+ type: 'party';
359
351
  }
360
352
  }
361
353
 
@@ -379,7 +371,7 @@ export namespace PaymentRequestCreateResponse {
379
371
  /**
380
372
  * Resource type
381
373
  */
382
- type: string;
374
+ type: 'party';
383
375
  }
384
376
  }
385
377
  }
@@ -412,7 +404,7 @@ export namespace PaymentRequestListResponse {
412
404
  /**
413
405
  * Resource type
414
406
  */
415
- type: string;
407
+ type: 'paymentRequest';
416
408
  }
417
409
 
418
410
  export namespace Data {
@@ -488,7 +480,15 @@ export namespace PaymentRequestListResponse {
488
480
  /**
489
481
  * Current status of the payment request
490
482
  */
491
- status: 'OPEN' | 'PROCESSING' | 'COMPLETED' | 'CANCELLED' | 'DECLINED' | 'EXPIRED';
483
+ status:
484
+ | 'OPEN'
485
+ | 'PROCESSING'
486
+ | 'COMPLETED'
487
+ | 'FAILED'
488
+ | 'RETURNED'
489
+ | 'CANCELLED'
490
+ | 'DECLINED'
491
+ | 'EXPIRED';
492
492
 
493
493
  /**
494
494
  * ID of the transaction created by the most recent payment attempt, or null if no
@@ -511,6 +511,11 @@ export namespace PaymentRequestListResponse {
511
511
  */
512
512
  payerParty: Relationships.PayerParty;
513
513
 
514
+ /**
515
+ * Payment submitted for this payment request, if one exists.
516
+ */
517
+ payment: Relationships.Payment;
518
+
514
519
  /**
515
520
  * Party requesting the payment
516
521
  */
@@ -543,7 +548,31 @@ export namespace PaymentRequestListResponse {
543
548
  /**
544
549
  * Resource type
545
550
  */
546
- type: string;
551
+ type: 'party';
552
+ }
553
+ }
554
+
555
+ /**
556
+ * Payment submitted for this payment request, if one exists.
557
+ */
558
+ export interface Payment {
559
+ /**
560
+ * Related resource identifier
561
+ */
562
+ data: Payment.Data | null;
563
+ }
564
+
565
+ export namespace Payment {
566
+ /**
567
+ * Related resource identifier
568
+ */
569
+ export interface Data {
570
+ id: string;
571
+
572
+ /**
573
+ * Resource type
574
+ */
575
+ type: 'payment';
547
576
  }
548
577
  }
549
578
 
@@ -567,7 +596,7 @@ export namespace PaymentRequestListResponse {
567
596
  /**
568
597
  * Resource type
569
598
  */
570
- type: string;
599
+ type: 'party';
571
600
  }
572
601
  }
573
602
 
@@ -591,7 +620,7 @@ export namespace PaymentRequestListResponse {
591
620
  /**
592
621
  * Resource type
593
622
  */
594
- type: string;
623
+ type: 'wallet';
595
624
  }
596
625
  }
597
626
  }
@@ -634,7 +663,7 @@ export namespace PaymentRequestDeclineResponse {
634
663
  /**
635
664
  * Resource type
636
665
  */
637
- type: string;
666
+ type: 'paymentRequest';
638
667
  }
639
668
 
640
669
  export namespace Data {
@@ -710,7 +739,15 @@ export namespace PaymentRequestDeclineResponse {
710
739
  /**
711
740
  * Current status of the payment request
712
741
  */
713
- status: 'OPEN' | 'PROCESSING' | 'COMPLETED' | 'CANCELLED' | 'DECLINED' | 'EXPIRED';
742
+ status:
743
+ | 'OPEN'
744
+ | 'PROCESSING'
745
+ | 'COMPLETED'
746
+ | 'FAILED'
747
+ | 'RETURNED'
748
+ | 'CANCELLED'
749
+ | 'DECLINED'
750
+ | 'EXPIRED';
714
751
 
715
752
  /**
716
753
  * ID of the transaction created by the most recent payment attempt, or null if no
@@ -733,6 +770,11 @@ export namespace PaymentRequestDeclineResponse {
733
770
  */
734
771
  payerParty: Relationships.PayerParty;
735
772
 
773
+ /**
774
+ * Payment submitted for this payment request, if one exists.
775
+ */
776
+ payment: Relationships.Payment;
777
+
736
778
  /**
737
779
  * Party requesting the payment
738
780
  */
@@ -765,7 +807,31 @@ export namespace PaymentRequestDeclineResponse {
765
807
  /**
766
808
  * Resource type
767
809
  */
768
- type: string;
810
+ type: 'party';
811
+ }
812
+ }
813
+
814
+ /**
815
+ * Payment submitted for this payment request, if one exists.
816
+ */
817
+ export interface Payment {
818
+ /**
819
+ * Related resource identifier
820
+ */
821
+ data: Payment.Data | null;
822
+ }
823
+
824
+ export namespace Payment {
825
+ /**
826
+ * Related resource identifier
827
+ */
828
+ export interface Data {
829
+ id: string;
830
+
831
+ /**
832
+ * Resource type
833
+ */
834
+ type: 'payment';
769
835
  }
770
836
  }
771
837
 
@@ -789,7 +855,7 @@ export namespace PaymentRequestDeclineResponse {
789
855
  /**
790
856
  * Resource type
791
857
  */
792
- type: string;
858
+ type: 'party';
793
859
  }
794
860
  }
795
861
 
@@ -813,7 +879,7 @@ export namespace PaymentRequestDeclineResponse {
813
879
  /**
814
880
  * Resource type
815
881
  */
816
- type: string;
882
+ type: 'wallet';
817
883
  }
818
884
  }
819
885
  }
@@ -828,14 +894,216 @@ export namespace PaymentRequestFulfillResponse {
828
894
  export interface Data {
829
895
  id: string;
830
896
 
897
+ /**
898
+ * Resource attributes
899
+ */
831
900
  attributes: Data.Attributes;
832
901
 
833
- type: string;
902
+ /**
903
+ * Resource relationships
904
+ */
905
+ relationships: Data.Relationships;
906
+
907
+ type: 'payment';
834
908
  }
835
909
 
836
910
  export namespace Data {
911
+ /**
912
+ * Resource attributes
913
+ */
837
914
  export interface Attributes {
838
- outcome: 'processing' | 'failed' | 'completed' | 'in_review';
915
+ /**
916
+ * Amount in cents
917
+ */
918
+ amount: number;
919
+
920
+ /**
921
+ * When this payment was created
922
+ */
923
+ createdAt: string;
924
+
925
+ /**
926
+ * Currency code
927
+ */
928
+ currency: string;
929
+
930
+ /**
931
+ * Payment description
932
+ */
933
+ description: string | null;
934
+
935
+ /**
936
+ * Payment status
937
+ */
938
+ status:
939
+ | 'CREATED'
940
+ | 'PROCESSING'
941
+ | 'PENDING_CLAIM'
942
+ | 'IN_REVIEW'
943
+ | 'COMPLETED'
944
+ | 'FAILED'
945
+ | 'RETURNED'
946
+ | 'APPROVAL_DENIED'
947
+ | 'CANCELLED';
948
+
949
+ /**
950
+ * When this payment was last updated
951
+ */
952
+ updatedAt: string | null;
953
+ }
954
+
955
+ /**
956
+ * Resource relationships
957
+ */
958
+ export interface Relationships {
959
+ /**
960
+ * Payment request that produced this payment, when applicable.
961
+ */
962
+ paymentRequest: Relationships.PaymentRequest;
963
+
964
+ /**
965
+ * Recipient party for this payment, when known.
966
+ */
967
+ recipient: Relationships.Recipient;
968
+
969
+ /**
970
+ * Recipient agent when the caller addressed an agent ID. Null otherwise, including
971
+ * when the recipient was addressed as an email, phone, or party ID.
972
+ */
973
+ recipientAgent: Relationships.RecipientAgent;
974
+
975
+ /**
976
+ * Party that initiated the payment
977
+ */
978
+ sender: Relationships.Sender;
979
+
980
+ /**
981
+ * Sender-side transaction row for this payment, when available.
982
+ */
983
+ transaction: Relationships.Transaction;
984
+ }
985
+
986
+ export namespace Relationships {
987
+ /**
988
+ * Payment request that produced this payment, when applicable.
989
+ */
990
+ export interface PaymentRequest {
991
+ /**
992
+ * Related resource identifier
993
+ */
994
+ data: PaymentRequest.Data | null;
995
+ }
996
+
997
+ export namespace PaymentRequest {
998
+ /**
999
+ * Related resource identifier
1000
+ */
1001
+ export interface Data {
1002
+ id: string;
1003
+
1004
+ /**
1005
+ * Resource type
1006
+ */
1007
+ type: 'paymentRequest';
1008
+ }
1009
+ }
1010
+
1011
+ /**
1012
+ * Recipient party for this payment, when known.
1013
+ */
1014
+ export interface Recipient {
1015
+ /**
1016
+ * Related resource identifier
1017
+ */
1018
+ data: Recipient.Data | null;
1019
+ }
1020
+
1021
+ export namespace Recipient {
1022
+ /**
1023
+ * Related resource identifier
1024
+ */
1025
+ export interface Data {
1026
+ id: string;
1027
+
1028
+ /**
1029
+ * Resource type
1030
+ */
1031
+ type: 'party';
1032
+ }
1033
+ }
1034
+
1035
+ /**
1036
+ * Recipient agent when the caller addressed an agent ID. Null otherwise, including
1037
+ * when the recipient was addressed as an email, phone, or party ID.
1038
+ */
1039
+ export interface RecipientAgent {
1040
+ /**
1041
+ * Related resource identifier
1042
+ */
1043
+ data: RecipientAgent.Data | null;
1044
+ }
1045
+
1046
+ export namespace RecipientAgent {
1047
+ /**
1048
+ * Related resource identifier
1049
+ */
1050
+ export interface Data {
1051
+ id: string;
1052
+
1053
+ /**
1054
+ * Resource type
1055
+ */
1056
+ type: 'agent';
1057
+ }
1058
+ }
1059
+
1060
+ /**
1061
+ * Party that initiated the payment
1062
+ */
1063
+ export interface Sender {
1064
+ /**
1065
+ * Related resource identifier
1066
+ */
1067
+ data: Sender.Data;
1068
+ }
1069
+
1070
+ export namespace Sender {
1071
+ /**
1072
+ * Related resource identifier
1073
+ */
1074
+ export interface Data {
1075
+ id: string;
1076
+
1077
+ /**
1078
+ * Resource type
1079
+ */
1080
+ type: 'party';
1081
+ }
1082
+ }
1083
+
1084
+ /**
1085
+ * Sender-side transaction row for this payment, when available.
1086
+ */
1087
+ export interface Transaction {
1088
+ /**
1089
+ * Related resource identifier
1090
+ */
1091
+ data: Transaction.Data | null;
1092
+ }
1093
+
1094
+ export namespace Transaction {
1095
+ /**
1096
+ * Related resource identifier
1097
+ */
1098
+ export interface Data {
1099
+ id: string;
1100
+
1101
+ /**
1102
+ * Resource type
1103
+ */
1104
+ type: 'transaction';
1105
+ }
1106
+ }
839
1107
  }
840
1108
  }
841
1109
  }
@@ -864,7 +1132,7 @@ export namespace PaymentRequestGetResponse {
864
1132
  /**
865
1133
  * Resource type
866
1134
  */
867
- type: string;
1135
+ type: 'paymentRequest';
868
1136
  }
869
1137
 
870
1138
  export namespace Data {
@@ -940,7 +1208,15 @@ export namespace PaymentRequestGetResponse {
940
1208
  /**
941
1209
  * Current status of the payment request
942
1210
  */
943
- status: 'OPEN' | 'PROCESSING' | 'COMPLETED' | 'CANCELLED' | 'DECLINED' | 'EXPIRED';
1211
+ status:
1212
+ | 'OPEN'
1213
+ | 'PROCESSING'
1214
+ | 'COMPLETED'
1215
+ | 'FAILED'
1216
+ | 'RETURNED'
1217
+ | 'CANCELLED'
1218
+ | 'DECLINED'
1219
+ | 'EXPIRED';
944
1220
 
945
1221
  /**
946
1222
  * ID of the transaction created by the most recent payment attempt, or null if no
@@ -963,6 +1239,11 @@ export namespace PaymentRequestGetResponse {
963
1239
  */
964
1240
  payerParty: Relationships.PayerParty;
965
1241
 
1242
+ /**
1243
+ * Payment submitted for this payment request, if one exists.
1244
+ */
1245
+ payment: Relationships.Payment;
1246
+
966
1247
  /**
967
1248
  * Party requesting the payment
968
1249
  */
@@ -995,7 +1276,31 @@ export namespace PaymentRequestGetResponse {
995
1276
  /**
996
1277
  * Resource type
997
1278
  */
998
- type: string;
1279
+ type: 'party';
1280
+ }
1281
+ }
1282
+
1283
+ /**
1284
+ * Payment submitted for this payment request, if one exists.
1285
+ */
1286
+ export interface Payment {
1287
+ /**
1288
+ * Related resource identifier
1289
+ */
1290
+ data: Payment.Data | null;
1291
+ }
1292
+
1293
+ export namespace Payment {
1294
+ /**
1295
+ * Related resource identifier
1296
+ */
1297
+ export interface Data {
1298
+ id: string;
1299
+
1300
+ /**
1301
+ * Resource type
1302
+ */
1303
+ type: 'payment';
999
1304
  }
1000
1305
  }
1001
1306
 
@@ -1019,7 +1324,7 @@ export namespace PaymentRequestGetResponse {
1019
1324
  /**
1020
1325
  * Resource type
1021
1326
  */
1022
- type: string;
1327
+ type: 'party';
1023
1328
  }
1024
1329
  }
1025
1330
 
@@ -1043,7 +1348,7 @@ export namespace PaymentRequestGetResponse {
1043
1348
  /**
1044
1349
  * Resource type
1045
1350
  */
1046
- type: string;
1351
+ type: 'wallet';
1047
1352
  }
1048
1353
  }
1049
1354
  }
@@ -1076,7 +1381,7 @@ export namespace PaymentRequestListIncomingResponse {
1076
1381
  /**
1077
1382
  * Resource type
1078
1383
  */
1079
- type: string;
1384
+ type: 'paymentRequest';
1080
1385
  }
1081
1386
 
1082
1387
  export namespace Data {
@@ -1152,7 +1457,15 @@ export namespace PaymentRequestListIncomingResponse {
1152
1457
  /**
1153
1458
  * Current status of the payment request
1154
1459
  */
1155
- status: 'OPEN' | 'PROCESSING' | 'COMPLETED' | 'CANCELLED' | 'DECLINED' | 'EXPIRED';
1460
+ status:
1461
+ | 'OPEN'
1462
+ | 'PROCESSING'
1463
+ | 'COMPLETED'
1464
+ | 'FAILED'
1465
+ | 'RETURNED'
1466
+ | 'CANCELLED'
1467
+ | 'DECLINED'
1468
+ | 'EXPIRED';
1156
1469
 
1157
1470
  /**
1158
1471
  * ID of the transaction created by the most recent payment attempt, or null if no
@@ -1175,6 +1488,11 @@ export namespace PaymentRequestListIncomingResponse {
1175
1488
  */
1176
1489
  payerParty: Relationships.PayerParty;
1177
1490
 
1491
+ /**
1492
+ * Payment submitted for this payment request, if one exists.
1493
+ */
1494
+ payment: Relationships.Payment;
1495
+
1178
1496
  /**
1179
1497
  * Party requesting the payment
1180
1498
  */
@@ -1207,7 +1525,31 @@ export namespace PaymentRequestListIncomingResponse {
1207
1525
  /**
1208
1526
  * Resource type
1209
1527
  */
1210
- type: string;
1528
+ type: 'party';
1529
+ }
1530
+ }
1531
+
1532
+ /**
1533
+ * Payment submitted for this payment request, if one exists.
1534
+ */
1535
+ export interface Payment {
1536
+ /**
1537
+ * Related resource identifier
1538
+ */
1539
+ data: Payment.Data | null;
1540
+ }
1541
+
1542
+ export namespace Payment {
1543
+ /**
1544
+ * Related resource identifier
1545
+ */
1546
+ export interface Data {
1547
+ id: string;
1548
+
1549
+ /**
1550
+ * Resource type
1551
+ */
1552
+ type: 'payment';
1211
1553
  }
1212
1554
  }
1213
1555
 
@@ -1231,7 +1573,7 @@ export namespace PaymentRequestListIncomingResponse {
1231
1573
  /**
1232
1574
  * Resource type
1233
1575
  */
1234
- type: string;
1576
+ type: 'party';
1235
1577
  }
1236
1578
  }
1237
1579
 
@@ -1255,7 +1597,7 @@ export namespace PaymentRequestListIncomingResponse {
1255
1597
  /**
1256
1598
  * Resource type
1257
1599
  */
1258
- type: string;
1600
+ type: 'wallet';
1259
1601
  }
1260
1602
  }
1261
1603
  }
@@ -1284,7 +1626,11 @@ export interface PaymentRequestCreateParams {
1284
1626
  * Body param: Who pays — exactly one typed email, phone, party ID, or agent ID
1285
1627
  * value.
1286
1628
  */
1287
- payer: PaymentRequestCreateParams.UnionMember0 | PaymentRequestCreateParams.UnionMember1;
1629
+ payer:
1630
+ | PaymentRequestCreateParams.UnionMember0
1631
+ | PaymentRequestCreateParams.UnionMember1
1632
+ | PaymentRequestCreateParams.UnionMember2
1633
+ | PaymentRequestCreateParams.UnionMember3;
1288
1634
 
1289
1635
  /**
1290
1636
  * Header param: Unique key for idempotent request handling. If a request with the
@@ -1292,6 +1638,16 @@ export interface PaymentRequestCreateParams {
1292
1638
  */
1293
1639
  'Idempotency-Key': string;
1294
1640
 
1641
+ /**
1642
+ * Header param: Agent ID (agt_xxx) used for attribution and audit.
1643
+ */
1644
+ 'X-Agent-ID': string;
1645
+
1646
+ /**
1647
+ * Header param: Stable run, session, or conversation ID for agent observability.
1648
+ */
1649
+ 'X-Instance-ID': string;
1650
+
1295
1651
  /**
1296
1652
  * Body param: Currency code (currently only USD)
1297
1653
  */
@@ -1324,22 +1680,11 @@ export interface PaymentRequestCreateParams {
1324
1680
  * party's default wallet.
1325
1681
  */
1326
1682
  walletId?: string;
1327
-
1328
- /**
1329
- * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1330
- */
1331
- 'X-Agent-ID'?: string;
1332
-
1333
- /**
1334
- * Header param: Required when X-Agent-ID is present. Session or conversation ID
1335
- * for agent observability.
1336
- */
1337
- 'X-Instance-ID'?: string;
1338
1683
  }
1339
1684
 
1340
1685
  export namespace PaymentRequestCreateParams {
1341
1686
  export interface UnionMember0 {
1342
- type: string;
1687
+ type: 'email';
1343
1688
 
1344
1689
  /**
1345
1690
  * Email address
@@ -1348,7 +1693,7 @@ export namespace PaymentRequestCreateParams {
1348
1693
  }
1349
1694
 
1350
1695
  export interface UnionMember1 {
1351
- type: string;
1696
+ type: 'phone';
1352
1697
 
1353
1698
  /**
1354
1699
  * Phone number in E.164 format
@@ -1356,6 +1701,24 @@ export namespace PaymentRequestCreateParams {
1356
1701
  value: string;
1357
1702
  }
1358
1703
 
1704
+ export interface UnionMember2 {
1705
+ type: 'party_id';
1706
+
1707
+ /**
1708
+ * Natural party ID (pty\_\*)
1709
+ */
1710
+ value: string;
1711
+ }
1712
+
1713
+ export interface UnionMember3 {
1714
+ type: 'agent_id';
1715
+
1716
+ /**
1717
+ * Natural agent ID (agt\_\*)
1718
+ */
1719
+ value: string;
1720
+ }
1721
+
1359
1722
  /**
1360
1723
  * If provided, immediately deliver the payment link to the payer via the named
1361
1724
  * channel
@@ -1370,25 +1733,24 @@ export namespace PaymentRequestCreateParams {
1370
1733
 
1371
1734
  export interface PaymentRequestListParams {
1372
1735
  /**
1373
- * Query param: Pagination cursor returned by the previous response
1736
+ * Header param: Agent ID (agt_xxx) used for attribution and audit.
1374
1737
  */
1375
- cursor?: string;
1738
+ 'X-Agent-ID': string;
1376
1739
 
1377
1740
  /**
1378
- * Query param: Results per page (1-100)
1741
+ * Header param: Stable run, session, or conversation ID for agent observability.
1379
1742
  */
1380
- limit?: number;
1743
+ 'X-Instance-ID': string;
1381
1744
 
1382
1745
  /**
1383
- * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1746
+ * Query param: Pagination cursor returned by the previous response
1384
1747
  */
1385
- 'X-Agent-ID'?: string;
1748
+ cursor?: string;
1386
1749
 
1387
1750
  /**
1388
- * Header param: Required when X-Agent-ID is present. Session or conversation ID
1389
- * for agent observability.
1751
+ * Query param: Results per page (1-100)
1390
1752
  */
1391
- 'X-Instance-ID'?: string;
1753
+ limit?: number;
1392
1754
  }
1393
1755
 
1394
1756
  export interface PaymentRequestDeclineParams {
@@ -1399,15 +1761,14 @@ export interface PaymentRequestDeclineParams {
1399
1761
  'Idempotency-Key': string;
1400
1762
 
1401
1763
  /**
1402
- * Agent ID (agt_xxx) identifying which agent is making the request.
1764
+ * Agent ID (agt_xxx) used for attribution and audit.
1403
1765
  */
1404
- 'X-Agent-ID'?: string;
1766
+ 'X-Agent-ID': string;
1405
1767
 
1406
1768
  /**
1407
- * Required when X-Agent-ID is present. Session or conversation ID for agent
1408
- * observability.
1769
+ * Stable run, session, or conversation ID for agent observability.
1409
1770
  */
1410
- 'X-Instance-ID'?: string;
1771
+ 'X-Instance-ID': string;
1411
1772
  }
1412
1773
 
1413
1774
  export interface PaymentRequestFulfillParams {
@@ -1423,20 +1784,19 @@ export interface PaymentRequestFulfillParams {
1423
1784
  'Idempotency-Key': string;
1424
1785
 
1425
1786
  /**
1426
- * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1787
+ * Header param: Agent ID (agt_xxx) used for attribution and audit.
1427
1788
  */
1428
- 'X-Agent-ID'?: string;
1789
+ 'X-Agent-ID': string;
1429
1790
 
1430
1791
  /**
1431
- * Header param: Required when X-Agent-ID is present. Session or conversation ID
1432
- * for agent observability.
1792
+ * Header param: Stable run, session, or conversation ID for agent observability.
1433
1793
  */
1434
- 'X-Instance-ID'?: string;
1794
+ 'X-Instance-ID': string;
1435
1795
  }
1436
1796
 
1437
1797
  export namespace PaymentRequestFulfillParams {
1438
1798
  export interface UnionMember0 {
1439
- type: string;
1799
+ type: 'wallet';
1440
1800
 
1441
1801
  walletId: string;
1442
1802
  }
@@ -1444,44 +1804,42 @@ export namespace PaymentRequestFulfillParams {
1444
1804
  export interface UnionMember1 {
1445
1805
  externalAccountId: string;
1446
1806
 
1447
- type: string;
1807
+ type: 'external_account';
1448
1808
  }
1449
1809
  }
1450
1810
 
1451
1811
  export interface PaymentRequestGetParams {
1452
1812
  /**
1453
- * Agent ID (agt_xxx) identifying which agent is making the request.
1813
+ * Agent ID (agt_xxx) used for attribution and audit.
1454
1814
  */
1455
- 'X-Agent-ID'?: string;
1815
+ 'X-Agent-ID': string;
1456
1816
 
1457
1817
  /**
1458
- * Required when X-Agent-ID is present. Session or conversation ID for agent
1459
- * observability.
1818
+ * Stable run, session, or conversation ID for agent observability.
1460
1819
  */
1461
- 'X-Instance-ID'?: string;
1820
+ 'X-Instance-ID': string;
1462
1821
  }
1463
1822
 
1464
1823
  export interface PaymentRequestListIncomingParams {
1465
1824
  /**
1466
- * Query param: Pagination cursor returned by the previous response
1825
+ * Header param: Agent ID (agt_xxx) used for attribution and audit.
1467
1826
  */
1468
- cursor?: string;
1827
+ 'X-Agent-ID': string;
1469
1828
 
1470
1829
  /**
1471
- * Query param: Results per page (1-100)
1830
+ * Header param: Stable run, session, or conversation ID for agent observability.
1472
1831
  */
1473
- limit?: number;
1832
+ 'X-Instance-ID': string;
1474
1833
 
1475
1834
  /**
1476
- * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1835
+ * Query param: Pagination cursor returned by the previous response
1477
1836
  */
1478
- 'X-Agent-ID'?: string;
1837
+ cursor?: string;
1479
1838
 
1480
1839
  /**
1481
- * Header param: Required when X-Agent-ID is present. Session or conversation ID
1482
- * for agent observability.
1840
+ * Query param: Results per page (1-100)
1483
1841
  */
1484
- 'X-Instance-ID'?: string;
1842
+ limit?: number;
1485
1843
  }
1486
1844
 
1487
1845
  export declare namespace PaymentRequests {