@naturalpay/sdk 0.3.0 → 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 (109) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/client.d.mts +22 -10
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +22 -10
  5. package/client.d.ts.map +1 -1
  6. package/client.js +14 -2
  7. package/client.js.map +1 -1
  8. package/client.mjs +15 -3
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/api-keys.d.mts +16 -2
  12. package/resources/api-keys.d.mts.map +1 -1
  13. package/resources/api-keys.d.ts +16 -2
  14. package/resources/api-keys.d.ts.map +1 -1
  15. package/resources/api-keys.js +7 -4
  16. package/resources/api-keys.js.map +1 -1
  17. package/resources/api-keys.mjs +7 -4
  18. package/resources/api-keys.mjs.map +1 -1
  19. package/resources/escalations.d.mts +1124 -0
  20. package/resources/escalations.d.mts.map +1 -0
  21. package/resources/escalations.d.ts +1124 -0
  22. package/resources/escalations.d.ts.map +1 -0
  23. package/resources/escalations.js +110 -0
  24. package/resources/escalations.js.map +1 -0
  25. package/resources/escalations.mjs +106 -0
  26. package/resources/escalations.mjs.map +1 -0
  27. package/resources/index.d.mts +6 -4
  28. package/resources/index.d.mts.map +1 -1
  29. package/resources/index.d.ts +6 -4
  30. package/resources/index.d.ts.map +1 -1
  31. package/resources/index.js +5 -1
  32. package/resources/index.js.map +1 -1
  33. package/resources/index.mjs +3 -1
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/invitations.d.mts +16 -7
  36. package/resources/invitations.d.mts.map +1 -1
  37. package/resources/invitations.d.ts +16 -7
  38. package/resources/invitations.d.ts.map +1 -1
  39. package/resources/invitations.js +6 -4
  40. package/resources/invitations.js.map +1 -1
  41. package/resources/invitations.mjs +6 -4
  42. package/resources/invitations.mjs.map +1 -1
  43. package/resources/parties.d.mts +53 -26
  44. package/resources/parties.d.mts.map +1 -1
  45. package/resources/parties.d.ts +53 -26
  46. package/resources/parties.d.ts.map +1 -1
  47. package/resources/parties.js +27 -1
  48. package/resources/parties.js.map +1 -1
  49. package/resources/parties.mjs +27 -1
  50. package/resources/parties.mjs.map +1 -1
  51. package/resources/payment-requests.d.mts +738 -33
  52. package/resources/payment-requests.d.mts.map +1 -1
  53. package/resources/payment-requests.d.ts +738 -33
  54. package/resources/payment-requests.d.ts.map +1 -1
  55. package/resources/payment-requests.js +82 -1
  56. package/resources/payment-requests.js.map +1 -1
  57. package/resources/payment-requests.mjs +82 -1
  58. package/resources/payment-requests.mjs.map +1 -1
  59. package/resources/payments.d.mts +390 -24
  60. package/resources/payments.d.mts.map +1 -1
  61. package/resources/payments.d.ts +390 -24
  62. package/resources/payments.d.ts.map +1 -1
  63. package/resources/payments.js +53 -3
  64. package/resources/payments.js.map +1 -1
  65. package/resources/payments.mjs +53 -3
  66. package/resources/payments.mjs.map +1 -1
  67. package/resources/transactions.d.mts +50 -118
  68. package/resources/transactions.d.mts.map +1 -1
  69. package/resources/transactions.d.ts +50 -118
  70. package/resources/transactions.d.ts.map +1 -1
  71. package/resources/transactions.js +2 -2
  72. package/resources/transactions.mjs +2 -2
  73. package/resources/transfers.d.mts +1030 -0
  74. package/resources/transfers.d.mts.map +1 -0
  75. package/resources/transfers.d.ts +1030 -0
  76. package/resources/transfers.d.ts.map +1 -0
  77. package/resources/transfers.js +114 -0
  78. package/resources/transfers.js.map +1 -0
  79. package/resources/transfers.mjs +110 -0
  80. package/resources/transfers.mjs.map +1 -0
  81. package/resources/wallet.d.mts +1 -189
  82. package/resources/wallet.d.mts.map +1 -1
  83. package/resources/wallet.d.ts +1 -189
  84. package/resources/wallet.d.ts.map +1 -1
  85. package/resources/wallet.js +0 -66
  86. package/resources/wallet.js.map +1 -1
  87. package/resources/wallet.mjs +0 -66
  88. package/resources/wallet.mjs.map +1 -1
  89. package/resources/webhooks.d.mts +7 -7
  90. package/resources/webhooks.d.mts.map +1 -1
  91. package/resources/webhooks.d.ts +7 -7
  92. package/resources/webhooks.d.ts.map +1 -1
  93. package/src/client.ts +87 -11
  94. package/src/resources/api-keys.ts +26 -4
  95. package/src/resources/escalations.ts +1422 -0
  96. package/src/resources/index.ts +39 -5
  97. package/src/resources/invitations.ts +26 -10
  98. package/src/resources/parties.ts +85 -30
  99. package/src/resources/payment-requests.ts +949 -58
  100. package/src/resources/payments.ts +518 -23
  101. package/src/resources/transactions.ts +50 -136
  102. package/src/resources/transfers.ts +1338 -0
  103. package/src/resources/wallet.ts +0 -268
  104. package/src/resources/webhooks.ts +7 -0
  105. package/src/version.ts +1 -1
  106. package/version.d.mts +1 -1
  107. package/version.d.ts +1 -1
  108. package/version.js +1 -1
  109. package/version.mjs +1 -1
@@ -17,7 +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' },
20
+ * payer: { type: 'type', value: 'dev@stainless.com' },
21
21
  * 'Idempotency-Key': 'Idempotency-Key',
22
22
  * });
23
23
  * ```
@@ -72,6 +72,83 @@ export class PaymentRequests extends APIResource {
72
72
  });
73
73
  }
74
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
+
75
152
  /**
76
153
  * Get a single payment request visible to the authenticated requester party.
77
154
  *
@@ -99,13 +176,445 @@ export class PaymentRequests extends APIResource {
99
176
  ]),
100
177
  });
101
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
+ }
206
+ }
207
+
208
+ export interface PaymentRequestCreateResponse {
209
+ data: PaymentRequestCreateResponse.Data;
210
+ }
211
+
212
+ export namespace PaymentRequestCreateResponse {
213
+ export interface Data {
214
+ /**
215
+ * Resource ID (prq\_\*)
216
+ */
217
+ id: string;
218
+
219
+ /**
220
+ * Resource attributes
221
+ */
222
+ attributes: Data.Attributes;
223
+
224
+ /**
225
+ * Resource relationships
226
+ */
227
+ relationships: Data.Relationships;
228
+
229
+ /**
230
+ * Resource type
231
+ */
232
+ type: string;
233
+ }
234
+
235
+ export namespace Data {
236
+ /**
237
+ * Resource attributes
238
+ */
239
+ export interface Attributes {
240
+ /**
241
+ * Amount in cents
242
+ */
243
+ amount: number;
244
+
245
+ /**
246
+ * ISO 8601 timestamp when the payment request was created
247
+ */
248
+ createdAt: string;
249
+
250
+ /**
251
+ * Currency code
252
+ */
253
+ currency: string;
254
+
255
+ /**
256
+ * Free-form description provided at creation. Maximum 500 characters.
257
+ */
258
+ description: string | null;
259
+
260
+ /**
261
+ * Email of the payer if addressed by email
262
+ */
263
+ payerEmail: string | null;
264
+
265
+ /**
266
+ * The identifier value used to address the payer
267
+ */
268
+ payerIdentifier: string;
269
+
270
+ /**
271
+ * Which identifier type was used to address the payer
272
+ */
273
+ payerIdentifierType: 'email' | 'phone' | 'party_id' | 'agent_id';
274
+
275
+ /**
276
+ * Display name of the payer
277
+ */
278
+ payerName: string | null;
279
+
280
+ /**
281
+ * Natural party ID (pty\_\*) resolved for the payer, including agent owner parties
282
+ */
283
+ payerPartyId: string | null;
284
+
285
+ /**
286
+ * Phone of the payer in E.164 format if addressed by phone
287
+ */
288
+ payerPhone: string | null;
289
+
290
+ /**
291
+ * URL the payer visits to complete payment
292
+ */
293
+ paymentLinkUrl: string;
294
+
295
+ /**
296
+ * Email of the party requesting payment
297
+ */
298
+ requesterEmail: string | null;
299
+
300
+ /**
301
+ * Display name of the party requesting payment
302
+ */
303
+ requesterName: string | null;
304
+
305
+ /**
306
+ * Current status of the payment request
307
+ */
308
+ status: 'OPEN' | 'PROCESSING' | 'COMPLETED' | 'CANCELLED' | 'DECLINED' | 'EXPIRED';
309
+
310
+ /**
311
+ * ID of the transaction created by the most recent payment attempt, or null if no
312
+ * attempt yet
313
+ */
314
+ transactionId: string | null;
315
+
316
+ /**
317
+ * ISO 8601 timestamp when the payment request was last updated
318
+ */
319
+ updatedAt: string;
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
+ }
386
+ }
387
+ }
388
+
389
+ export interface PaymentRequestListResponse {
390
+ data: Array<PaymentRequestListResponse.Data>;
391
+
392
+ meta: PaymentRequestListResponse.Meta;
393
+ }
394
+
395
+ export namespace PaymentRequestListResponse {
396
+ export interface Data {
397
+ /**
398
+ * Resource ID (prq\_\*)
399
+ */
400
+ id: string;
401
+
402
+ /**
403
+ * Resource attributes
404
+ */
405
+ attributes: Data.Attributes;
406
+
407
+ /**
408
+ * Resource relationships
409
+ */
410
+ relationships: Data.Relationships;
411
+
412
+ /**
413
+ * Resource type
414
+ */
415
+ type: string;
416
+ }
417
+
418
+ export namespace Data {
419
+ /**
420
+ * Resource attributes
421
+ */
422
+ export interface Attributes {
423
+ /**
424
+ * Amount in cents
425
+ */
426
+ amount: number;
427
+
428
+ /**
429
+ * ISO 8601 timestamp when the payment request was created
430
+ */
431
+ createdAt: string;
432
+
433
+ /**
434
+ * Currency code
435
+ */
436
+ currency: string;
437
+
438
+ /**
439
+ * Free-form description provided at creation. Maximum 500 characters.
440
+ */
441
+ description: string | null;
442
+
443
+ /**
444
+ * Email of the payer if addressed by email
445
+ */
446
+ payerEmail: string | null;
447
+
448
+ /**
449
+ * The identifier value used to address the payer
450
+ */
451
+ payerIdentifier: string;
452
+
453
+ /**
454
+ * Which identifier type was used to address the payer
455
+ */
456
+ payerIdentifierType: 'email' | 'phone' | 'party_id' | 'agent_id';
457
+
458
+ /**
459
+ * Display name of the payer
460
+ */
461
+ payerName: string | null;
462
+
463
+ /**
464
+ * Natural party ID (pty\_\*) resolved for the payer, including agent owner parties
465
+ */
466
+ payerPartyId: string | null;
467
+
468
+ /**
469
+ * Phone of the payer in E.164 format if addressed by phone
470
+ */
471
+ payerPhone: string | null;
472
+
473
+ /**
474
+ * URL the payer visits to complete payment
475
+ */
476
+ paymentLinkUrl: string;
477
+
478
+ /**
479
+ * Email of the party requesting payment
480
+ */
481
+ requesterEmail: string | null;
482
+
483
+ /**
484
+ * Display name of the party requesting payment
485
+ */
486
+ requesterName: string | null;
487
+
488
+ /**
489
+ * Current status of the payment request
490
+ */
491
+ status: 'OPEN' | 'PROCESSING' | 'COMPLETED' | 'CANCELLED' | 'DECLINED' | 'EXPIRED';
492
+
493
+ /**
494
+ * ID of the transaction created by the most recent payment attempt, or null if no
495
+ * attempt yet
496
+ */
497
+ transactionId: string | null;
498
+
499
+ /**
500
+ * ISO 8601 timestamp when the payment request was last updated
501
+ */
502
+ updatedAt: string;
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
+ }
598
+ }
599
+
600
+ export interface Meta {
601
+ pagination: Meta.Pagination;
602
+ }
603
+
604
+ export namespace Meta {
605
+ export interface Pagination {
606
+ hasMore: boolean;
607
+
608
+ nextCursor: string | null;
609
+ }
610
+ }
102
611
  }
103
612
 
104
- export interface PaymentRequestCreateResponse {
105
- data: PaymentRequestCreateResponse.Data;
613
+ export interface PaymentRequestDeclineResponse {
614
+ data: PaymentRequestDeclineResponse.Data;
106
615
  }
107
616
 
108
- export namespace PaymentRequestCreateResponse {
617
+ export namespace PaymentRequestDeclineResponse {
109
618
  export interface Data {
110
619
  /**
111
620
  * Resource ID (prq\_\*)
@@ -117,6 +626,11 @@ export namespace PaymentRequestCreateResponse {
117
626
  */
118
627
  attributes: Data.Attributes;
119
628
 
629
+ /**
630
+ * Resource relationships
631
+ */
632
+ relationships: Data.Relationships;
633
+
120
634
  /**
121
635
  * Resource type
122
636
  */
@@ -144,7 +658,7 @@ export namespace PaymentRequestCreateResponse {
144
658
  currency: string;
145
659
 
146
660
  /**
147
- * Free-form description provided at creation
661
+ * Free-form description provided at creation. Maximum 500 characters.
148
662
  */
149
663
  description: string | null;
150
664
 
@@ -184,12 +698,12 @@ export namespace PaymentRequestCreateResponse {
184
698
  paymentLinkUrl: string;
185
699
 
186
700
  /**
187
- * Email of the requester party
701
+ * Email of the party requesting payment
188
702
  */
189
703
  requesterEmail: string | null;
190
704
 
191
705
  /**
192
- * Display name of the requester party
706
+ * Display name of the party requesting payment
193
707
  */
194
708
  requesterName: string | null;
195
709
 
@@ -209,16 +723,128 @@ export namespace PaymentRequestCreateResponse {
209
723
  */
210
724
  updatedAt: string;
211
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
+ }
212
820
  }
213
821
  }
214
822
 
215
- export interface PaymentRequestListResponse {
216
- data: Array<PaymentRequestListResponse.Data>;
823
+ export interface PaymentRequestFulfillResponse {
824
+ data: PaymentRequestFulfillResponse.Data;
825
+ }
217
826
 
218
- meta: PaymentRequestListResponse.Meta;
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
+ }
219
841
  }
220
842
 
221
- export namespace PaymentRequestListResponse {
843
+ export interface PaymentRequestGetResponse {
844
+ data: PaymentRequestGetResponse.Data;
845
+ }
846
+
847
+ export namespace PaymentRequestGetResponse {
222
848
  export interface Data {
223
849
  /**
224
850
  * Resource ID (prq\_\*)
@@ -230,6 +856,11 @@ export namespace PaymentRequestListResponse {
230
856
  */
231
857
  attributes: Data.Attributes;
232
858
 
859
+ /**
860
+ * Resource relationships
861
+ */
862
+ relationships: Data.Relationships;
863
+
233
864
  /**
234
865
  * Resource type
235
866
  */
@@ -257,7 +888,7 @@ export namespace PaymentRequestListResponse {
257
888
  currency: string;
258
889
 
259
890
  /**
260
- * Free-form description provided at creation
891
+ * Free-form description provided at creation. Maximum 500 characters.
261
892
  */
262
893
  description: string | null;
263
894
 
@@ -297,12 +928,12 @@ export namespace PaymentRequestListResponse {
297
928
  paymentLinkUrl: string;
298
929
 
299
930
  /**
300
- * Email of the requester party
931
+ * Email of the party requesting payment
301
932
  */
302
933
  requesterEmail: string | null;
303
934
 
304
935
  /**
305
- * Display name of the requester party
936
+ * Display name of the party requesting payment
306
937
  */
307
938
  requesterName: string | null;
308
939
 
@@ -322,26 +953,110 @@ export namespace PaymentRequestListResponse {
322
953
  */
323
954
  updatedAt: string;
324
955
  }
325
- }
326
956
 
327
- export interface Meta {
328
- pagination: Meta.Pagination;
329
- }
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;
330
965
 
331
- export namespace Meta {
332
- export interface Pagination {
333
- hasMore: boolean;
966
+ /**
967
+ * Party requesting the payment
968
+ */
969
+ requesterParty: Relationships.RequesterParty;
334
970
 
335
- nextCursor: string | null;
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
+ }
336
1049
  }
337
1050
  }
338
1051
  }
339
1052
 
340
- export interface PaymentRequestGetResponse {
341
- data: PaymentRequestGetResponse.Data;
1053
+ export interface PaymentRequestListIncomingResponse {
1054
+ data: Array<PaymentRequestListIncomingResponse.Data>;
1055
+
1056
+ meta: PaymentRequestListIncomingResponse.Meta;
342
1057
  }
343
1058
 
344
- export namespace PaymentRequestGetResponse {
1059
+ export namespace PaymentRequestListIncomingResponse {
345
1060
  export interface Data {
346
1061
  /**
347
1062
  * Resource ID (prq\_\*)
@@ -353,6 +1068,11 @@ export namespace PaymentRequestGetResponse {
353
1068
  */
354
1069
  attributes: Data.Attributes;
355
1070
 
1071
+ /**
1072
+ * Resource relationships
1073
+ */
1074
+ relationships: Data.Relationships;
1075
+
356
1076
  /**
357
1077
  * Resource type
358
1078
  */
@@ -380,7 +1100,7 @@ export namespace PaymentRequestGetResponse {
380
1100
  currency: string;
381
1101
 
382
1102
  /**
383
- * Free-form description provided at creation
1103
+ * Free-form description provided at creation. Maximum 500 characters.
384
1104
  */
385
1105
  description: string | null;
386
1106
 
@@ -420,12 +1140,12 @@ export namespace PaymentRequestGetResponse {
420
1140
  paymentLinkUrl: string;
421
1141
 
422
1142
  /**
423
- * Email of the requester party
1143
+ * Email of the party requesting payment
424
1144
  */
425
1145
  requesterEmail: string | null;
426
1146
 
427
1147
  /**
428
- * Display name of the requester party
1148
+ * Display name of the party requesting payment
429
1149
  */
430
1150
  requesterName: string | null;
431
1151
 
@@ -445,23 +1165,126 @@ export namespace PaymentRequestGetResponse {
445
1165
  */
446
1166
  updatedAt: string;
447
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
+ }
448
1274
  }
449
1275
  }
450
1276
 
451
1277
  export interface PaymentRequestCreateParams {
452
1278
  /**
453
- * Body param: Amount in cents
1279
+ * Body param: Amount in minor units (cents for USD)
454
1280
  */
455
1281
  amount: number;
456
1282
 
457
1283
  /**
458
- * Body param: Who pays — exactly one of email, phone, party, or agent.
1284
+ * Body param: Who pays — exactly one typed email, phone, party ID, or agent ID
1285
+ * value.
459
1286
  */
460
- payer:
461
- | PaymentRequestCreateParams.UnionMember0
462
- | PaymentRequestCreateParams.UnionMember1
463
- | PaymentRequestCreateParams.UnionMember2
464
- | PaymentRequestCreateParams.UnionMember3;
1287
+ payer: PaymentRequestCreateParams.UnionMember0 | PaymentRequestCreateParams.UnionMember1;
465
1288
 
466
1289
  /**
467
1290
  * Header param: Unique key for idempotent request handling. If a request with the
@@ -481,7 +1304,7 @@ export interface PaymentRequestCreateParams {
481
1304
  customerPartyId?: string;
482
1305
 
483
1306
  /**
484
- * Body param: Free-form description shown to the payer
1307
+ * Body param: Free-form description shown to the payer. Maximum 500 characters.
485
1308
  */
486
1309
  description?: string;
487
1310
 
@@ -516,37 +1339,19 @@ export interface PaymentRequestCreateParams {
516
1339
 
517
1340
  export namespace PaymentRequestCreateParams {
518
1341
  export interface UnionMember0 {
519
- kind: 'email';
1342
+ type: string;
520
1343
 
521
1344
  /**
522
- * Payer email address
1345
+ * Email address
523
1346
  */
524
1347
  value: string;
525
1348
  }
526
1349
 
527
1350
  export interface UnionMember1 {
528
- kind: 'phone';
529
-
530
- /**
531
- * Payer phone in E.164 format
532
- */
533
- value: string;
534
- }
535
-
536
- export interface UnionMember2 {
537
- kind: 'party_id';
538
-
539
- /**
540
- * Natural party ID (pty\_\*) of the payer
541
- */
542
- value: string;
543
- }
544
-
545
- export interface UnionMember3 {
546
- kind: 'agent_id';
1351
+ type: string;
547
1352
 
548
1353
  /**
549
- * Natural agent ID (agt\_\*) of the payer
1354
+ * Phone number in E.164 format
550
1355
  */
551
1356
  value: string;
552
1357
  }
@@ -586,6 +1391,63 @@ export interface PaymentRequestListParams {
586
1391
  'X-Instance-ID'?: string;
587
1392
  }
588
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
+
589
1451
  export interface PaymentRequestGetParams {
590
1452
  /**
591
1453
  * Agent ID (agt_xxx) identifying which agent is making the request.
@@ -599,13 +1461,42 @@ export interface PaymentRequestGetParams {
599
1461
  'X-Instance-ID'?: string;
600
1462
  }
601
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
+
602
1487
  export declare namespace PaymentRequests {
603
1488
  export {
604
1489
  type PaymentRequestCreateResponse as PaymentRequestCreateResponse,
605
1490
  type PaymentRequestListResponse as PaymentRequestListResponse,
1491
+ type PaymentRequestDeclineResponse as PaymentRequestDeclineResponse,
1492
+ type PaymentRequestFulfillResponse as PaymentRequestFulfillResponse,
606
1493
  type PaymentRequestGetResponse as PaymentRequestGetResponse,
1494
+ type PaymentRequestListIncomingResponse as PaymentRequestListIncomingResponse,
607
1495
  type PaymentRequestCreateParams as PaymentRequestCreateParams,
608
1496
  type PaymentRequestListParams as PaymentRequestListParams,
1497
+ type PaymentRequestDeclineParams as PaymentRequestDeclineParams,
1498
+ type PaymentRequestFulfillParams as PaymentRequestFulfillParams,
609
1499
  type PaymentRequestGetParams as PaymentRequestGetParams,
1500
+ type PaymentRequestListIncomingParams as PaymentRequestListIncomingParams,
610
1501
  };
611
1502
  }