@naturalpay/sdk 0.2.1 → 0.4.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 (234) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +2 -2
  3. package/api-promise.d.mts +1 -0
  4. package/api-promise.d.mts.map +1 -1
  5. package/api-promise.d.ts +1 -0
  6. package/api-promise.d.ts.map +1 -1
  7. package/api-promise.mjs +1 -0
  8. package/api-promise.mjs.map +1 -1
  9. package/client.d.mts +37 -13
  10. package/client.d.mts.map +1 -1
  11. package/client.d.ts +37 -13
  12. package/client.d.ts.map +1 -1
  13. package/client.js +30 -6
  14. package/client.js.map +1 -1
  15. package/client.mjs +31 -7
  16. package/client.mjs.map +1 -1
  17. package/core/api-promise.d.mts.map +1 -1
  18. package/core/api-promise.d.ts.map +1 -1
  19. package/core/api-promise.mjs.map +1 -1
  20. package/core/error.mjs.map +1 -1
  21. package/core/resource.d.mts.map +1 -1
  22. package/core/resource.d.ts.map +1 -1
  23. package/core/uploads.d.mts.map +1 -1
  24. package/core/uploads.d.ts.map +1 -1
  25. package/core/uploads.mjs.map +1 -1
  26. package/error.d.mts +1 -0
  27. package/error.d.mts.map +1 -1
  28. package/error.d.ts +1 -0
  29. package/error.d.ts.map +1 -1
  30. package/error.mjs +1 -0
  31. package/error.mjs.map +1 -1
  32. package/index.d.mts.map +1 -1
  33. package/index.d.ts.map +1 -1
  34. package/index.mjs.map +1 -1
  35. package/internal/detect-platform.mjs.map +1 -1
  36. package/internal/headers.mjs.map +1 -1
  37. package/internal/parse.d.mts.map +1 -1
  38. package/internal/parse.d.ts.map +1 -1
  39. package/internal/parse.mjs.map +1 -1
  40. package/internal/qs/formats.d.mts.map +1 -1
  41. package/internal/qs/formats.d.ts.map +1 -1
  42. package/internal/qs/index.d.mts +2 -2
  43. package/internal/qs/index.d.mts.map +1 -1
  44. package/internal/qs/index.d.ts +2 -2
  45. package/internal/qs/index.d.ts.map +1 -1
  46. package/internal/qs/index.mjs.map +1 -1
  47. package/internal/qs/stringify.d.mts.map +1 -1
  48. package/internal/qs/stringify.d.ts.map +1 -1
  49. package/internal/qs/stringify.mjs.map +1 -1
  50. package/internal/qs/utils.d.mts.map +1 -1
  51. package/internal/qs/utils.d.ts.map +1 -1
  52. package/internal/qs/utils.mjs.map +1 -1
  53. package/internal/request-options.d.mts.map +1 -1
  54. package/internal/request-options.d.ts.map +1 -1
  55. package/internal/shims.d.mts +6 -0
  56. package/internal/shims.d.mts.map +1 -1
  57. package/internal/shims.d.ts +6 -0
  58. package/internal/shims.d.ts.map +1 -1
  59. package/internal/to-file.d.mts.map +1 -1
  60. package/internal/to-file.d.ts.map +1 -1
  61. package/internal/to-file.mjs.map +1 -1
  62. package/internal/types.d.mts +4 -4
  63. package/internal/types.d.mts.map +1 -1
  64. package/internal/types.d.ts +4 -4
  65. package/internal/types.d.ts.map +1 -1
  66. package/internal/uploads.d.mts.map +1 -1
  67. package/internal/uploads.d.ts.map +1 -1
  68. package/internal/uploads.mjs.map +1 -1
  69. package/internal/utils/base64.mjs.map +1 -1
  70. package/internal/utils/log.d.mts.map +1 -1
  71. package/internal/utils/log.d.ts.map +1 -1
  72. package/internal/utils/log.mjs.map +1 -1
  73. package/internal/utils/path.mjs.map +1 -1
  74. package/internal/utils/query.mjs.map +1 -1
  75. package/internal/utils/values.mjs.map +1 -1
  76. package/internal/utils.d.mts.map +1 -1
  77. package/internal/utils.d.ts.map +1 -1
  78. package/internal/utils.mjs.map +1 -1
  79. package/lib/envelope.d.mts.map +1 -1
  80. package/lib/envelope.d.ts.map +1 -1
  81. package/lib/envelope.mjs.map +1 -1
  82. package/package.json +1 -1
  83. package/resource.d.mts +1 -0
  84. package/resource.d.mts.map +1 -1
  85. package/resource.d.ts +1 -0
  86. package/resource.d.ts.map +1 -1
  87. package/resource.mjs +1 -0
  88. package/resource.mjs.map +1 -1
  89. package/resources/agents.d.mts +4 -153
  90. package/resources/agents.d.mts.map +1 -1
  91. package/resources/agents.d.ts +4 -153
  92. package/resources/agents.d.ts.map +1 -1
  93. package/resources/agents.js +5 -5
  94. package/resources/agents.js.map +1 -1
  95. package/resources/agents.mjs +5 -5
  96. package/resources/agents.mjs.map +1 -1
  97. package/resources/api-keys.d.mts +16 -2
  98. package/resources/api-keys.d.mts.map +1 -1
  99. package/resources/api-keys.d.ts +16 -2
  100. package/resources/api-keys.d.ts.map +1 -1
  101. package/resources/api-keys.js +7 -4
  102. package/resources/api-keys.js.map +1 -1
  103. package/resources/api-keys.mjs +7 -4
  104. package/resources/api-keys.mjs.map +1 -1
  105. package/resources/counterparties.d.mts +5 -55
  106. package/resources/counterparties.d.mts.map +1 -1
  107. package/resources/counterparties.d.ts +5 -55
  108. package/resources/counterparties.d.ts.map +1 -1
  109. package/resources/counterparties.js +1 -3
  110. package/resources/counterparties.js.map +1 -1
  111. package/resources/counterparties.mjs +1 -3
  112. package/resources/counterparties.mjs.map +1 -1
  113. package/resources/customers.d.mts.map +1 -1
  114. package/resources/customers.d.ts.map +1 -1
  115. package/resources/customers.mjs.map +1 -1
  116. package/resources/delegations.d.mts.map +1 -1
  117. package/resources/delegations.d.ts.map +1 -1
  118. package/resources/delegations.mjs.map +1 -1
  119. package/resources/escalations.d.mts +1124 -0
  120. package/resources/escalations.d.mts.map +1 -0
  121. package/resources/escalations.d.ts +1124 -0
  122. package/resources/escalations.d.ts.map +1 -0
  123. package/resources/escalations.js +110 -0
  124. package/resources/escalations.js.map +1 -0
  125. package/resources/escalations.mjs +106 -0
  126. package/resources/escalations.mjs.map +1 -0
  127. package/resources/external-accounts.d.mts +239 -0
  128. package/resources/external-accounts.d.mts.map +1 -0
  129. package/resources/external-accounts.d.ts +239 -0
  130. package/resources/external-accounts.d.ts.map +1 -0
  131. package/resources/external-accounts.js +47 -0
  132. package/resources/external-accounts.js.map +1 -0
  133. package/resources/external-accounts.mjs +43 -0
  134. package/resources/external-accounts.mjs.map +1 -0
  135. package/resources/index.d.mts +8 -4
  136. package/resources/index.d.mts.map +1 -1
  137. package/resources/index.d.ts +8 -4
  138. package/resources/index.d.ts.map +1 -1
  139. package/resources/index.js +9 -1
  140. package/resources/index.js.map +1 -1
  141. package/resources/index.mjs +5 -1
  142. package/resources/index.mjs.map +1 -1
  143. package/resources/invitations.d.mts +17 -8
  144. package/resources/invitations.d.mts.map +1 -1
  145. package/resources/invitations.d.ts +17 -8
  146. package/resources/invitations.d.ts.map +1 -1
  147. package/resources/invitations.js +7 -5
  148. package/resources/invitations.js.map +1 -1
  149. package/resources/invitations.mjs +7 -5
  150. package/resources/invitations.mjs.map +1 -1
  151. package/resources/parties.d.mts +55 -28
  152. package/resources/parties.d.mts.map +1 -1
  153. package/resources/parties.d.ts +55 -28
  154. package/resources/parties.d.ts.map +1 -1
  155. package/resources/parties.js +30 -4
  156. package/resources/parties.js.map +1 -1
  157. package/resources/parties.mjs +30 -4
  158. package/resources/parties.mjs.map +1 -1
  159. package/resources/payment-requests.d.mts +751 -39
  160. package/resources/payment-requests.d.mts.map +1 -1
  161. package/resources/payment-requests.d.ts +751 -39
  162. package/resources/payment-requests.d.ts.map +1 -1
  163. package/resources/payment-requests.js +82 -2
  164. package/resources/payment-requests.js.map +1 -1
  165. package/resources/payment-requests.mjs +82 -2
  166. package/resources/payment-requests.mjs.map +1 -1
  167. package/resources/payments.d.mts +390 -24
  168. package/resources/payments.d.mts.map +1 -1
  169. package/resources/payments.d.ts +390 -24
  170. package/resources/payments.d.ts.map +1 -1
  171. package/resources/payments.js +53 -3
  172. package/resources/payments.js.map +1 -1
  173. package/resources/payments.mjs +53 -3
  174. package/resources/payments.mjs.map +1 -1
  175. package/resources/transactions.d.mts +53 -113
  176. package/resources/transactions.d.mts.map +1 -1
  177. package/resources/transactions.d.ts +53 -113
  178. package/resources/transactions.d.ts.map +1 -1
  179. package/resources/transactions.js +3 -3
  180. package/resources/transactions.mjs +3 -3
  181. package/resources/transactions.mjs.map +1 -1
  182. package/resources/transfers.d.mts +1030 -0
  183. package/resources/transfers.d.mts.map +1 -0
  184. package/resources/transfers.d.ts +1030 -0
  185. package/resources/transfers.d.ts.map +1 -0
  186. package/resources/transfers.js +114 -0
  187. package/resources/transfers.js.map +1 -0
  188. package/resources/transfers.mjs +110 -0
  189. package/resources/transfers.mjs.map +1 -0
  190. package/resources/wallet.d.mts +117 -437
  191. package/resources/wallet.d.mts.map +1 -1
  192. package/resources/wallet.d.ts +117 -437
  193. package/resources/wallet.d.ts.map +1 -1
  194. package/resources/wallet.js +9 -122
  195. package/resources/wallet.js.map +1 -1
  196. package/resources/wallet.mjs +9 -122
  197. package/resources/wallet.mjs.map +1 -1
  198. package/resources/webhooks.d.mts +775 -0
  199. package/resources/webhooks.d.mts.map +1 -0
  200. package/resources/webhooks.d.ts +775 -0
  201. package/resources/webhooks.d.ts.map +1 -0
  202. package/resources/webhooks.js +163 -0
  203. package/resources/webhooks.js.map +1 -0
  204. package/resources/webhooks.mjs +159 -0
  205. package/resources/webhooks.mjs.map +1 -0
  206. package/resources.d.mts.map +1 -1
  207. package/resources.d.ts.map +1 -1
  208. package/resources.mjs.map +1 -1
  209. package/src/client.ts +156 -32
  210. package/src/resources/agents.ts +5 -185
  211. package/src/resources/api-keys.ts +26 -4
  212. package/src/resources/counterparties.ts +5 -64
  213. package/src/resources/escalations.ts +1422 -0
  214. package/src/resources/external-accounts.ts +324 -0
  215. package/src/resources/index.ts +65 -13
  216. package/src/resources/invitations.ts +27 -11
  217. package/src/resources/parties.ts +88 -33
  218. package/src/resources/payment-requests.ts +945 -44
  219. package/src/resources/payments.ts +518 -23
  220. package/src/resources/transactions.ts +53 -129
  221. package/src/resources/transfers.ts +1338 -0
  222. package/src/resources/wallet.ts +133 -597
  223. package/src/resources/webhooks.ts +1232 -0
  224. package/src/version.ts +1 -1
  225. package/uploads.d.mts +1 -0
  226. package/uploads.d.mts.map +1 -1
  227. package/uploads.d.ts +1 -0
  228. package/uploads.d.ts.map +1 -1
  229. package/uploads.mjs +1 -0
  230. package/uploads.mjs.map +1 -1
  231. package/version.d.mts +1 -1
  232. package/version.d.ts +1 -1
  233. package/version.js +1 -1
  234. package/version.mjs +1 -1
@@ -17,8 +17,7 @@ export class PaymentRequests extends APIResource {
17
17
  * ```ts
18
18
  * const paymentRequest = await client.paymentRequests.create({
19
19
  * amount: 1,
20
- * payer: { kind: 'email', value: 'dev@stainless.com' },
21
- * walletId: 'wal_ecc2efdd09bd231a9ad9bd2aada37aa7',
20
+ * payer: { type: 'type', value: 'dev@stainless.com' },
22
21
  * 'Idempotency-Key': 'Idempotency-Key',
23
22
  * });
24
23
  * ```
@@ -73,6 +72,83 @@ export class PaymentRequests extends APIResource {
73
72
  });
74
73
  }
75
74
 
75
+ /**
76
+ * Decline an open payment request where the authenticated party is expected to
77
+ * pay.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const response = await client.paymentRequests.decline(
82
+ * 'prq_ecc2efdd09bd231a9ad9bd2aada37aa7',
83
+ * { 'Idempotency-Key': 'Idempotency-Key' },
84
+ * );
85
+ * ```
86
+ */
87
+ decline(
88
+ paymentRequestID: string,
89
+ params: PaymentRequestDeclineParams,
90
+ options?: RequestOptions,
91
+ ): APIPromise<PaymentRequestDeclineResponse> {
92
+ const {
93
+ 'Idempotency-Key': idempotencyKey,
94
+ 'X-Agent-ID': xAgentID,
95
+ 'X-Instance-ID': xInstanceID,
96
+ } = params;
97
+ return this._client.post(path`/payment-requests/${paymentRequestID}/decline`, {
98
+ ...options,
99
+ headers: buildHeaders([
100
+ {
101
+ 'Idempotency-Key': idempotencyKey,
102
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
103
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
104
+ },
105
+ options?.headers,
106
+ ]),
107
+ });
108
+ }
109
+
110
+ /**
111
+ * Fulfill an open payment request from inside the authenticated app.
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * const response = await client.paymentRequests.fulfill(
116
+ * 'prq_ecc2efdd09bd231a9ad9bd2aada37aa7',
117
+ * {
118
+ * paymentSource: {
119
+ * type: 'type',
120
+ * walletId: 'wal_ecc2efdd09bd231a9ad9bd2aada37aa7',
121
+ * },
122
+ * 'Idempotency-Key': 'Idempotency-Key',
123
+ * },
124
+ * );
125
+ * ```
126
+ */
127
+ fulfill(
128
+ paymentRequestID: string,
129
+ params: PaymentRequestFulfillParams,
130
+ options?: RequestOptions,
131
+ ): APIPromise<PaymentRequestFulfillResponse> {
132
+ const {
133
+ 'Idempotency-Key': idempotencyKey,
134
+ 'X-Agent-ID': xAgentID,
135
+ 'X-Instance-ID': xInstanceID,
136
+ ...body
137
+ } = params;
138
+ return this._client.post(path`/payment-requests/${paymentRequestID}/fulfill`, {
139
+ body,
140
+ ...options,
141
+ headers: buildHeaders([
142
+ {
143
+ 'Idempotency-Key': idempotencyKey,
144
+ ...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
145
+ ...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
146
+ },
147
+ options?.headers,
148
+ ]),
149
+ });
150
+ }
151
+
76
152
  /**
77
153
  * Get a single payment request visible to the authenticated requester party.
78
154
  *
@@ -100,6 +176,33 @@ export class PaymentRequests extends APIResource {
100
176
  ]),
101
177
  });
102
178
  }
179
+
180
+ /**
181
+ * List open payment requests where the authenticated party is expected to pay.
182
+ *
183
+ * @example
184
+ * ```ts
185
+ * const response =
186
+ * await client.paymentRequests.listIncoming();
187
+ * ```
188
+ */
189
+ listIncoming(
190
+ params: PaymentRequestListIncomingParams | null | undefined = {},
191
+ options?: RequestOptions,
192
+ ): APIPromise<PaymentRequestListIncomingResponse> {
193
+ const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
194
+ return this._client.get('/payment-requests/incoming', {
195
+ query,
196
+ ...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
+ ]),
204
+ });
205
+ }
103
206
  }
104
207
 
105
208
  export interface PaymentRequestCreateResponse {
@@ -118,6 +221,11 @@ export namespace PaymentRequestCreateResponse {
118
221
  */
119
222
  attributes: Data.Attributes;
120
223
 
224
+ /**
225
+ * Resource relationships
226
+ */
227
+ relationships: Data.Relationships;
228
+
121
229
  /**
122
230
  * Resource type
123
231
  */
@@ -130,7 +238,7 @@ export namespace PaymentRequestCreateResponse {
130
238
  */
131
239
  export interface Attributes {
132
240
  /**
133
- * Amount in minor units (cents for USD)
241
+ * Amount in cents
134
242
  */
135
243
  amount: number;
136
244
 
@@ -145,7 +253,7 @@ export namespace PaymentRequestCreateResponse {
145
253
  currency: string;
146
254
 
147
255
  /**
148
- * Free-form description provided at creation
256
+ * Free-form description provided at creation. Maximum 500 characters.
149
257
  */
150
258
  description: string | null;
151
259
 
@@ -162,7 +270,7 @@ export namespace PaymentRequestCreateResponse {
162
270
  /**
163
271
  * Which identifier type was used to address the payer
164
272
  */
165
- payerIdentifierType: 'email' | 'phone' | 'party_id';
273
+ payerIdentifierType: 'email' | 'phone' | 'party_id' | 'agent_id';
166
274
 
167
275
  /**
168
276
  * Display name of the payer
@@ -170,7 +278,7 @@ export namespace PaymentRequestCreateResponse {
170
278
  payerName: string | null;
171
279
 
172
280
  /**
173
- * Natural party ID (pty\_\*) of the payer if addressed by party
281
+ * Natural party ID (pty\_\*) resolved for the payer, including agent owner parties
174
282
  */
175
283
  payerPartyId: string | null;
176
284
 
@@ -185,12 +293,12 @@ export namespace PaymentRequestCreateResponse {
185
293
  paymentLinkUrl: string;
186
294
 
187
295
  /**
188
- * Email of the requester party
296
+ * Email of the party requesting payment
189
297
  */
190
298
  requesterEmail: string | null;
191
299
 
192
300
  /**
193
- * Display name of the requester party
301
+ * Display name of the party requesting payment
194
302
  */
195
303
  requesterName: string | null;
196
304
 
@@ -210,6 +318,71 @@ export namespace PaymentRequestCreateResponse {
210
318
  */
211
319
  updatedAt: string;
212
320
  }
321
+
322
+ /**
323
+ * Resource relationships
324
+ */
325
+ export interface Relationships {
326
+ /**
327
+ * Resolved payer party, if the payer is known to Natural
328
+ */
329
+ payerParty: Relationships.PayerParty;
330
+
331
+ /**
332
+ * Party requesting the payment
333
+ */
334
+ requesterParty: Relationships.RequesterParty;
335
+ }
336
+
337
+ export namespace Relationships {
338
+ /**
339
+ * Resolved payer party, if the payer is known to Natural
340
+ */
341
+ export interface PayerParty {
342
+ /**
343
+ * Related resource identifier
344
+ */
345
+ data: PayerParty.Data | null;
346
+ }
347
+
348
+ export namespace PayerParty {
349
+ /**
350
+ * Related resource identifier
351
+ */
352
+ export interface Data {
353
+ id: string;
354
+
355
+ /**
356
+ * Resource type
357
+ */
358
+ type: string;
359
+ }
360
+ }
361
+
362
+ /**
363
+ * Party requesting the payment
364
+ */
365
+ export interface RequesterParty {
366
+ /**
367
+ * Related resource identifier
368
+ */
369
+ data: RequesterParty.Data;
370
+ }
371
+
372
+ export namespace RequesterParty {
373
+ /**
374
+ * Related resource identifier
375
+ */
376
+ export interface Data {
377
+ id: string;
378
+
379
+ /**
380
+ * Resource type
381
+ */
382
+ type: string;
383
+ }
384
+ }
385
+ }
213
386
  }
214
387
  }
215
388
 
@@ -231,6 +404,11 @@ export namespace PaymentRequestListResponse {
231
404
  */
232
405
  attributes: Data.Attributes;
233
406
 
407
+ /**
408
+ * Resource relationships
409
+ */
410
+ relationships: Data.Relationships;
411
+
234
412
  /**
235
413
  * Resource type
236
414
  */
@@ -243,7 +421,7 @@ export namespace PaymentRequestListResponse {
243
421
  */
244
422
  export interface Attributes {
245
423
  /**
246
- * Amount in minor units (cents for USD)
424
+ * Amount in cents
247
425
  */
248
426
  amount: number;
249
427
 
@@ -258,7 +436,7 @@ export namespace PaymentRequestListResponse {
258
436
  currency: string;
259
437
 
260
438
  /**
261
- * Free-form description provided at creation
439
+ * Free-form description provided at creation. Maximum 500 characters.
262
440
  */
263
441
  description: string | null;
264
442
 
@@ -275,7 +453,7 @@ export namespace PaymentRequestListResponse {
275
453
  /**
276
454
  * Which identifier type was used to address the payer
277
455
  */
278
- payerIdentifierType: 'email' | 'phone' | 'party_id';
456
+ payerIdentifierType: 'email' | 'phone' | 'party_id' | 'agent_id';
279
457
 
280
458
  /**
281
459
  * Display name of the payer
@@ -283,7 +461,7 @@ export namespace PaymentRequestListResponse {
283
461
  payerName: string | null;
284
462
 
285
463
  /**
286
- * Natural party ID (pty\_\*) of the payer if addressed by party
464
+ * Natural party ID (pty\_\*) resolved for the payer, including agent owner parties
287
465
  */
288
466
  payerPartyId: string | null;
289
467
 
@@ -298,12 +476,12 @@ export namespace PaymentRequestListResponse {
298
476
  paymentLinkUrl: string;
299
477
 
300
478
  /**
301
- * Email of the requester party
479
+ * Email of the party requesting payment
302
480
  */
303
481
  requesterEmail: string | null;
304
482
 
305
483
  /**
306
- * Display name of the requester party
484
+ * Display name of the party requesting payment
307
485
  */
308
486
  requesterName: string | null;
309
487
 
@@ -323,6 +501,100 @@ export namespace PaymentRequestListResponse {
323
501
  */
324
502
  updatedAt: string;
325
503
  }
504
+
505
+ /**
506
+ * Resource relationships
507
+ */
508
+ export interface Relationships {
509
+ /**
510
+ * Resolved payer party, if the payer is known to Natural
511
+ */
512
+ payerParty: Relationships.PayerParty;
513
+
514
+ /**
515
+ * Party requesting the payment
516
+ */
517
+ requesterParty: Relationships.RequesterParty;
518
+
519
+ /**
520
+ * Wallet that receives the funds
521
+ */
522
+ wallet: Relationships.Wallet;
523
+ }
524
+
525
+ export namespace Relationships {
526
+ /**
527
+ * Resolved payer party, if the payer is known to Natural
528
+ */
529
+ export interface PayerParty {
530
+ /**
531
+ * Related resource identifier
532
+ */
533
+ data: PayerParty.Data | null;
534
+ }
535
+
536
+ export namespace PayerParty {
537
+ /**
538
+ * Related resource identifier
539
+ */
540
+ export interface Data {
541
+ id: string;
542
+
543
+ /**
544
+ * Resource type
545
+ */
546
+ type: string;
547
+ }
548
+ }
549
+
550
+ /**
551
+ * Party requesting the payment
552
+ */
553
+ export interface RequesterParty {
554
+ /**
555
+ * Related resource identifier
556
+ */
557
+ data: RequesterParty.Data;
558
+ }
559
+
560
+ export namespace RequesterParty {
561
+ /**
562
+ * Related resource identifier
563
+ */
564
+ export interface Data {
565
+ id: string;
566
+
567
+ /**
568
+ * Resource type
569
+ */
570
+ type: string;
571
+ }
572
+ }
573
+
574
+ /**
575
+ * Wallet that receives the funds
576
+ */
577
+ export interface Wallet {
578
+ /**
579
+ * Related resource identifier
580
+ */
581
+ data: Wallet.Data;
582
+ }
583
+
584
+ export namespace Wallet {
585
+ /**
586
+ * Related resource identifier
587
+ */
588
+ export interface Data {
589
+ id: string;
590
+
591
+ /**
592
+ * Resource type
593
+ */
594
+ type: string;
595
+ }
596
+ }
597
+ }
326
598
  }
327
599
 
328
600
  export interface Meta {
@@ -338,6 +610,236 @@ export namespace PaymentRequestListResponse {
338
610
  }
339
611
  }
340
612
 
613
+ export interface PaymentRequestDeclineResponse {
614
+ data: PaymentRequestDeclineResponse.Data;
615
+ }
616
+
617
+ export namespace PaymentRequestDeclineResponse {
618
+ export interface Data {
619
+ /**
620
+ * Resource ID (prq\_\*)
621
+ */
622
+ id: string;
623
+
624
+ /**
625
+ * Resource attributes
626
+ */
627
+ attributes: Data.Attributes;
628
+
629
+ /**
630
+ * Resource relationships
631
+ */
632
+ relationships: Data.Relationships;
633
+
634
+ /**
635
+ * Resource type
636
+ */
637
+ type: string;
638
+ }
639
+
640
+ export namespace Data {
641
+ /**
642
+ * Resource attributes
643
+ */
644
+ export interface Attributes {
645
+ /**
646
+ * Amount in cents
647
+ */
648
+ amount: number;
649
+
650
+ /**
651
+ * ISO 8601 timestamp when the payment request was created
652
+ */
653
+ createdAt: string;
654
+
655
+ /**
656
+ * Currency code
657
+ */
658
+ currency: string;
659
+
660
+ /**
661
+ * Free-form description provided at creation. Maximum 500 characters.
662
+ */
663
+ description: string | null;
664
+
665
+ /**
666
+ * Email of the payer if addressed by email
667
+ */
668
+ payerEmail: string | null;
669
+
670
+ /**
671
+ * The identifier value used to address the payer
672
+ */
673
+ payerIdentifier: string;
674
+
675
+ /**
676
+ * Which identifier type was used to address the payer
677
+ */
678
+ payerIdentifierType: 'email' | 'phone' | 'party_id' | 'agent_id';
679
+
680
+ /**
681
+ * Display name of the payer
682
+ */
683
+ payerName: string | null;
684
+
685
+ /**
686
+ * Natural party ID (pty\_\*) resolved for the payer, including agent owner parties
687
+ */
688
+ payerPartyId: string | null;
689
+
690
+ /**
691
+ * Phone of the payer in E.164 format if addressed by phone
692
+ */
693
+ payerPhone: string | null;
694
+
695
+ /**
696
+ * URL the payer visits to complete payment
697
+ */
698
+ paymentLinkUrl: string;
699
+
700
+ /**
701
+ * Email of the party requesting payment
702
+ */
703
+ requesterEmail: string | null;
704
+
705
+ /**
706
+ * Display name of the party requesting payment
707
+ */
708
+ requesterName: string | null;
709
+
710
+ /**
711
+ * Current status of the payment request
712
+ */
713
+ status: 'OPEN' | 'PROCESSING' | 'COMPLETED' | 'CANCELLED' | 'DECLINED' | 'EXPIRED';
714
+
715
+ /**
716
+ * ID of the transaction created by the most recent payment attempt, or null if no
717
+ * attempt yet
718
+ */
719
+ transactionId: string | null;
720
+
721
+ /**
722
+ * ISO 8601 timestamp when the payment request was last updated
723
+ */
724
+ updatedAt: string;
725
+ }
726
+
727
+ /**
728
+ * Resource relationships
729
+ */
730
+ export interface Relationships {
731
+ /**
732
+ * Resolved payer party, if the payer is known to Natural
733
+ */
734
+ payerParty: Relationships.PayerParty;
735
+
736
+ /**
737
+ * Party requesting the payment
738
+ */
739
+ requesterParty: Relationships.RequesterParty;
740
+
741
+ /**
742
+ * Wallet that receives the funds
743
+ */
744
+ wallet: Relationships.Wallet;
745
+ }
746
+
747
+ export namespace Relationships {
748
+ /**
749
+ * Resolved payer party, if the payer is known to Natural
750
+ */
751
+ export interface PayerParty {
752
+ /**
753
+ * Related resource identifier
754
+ */
755
+ data: PayerParty.Data | null;
756
+ }
757
+
758
+ export namespace PayerParty {
759
+ /**
760
+ * Related resource identifier
761
+ */
762
+ export interface Data {
763
+ id: string;
764
+
765
+ /**
766
+ * Resource type
767
+ */
768
+ type: string;
769
+ }
770
+ }
771
+
772
+ /**
773
+ * Party requesting the payment
774
+ */
775
+ export interface RequesterParty {
776
+ /**
777
+ * Related resource identifier
778
+ */
779
+ data: RequesterParty.Data;
780
+ }
781
+
782
+ export namespace RequesterParty {
783
+ /**
784
+ * Related resource identifier
785
+ */
786
+ export interface Data {
787
+ id: string;
788
+
789
+ /**
790
+ * Resource type
791
+ */
792
+ type: string;
793
+ }
794
+ }
795
+
796
+ /**
797
+ * Wallet that receives the funds
798
+ */
799
+ export interface Wallet {
800
+ /**
801
+ * Related resource identifier
802
+ */
803
+ data: Wallet.Data;
804
+ }
805
+
806
+ export namespace Wallet {
807
+ /**
808
+ * Related resource identifier
809
+ */
810
+ export interface Data {
811
+ id: string;
812
+
813
+ /**
814
+ * Resource type
815
+ */
816
+ type: string;
817
+ }
818
+ }
819
+ }
820
+ }
821
+ }
822
+
823
+ export interface PaymentRequestFulfillResponse {
824
+ data: PaymentRequestFulfillResponse.Data;
825
+ }
826
+
827
+ export namespace PaymentRequestFulfillResponse {
828
+ export interface Data {
829
+ id: string;
830
+
831
+ attributes: Data.Attributes;
832
+
833
+ type: string;
834
+ }
835
+
836
+ export namespace Data {
837
+ export interface Attributes {
838
+ outcome: 'processing' | 'failed' | 'completed' | 'in_review';
839
+ }
840
+ }
841
+ }
842
+
341
843
  export interface PaymentRequestGetResponse {
342
844
  data: PaymentRequestGetResponse.Data;
343
845
  }
@@ -354,6 +856,223 @@ export namespace PaymentRequestGetResponse {
354
856
  */
355
857
  attributes: Data.Attributes;
356
858
 
859
+ /**
860
+ * Resource relationships
861
+ */
862
+ relationships: Data.Relationships;
863
+
864
+ /**
865
+ * Resource type
866
+ */
867
+ type: string;
868
+ }
869
+
870
+ export namespace Data {
871
+ /**
872
+ * Resource attributes
873
+ */
874
+ export interface Attributes {
875
+ /**
876
+ * Amount in cents
877
+ */
878
+ amount: number;
879
+
880
+ /**
881
+ * ISO 8601 timestamp when the payment request was created
882
+ */
883
+ createdAt: string;
884
+
885
+ /**
886
+ * Currency code
887
+ */
888
+ currency: string;
889
+
890
+ /**
891
+ * Free-form description provided at creation. Maximum 500 characters.
892
+ */
893
+ description: string | null;
894
+
895
+ /**
896
+ * Email of the payer if addressed by email
897
+ */
898
+ payerEmail: string | null;
899
+
900
+ /**
901
+ * The identifier value used to address the payer
902
+ */
903
+ payerIdentifier: string;
904
+
905
+ /**
906
+ * Which identifier type was used to address the payer
907
+ */
908
+ payerIdentifierType: 'email' | 'phone' | 'party_id' | 'agent_id';
909
+
910
+ /**
911
+ * Display name of the payer
912
+ */
913
+ payerName: string | null;
914
+
915
+ /**
916
+ * Natural party ID (pty\_\*) resolved for the payer, including agent owner parties
917
+ */
918
+ payerPartyId: string | null;
919
+
920
+ /**
921
+ * Phone of the payer in E.164 format if addressed by phone
922
+ */
923
+ payerPhone: string | null;
924
+
925
+ /**
926
+ * URL the payer visits to complete payment
927
+ */
928
+ paymentLinkUrl: string;
929
+
930
+ /**
931
+ * Email of the party requesting payment
932
+ */
933
+ requesterEmail: string | null;
934
+
935
+ /**
936
+ * Display name of the party requesting payment
937
+ */
938
+ requesterName: string | null;
939
+
940
+ /**
941
+ * Current status of the payment request
942
+ */
943
+ status: 'OPEN' | 'PROCESSING' | 'COMPLETED' | 'CANCELLED' | 'DECLINED' | 'EXPIRED';
944
+
945
+ /**
946
+ * ID of the transaction created by the most recent payment attempt, or null if no
947
+ * attempt yet
948
+ */
949
+ transactionId: string | null;
950
+
951
+ /**
952
+ * ISO 8601 timestamp when the payment request was last updated
953
+ */
954
+ updatedAt: string;
955
+ }
956
+
957
+ /**
958
+ * Resource relationships
959
+ */
960
+ export interface Relationships {
961
+ /**
962
+ * Resolved payer party, if the payer is known to Natural
963
+ */
964
+ payerParty: Relationships.PayerParty;
965
+
966
+ /**
967
+ * Party requesting the payment
968
+ */
969
+ requesterParty: Relationships.RequesterParty;
970
+
971
+ /**
972
+ * Wallet that receives the funds
973
+ */
974
+ wallet: Relationships.Wallet;
975
+ }
976
+
977
+ export namespace Relationships {
978
+ /**
979
+ * Resolved payer party, if the payer is known to Natural
980
+ */
981
+ export interface PayerParty {
982
+ /**
983
+ * Related resource identifier
984
+ */
985
+ data: PayerParty.Data | null;
986
+ }
987
+
988
+ export namespace PayerParty {
989
+ /**
990
+ * Related resource identifier
991
+ */
992
+ export interface Data {
993
+ id: string;
994
+
995
+ /**
996
+ * Resource type
997
+ */
998
+ type: string;
999
+ }
1000
+ }
1001
+
1002
+ /**
1003
+ * Party requesting the payment
1004
+ */
1005
+ export interface RequesterParty {
1006
+ /**
1007
+ * Related resource identifier
1008
+ */
1009
+ data: RequesterParty.Data;
1010
+ }
1011
+
1012
+ export namespace RequesterParty {
1013
+ /**
1014
+ * Related resource identifier
1015
+ */
1016
+ export interface Data {
1017
+ id: string;
1018
+
1019
+ /**
1020
+ * Resource type
1021
+ */
1022
+ type: string;
1023
+ }
1024
+ }
1025
+
1026
+ /**
1027
+ * Wallet that receives the funds
1028
+ */
1029
+ export interface Wallet {
1030
+ /**
1031
+ * Related resource identifier
1032
+ */
1033
+ data: Wallet.Data;
1034
+ }
1035
+
1036
+ export namespace Wallet {
1037
+ /**
1038
+ * Related resource identifier
1039
+ */
1040
+ export interface Data {
1041
+ id: string;
1042
+
1043
+ /**
1044
+ * Resource type
1045
+ */
1046
+ type: string;
1047
+ }
1048
+ }
1049
+ }
1050
+ }
1051
+ }
1052
+
1053
+ export interface PaymentRequestListIncomingResponse {
1054
+ data: Array<PaymentRequestListIncomingResponse.Data>;
1055
+
1056
+ meta: PaymentRequestListIncomingResponse.Meta;
1057
+ }
1058
+
1059
+ export namespace PaymentRequestListIncomingResponse {
1060
+ export interface Data {
1061
+ /**
1062
+ * Resource ID (prq\_\*)
1063
+ */
1064
+ id: string;
1065
+
1066
+ /**
1067
+ * Resource attributes
1068
+ */
1069
+ attributes: Data.Attributes;
1070
+
1071
+ /**
1072
+ * Resource relationships
1073
+ */
1074
+ relationships: Data.Relationships;
1075
+
357
1076
  /**
358
1077
  * Resource type
359
1078
  */
@@ -366,7 +1085,7 @@ export namespace PaymentRequestGetResponse {
366
1085
  */
367
1086
  export interface Attributes {
368
1087
  /**
369
- * Amount in minor units (cents for USD)
1088
+ * Amount in cents
370
1089
  */
371
1090
  amount: number;
372
1091
 
@@ -381,7 +1100,7 @@ export namespace PaymentRequestGetResponse {
381
1100
  currency: string;
382
1101
 
383
1102
  /**
384
- * Free-form description provided at creation
1103
+ * Free-form description provided at creation. Maximum 500 characters.
385
1104
  */
386
1105
  description: string | null;
387
1106
 
@@ -398,7 +1117,7 @@ export namespace PaymentRequestGetResponse {
398
1117
  /**
399
1118
  * Which identifier type was used to address the payer
400
1119
  */
401
- payerIdentifierType: 'email' | 'phone' | 'party_id';
1120
+ payerIdentifierType: 'email' | 'phone' | 'party_id' | 'agent_id';
402
1121
 
403
1122
  /**
404
1123
  * Display name of the payer
@@ -406,7 +1125,7 @@ export namespace PaymentRequestGetResponse {
406
1125
  payerName: string | null;
407
1126
 
408
1127
  /**
409
- * Natural party ID (pty\_\*) of the payer if addressed by party
1128
+ * Natural party ID (pty\_\*) resolved for the payer, including agent owner parties
410
1129
  */
411
1130
  payerPartyId: string | null;
412
1131
 
@@ -421,12 +1140,12 @@ export namespace PaymentRequestGetResponse {
421
1140
  paymentLinkUrl: string;
422
1141
 
423
1142
  /**
424
- * Email of the requester party
1143
+ * Email of the party requesting payment
425
1144
  */
426
1145
  requesterEmail: string | null;
427
1146
 
428
1147
  /**
429
- * Display name of the requester party
1148
+ * Display name of the party requesting payment
430
1149
  */
431
1150
  requesterName: string | null;
432
1151
 
@@ -446,6 +1165,112 @@ export namespace PaymentRequestGetResponse {
446
1165
  */
447
1166
  updatedAt: string;
448
1167
  }
1168
+
1169
+ /**
1170
+ * Resource relationships
1171
+ */
1172
+ export interface Relationships {
1173
+ /**
1174
+ * Resolved payer party, if the payer is known to Natural
1175
+ */
1176
+ payerParty: Relationships.PayerParty;
1177
+
1178
+ /**
1179
+ * Party requesting the payment
1180
+ */
1181
+ requesterParty: Relationships.RequesterParty;
1182
+
1183
+ /**
1184
+ * Wallet that receives the funds
1185
+ */
1186
+ wallet: Relationships.Wallet;
1187
+ }
1188
+
1189
+ export namespace Relationships {
1190
+ /**
1191
+ * Resolved payer party, if the payer is known to Natural
1192
+ */
1193
+ export interface PayerParty {
1194
+ /**
1195
+ * Related resource identifier
1196
+ */
1197
+ data: PayerParty.Data | null;
1198
+ }
1199
+
1200
+ export namespace PayerParty {
1201
+ /**
1202
+ * Related resource identifier
1203
+ */
1204
+ export interface Data {
1205
+ id: string;
1206
+
1207
+ /**
1208
+ * Resource type
1209
+ */
1210
+ type: string;
1211
+ }
1212
+ }
1213
+
1214
+ /**
1215
+ * Party requesting the payment
1216
+ */
1217
+ export interface RequesterParty {
1218
+ /**
1219
+ * Related resource identifier
1220
+ */
1221
+ data: RequesterParty.Data;
1222
+ }
1223
+
1224
+ export namespace RequesterParty {
1225
+ /**
1226
+ * Related resource identifier
1227
+ */
1228
+ export interface Data {
1229
+ id: string;
1230
+
1231
+ /**
1232
+ * Resource type
1233
+ */
1234
+ type: string;
1235
+ }
1236
+ }
1237
+
1238
+ /**
1239
+ * Wallet that receives the funds
1240
+ */
1241
+ export interface Wallet {
1242
+ /**
1243
+ * Related resource identifier
1244
+ */
1245
+ data: Wallet.Data;
1246
+ }
1247
+
1248
+ export namespace Wallet {
1249
+ /**
1250
+ * Related resource identifier
1251
+ */
1252
+ export interface Data {
1253
+ id: string;
1254
+
1255
+ /**
1256
+ * Resource type
1257
+ */
1258
+ type: string;
1259
+ }
1260
+ }
1261
+ }
1262
+ }
1263
+
1264
+ export interface Meta {
1265
+ pagination: Meta.Pagination;
1266
+ }
1267
+
1268
+ export namespace Meta {
1269
+ export interface Pagination {
1270
+ hasMore: boolean;
1271
+
1272
+ nextCursor: string | null;
1273
+ }
449
1274
  }
450
1275
  }
451
1276
 
@@ -456,17 +1281,10 @@ export interface PaymentRequestCreateParams {
456
1281
  amount: number;
457
1282
 
458
1283
  /**
459
- * Body param: Who pays — exactly one of email, phone, or party.
1284
+ * Body param: Who pays — exactly one typed email, phone, party ID, or agent ID
1285
+ * value.
460
1286
  */
461
- payer:
462
- | PaymentRequestCreateParams.UnionMember0
463
- | PaymentRequestCreateParams.UnionMember1
464
- | PaymentRequestCreateParams.UnionMember2;
465
-
466
- /**
467
- * Body param: Wallet that should receive the funds
468
- */
469
- walletId: string;
1287
+ payer: PaymentRequestCreateParams.UnionMember0 | PaymentRequestCreateParams.UnionMember1;
470
1288
 
471
1289
  /**
472
1290
  * Header param: Unique key for idempotent request handling. If a request with the
@@ -486,7 +1304,7 @@ export interface PaymentRequestCreateParams {
486
1304
  customerPartyId?: string;
487
1305
 
488
1306
  /**
489
- * Body param: Free-form description shown to the payer
1307
+ * Body param: Free-form description shown to the payer. Maximum 500 characters.
490
1308
  */
491
1309
  description?: string;
492
1310
 
@@ -501,6 +1319,12 @@ export interface PaymentRequestCreateParams {
501
1319
  */
502
1320
  sendLink?: PaymentRequestCreateParams.SendLink;
503
1321
 
1322
+ /**
1323
+ * Body param: Wallet that should receive the funds. Omit to use the requester
1324
+ * party's default wallet.
1325
+ */
1326
+ walletId?: string;
1327
+
504
1328
  /**
505
1329
  * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
506
1330
  */
@@ -515,28 +1339,19 @@ export interface PaymentRequestCreateParams {
515
1339
 
516
1340
  export namespace PaymentRequestCreateParams {
517
1341
  export interface UnionMember0 {
518
- kind: 'email';
1342
+ type: string;
519
1343
 
520
1344
  /**
521
- * Payer email address
1345
+ * Email address
522
1346
  */
523
1347
  value: string;
524
1348
  }
525
1349
 
526
1350
  export interface UnionMember1 {
527
- kind: 'phone';
528
-
529
- /**
530
- * Payer phone in E.164 format
531
- */
532
- value: string;
533
- }
534
-
535
- export interface UnionMember2 {
536
- kind: 'party_id';
1351
+ type: string;
537
1352
 
538
1353
  /**
539
- * Natural party ID (pty\_\*) of the payer
1354
+ * Phone number in E.164 format
540
1355
  */
541
1356
  value: string;
542
1357
  }
@@ -576,6 +1391,63 @@ export interface PaymentRequestListParams {
576
1391
  'X-Instance-ID'?: string;
577
1392
  }
578
1393
 
1394
+ export interface PaymentRequestDeclineParams {
1395
+ /**
1396
+ * Unique key for idempotent request handling. If a request with the same key was
1397
+ * already processed, the original response is returned.
1398
+ */
1399
+ 'Idempotency-Key': string;
1400
+
1401
+ /**
1402
+ * Agent ID (agt_xxx) identifying which agent is making the request.
1403
+ */
1404
+ 'X-Agent-ID'?: string;
1405
+
1406
+ /**
1407
+ * Required when X-Agent-ID is present. Session or conversation ID for agent
1408
+ * observability.
1409
+ */
1410
+ 'X-Instance-ID'?: string;
1411
+ }
1412
+
1413
+ export interface PaymentRequestFulfillParams {
1414
+ /**
1415
+ * Body param
1416
+ */
1417
+ paymentSource: PaymentRequestFulfillParams.UnionMember0 | PaymentRequestFulfillParams.UnionMember1;
1418
+
1419
+ /**
1420
+ * Header param: Unique key for idempotent request handling. If a request with the
1421
+ * same key was already processed, the original response is returned.
1422
+ */
1423
+ 'Idempotency-Key': string;
1424
+
1425
+ /**
1426
+ * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1427
+ */
1428
+ 'X-Agent-ID'?: string;
1429
+
1430
+ /**
1431
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
1432
+ * for agent observability.
1433
+ */
1434
+ 'X-Instance-ID'?: string;
1435
+ }
1436
+
1437
+ export namespace PaymentRequestFulfillParams {
1438
+ export interface UnionMember0 {
1439
+ type: string;
1440
+
1441
+ walletId: string;
1442
+ }
1443
+
1444
+ export interface UnionMember1 {
1445
+ externalAccountId: string;
1446
+
1447
+ type: string;
1448
+ }
1449
+ }
1450
+
579
1451
  export interface PaymentRequestGetParams {
580
1452
  /**
581
1453
  * Agent ID (agt_xxx) identifying which agent is making the request.
@@ -589,13 +1461,42 @@ export interface PaymentRequestGetParams {
589
1461
  'X-Instance-ID'?: string;
590
1462
  }
591
1463
 
1464
+ export interface PaymentRequestListIncomingParams {
1465
+ /**
1466
+ * Query param: Pagination cursor returned by the previous response
1467
+ */
1468
+ cursor?: string;
1469
+
1470
+ /**
1471
+ * Query param: Results per page (1-100)
1472
+ */
1473
+ limit?: number;
1474
+
1475
+ /**
1476
+ * Header param: Agent ID (agt_xxx) identifying which agent is making the request.
1477
+ */
1478
+ 'X-Agent-ID'?: string;
1479
+
1480
+ /**
1481
+ * Header param: Required when X-Agent-ID is present. Session or conversation ID
1482
+ * for agent observability.
1483
+ */
1484
+ 'X-Instance-ID'?: string;
1485
+ }
1486
+
592
1487
  export declare namespace PaymentRequests {
593
1488
  export {
594
1489
  type PaymentRequestCreateResponse as PaymentRequestCreateResponse,
595
1490
  type PaymentRequestListResponse as PaymentRequestListResponse,
1491
+ type PaymentRequestDeclineResponse as PaymentRequestDeclineResponse,
1492
+ type PaymentRequestFulfillResponse as PaymentRequestFulfillResponse,
596
1493
  type PaymentRequestGetResponse as PaymentRequestGetResponse,
1494
+ type PaymentRequestListIncomingResponse as PaymentRequestListIncomingResponse,
597
1495
  type PaymentRequestCreateParams as PaymentRequestCreateParams,
598
1496
  type PaymentRequestListParams as PaymentRequestListParams,
1497
+ type PaymentRequestDeclineParams as PaymentRequestDeclineParams,
1498
+ type PaymentRequestFulfillParams as PaymentRequestFulfillParams,
599
1499
  type PaymentRequestGetParams as PaymentRequestGetParams,
1500
+ type PaymentRequestListIncomingParams as PaymentRequestListIncomingParams,
600
1501
  };
601
1502
  }