@naturalpay/sdk 0.11.0 → 0.13.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.
- package/CHANGELOG.md +17 -0
- package/package.json +1 -1
- package/resources/agents.d.mts +54 -27
- package/resources/agents.d.mts.map +1 -1
- package/resources/agents.d.ts +54 -27
- package/resources/agents.d.ts.map +1 -1
- package/resources/api-keys.d.mts +24 -12
- package/resources/api-keys.d.mts.map +1 -1
- package/resources/api-keys.d.ts +24 -12
- package/resources/api-keys.d.ts.map +1 -1
- package/resources/approvals.d.mts +24 -12
- package/resources/approvals.d.mts.map +1 -1
- package/resources/approvals.d.ts +24 -12
- package/resources/approvals.d.ts.map +1 -1
- package/resources/counterparties.d.mts +6 -3
- package/resources/counterparties.d.mts.map +1 -1
- package/resources/counterparties.d.ts +6 -3
- package/resources/counterparties.d.ts.map +1 -1
- package/resources/customers.d.mts +12 -6
- package/resources/customers.d.mts.map +1 -1
- package/resources/customers.d.ts +12 -6
- package/resources/customers.d.ts.map +1 -1
- package/resources/external-accounts.d.mts +12 -6
- package/resources/external-accounts.d.mts.map +1 -1
- package/resources/external-accounts.d.ts +12 -6
- package/resources/external-accounts.d.ts.map +1 -1
- package/resources/invitations.d.mts +18 -9
- package/resources/invitations.d.mts.map +1 -1
- package/resources/invitations.d.ts +18 -9
- package/resources/invitations.d.ts.map +1 -1
- package/resources/parties.d.mts +24 -12
- package/resources/parties.d.mts.map +1 -1
- package/resources/parties.d.ts +24 -12
- package/resources/parties.d.ts.map +1 -1
- package/resources/payment-requests.d.mts +69 -75
- package/resources/payment-requests.d.mts.map +1 -1
- package/resources/payment-requests.d.ts +69 -75
- package/resources/payment-requests.d.ts.map +1 -1
- package/resources/payment-requests.js +49 -34
- package/resources/payment-requests.js.map +1 -1
- package/resources/payment-requests.mjs +49 -34
- package/resources/payment-requests.mjs.map +1 -1
- package/resources/payments.d.mts +46 -43
- package/resources/payments.d.mts.map +1 -1
- package/resources/payments.d.ts +46 -43
- package/resources/payments.d.ts.map +1 -1
- package/resources/payments.js +30 -23
- package/resources/payments.js.map +1 -1
- package/resources/payments.mjs +30 -23
- package/resources/payments.mjs.map +1 -1
- package/resources/transactions.d.mts +23 -15
- package/resources/transactions.d.mts.map +1 -1
- package/resources/transactions.d.ts +23 -15
- package/resources/transactions.d.ts.map +1 -1
- package/resources/transactions.js +18 -6
- package/resources/transactions.js.map +1 -1
- package/resources/transactions.mjs +18 -6
- package/resources/transactions.mjs.map +1 -1
- package/resources/transfers.d.mts +48 -43
- package/resources/transfers.d.mts.map +1 -1
- package/resources/transfers.d.ts +48 -43
- package/resources/transfers.d.ts.map +1 -1
- package/resources/transfers.js +29 -20
- package/resources/transfers.js.map +1 -1
- package/resources/transfers.mjs +29 -20
- package/resources/transfers.mjs.map +1 -1
- package/resources/wallet.d.mts +20 -30
- package/resources/wallet.d.mts.map +1 -1
- package/resources/wallet.d.ts +20 -30
- package/resources/wallet.d.ts.map +1 -1
- package/resources/wallet.js +4 -4
- package/resources/wallet.mjs +4 -4
- package/resources/webhooks.d.mts +36 -18
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +36 -18
- package/resources/webhooks.d.ts.map +1 -1
- package/src/resources/agents.ts +54 -27
- package/src/resources/api-keys.ts +24 -12
- package/src/resources/approvals.ts +24 -12
- package/src/resources/counterparties.ts +6 -3
- package/src/resources/customers.ts +12 -6
- package/src/resources/external-accounts.ts +12 -6
- package/src/resources/invitations.ts +18 -9
- package/src/resources/parties.ts +24 -12
- package/src/resources/payment-requests.ts +113 -88
- package/src/resources/payments.ts +83 -53
- package/src/resources/transactions.ts +44 -21
- package/src/resources/transfers.ts +79 -51
- package/src/resources/wallet.ts +20 -34
- package/src/resources/webhooks.ts +36 -18
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -11,7 +11,9 @@ import { path } from '../internal/utils/path';
|
|
|
11
11
|
*/
|
|
12
12
|
export class PaymentRequests extends APIResource {
|
|
13
13
|
/**
|
|
14
|
-
* Create a payment request
|
|
14
|
+
* Create a payment request. Natural notifies the payer directly — email/phone
|
|
15
|
+
* payers receive the pay link, on-platform parties receive a dashboard deep-link,
|
|
16
|
+
* and agent payers receive only the in-app webhook.
|
|
15
17
|
*
|
|
16
18
|
* @example
|
|
17
19
|
* ```ts
|
|
@@ -19,8 +21,6 @@ export class PaymentRequests extends APIResource {
|
|
|
19
21
|
* amount: 1,
|
|
20
22
|
* payer: { type: 'email', value: 'dev@stainless.com' },
|
|
21
23
|
* 'Idempotency-Key': 'Idempotency-Key',
|
|
22
|
-
* 'X-Agent-ID': 'X-Agent-ID',
|
|
23
|
-
* 'X-Instance-ID': 'X-Instance-ID',
|
|
24
24
|
* });
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
@@ -38,7 +38,11 @@ export class PaymentRequests extends APIResource {
|
|
|
38
38
|
body,
|
|
39
39
|
...options,
|
|
40
40
|
headers: buildHeaders([
|
|
41
|
-
{
|
|
41
|
+
{
|
|
42
|
+
'Idempotency-Key': idempotencyKey,
|
|
43
|
+
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
44
|
+
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
45
|
+
},
|
|
42
46
|
options?.headers,
|
|
43
47
|
]),
|
|
44
48
|
});
|
|
@@ -49,18 +53,24 @@ export class PaymentRequests extends APIResource {
|
|
|
49
53
|
*
|
|
50
54
|
* @example
|
|
51
55
|
* ```ts
|
|
52
|
-
* const paymentRequests = await client.paymentRequests.list(
|
|
53
|
-
* 'X-Agent-ID': 'X-Agent-ID',
|
|
54
|
-
* 'X-Instance-ID': 'X-Instance-ID',
|
|
55
|
-
* });
|
|
56
|
+
* const paymentRequests = await client.paymentRequests.list();
|
|
56
57
|
* ```
|
|
57
58
|
*/
|
|
58
|
-
list(
|
|
59
|
-
|
|
59
|
+
list(
|
|
60
|
+
params: PaymentRequestListParams | null | undefined = {},
|
|
61
|
+
options?: RequestOptions,
|
|
62
|
+
): APIPromise<PaymentRequestListResponse> {
|
|
63
|
+
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
|
|
60
64
|
return this._client.get('/payment-requests', {
|
|
61
65
|
query,
|
|
62
66
|
...options,
|
|
63
|
-
headers: buildHeaders([
|
|
67
|
+
headers: buildHeaders([
|
|
68
|
+
{
|
|
69
|
+
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
70
|
+
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
71
|
+
},
|
|
72
|
+
options?.headers,
|
|
73
|
+
]),
|
|
64
74
|
});
|
|
65
75
|
}
|
|
66
76
|
|
|
@@ -72,11 +82,7 @@ export class PaymentRequests extends APIResource {
|
|
|
72
82
|
* ```ts
|
|
73
83
|
* const response = await client.paymentRequests.decline(
|
|
74
84
|
* 'prq_ecc2efdd09bd231a9ad9bd2aada37aa7',
|
|
75
|
-
* {
|
|
76
|
-
* 'Idempotency-Key': 'Idempotency-Key',
|
|
77
|
-
* 'X-Agent-ID': 'X-Agent-ID',
|
|
78
|
-
* 'X-Instance-ID': 'X-Instance-ID',
|
|
79
|
-
* },
|
|
85
|
+
* { 'Idempotency-Key': 'Idempotency-Key' },
|
|
80
86
|
* );
|
|
81
87
|
* ```
|
|
82
88
|
*/
|
|
@@ -93,7 +99,11 @@ export class PaymentRequests extends APIResource {
|
|
|
93
99
|
return this._client.post(path`/payment-requests/${paymentRequestID}/decline`, {
|
|
94
100
|
...options,
|
|
95
101
|
headers: buildHeaders([
|
|
96
|
-
{
|
|
102
|
+
{
|
|
103
|
+
'Idempotency-Key': idempotencyKey,
|
|
104
|
+
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
105
|
+
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
106
|
+
},
|
|
97
107
|
options?.headers,
|
|
98
108
|
]),
|
|
99
109
|
});
|
|
@@ -112,8 +122,6 @@ export class PaymentRequests extends APIResource {
|
|
|
112
122
|
* walletId: 'wal_ecc2efdd09bd231a9ad9bd2aada37aa7',
|
|
113
123
|
* },
|
|
114
124
|
* 'Idempotency-Key': 'Idempotency-Key',
|
|
115
|
-
* 'X-Agent-ID': 'X-Agent-ID',
|
|
116
|
-
* 'X-Instance-ID': 'X-Instance-ID',
|
|
117
125
|
* },
|
|
118
126
|
* );
|
|
119
127
|
* ```
|
|
@@ -133,7 +141,11 @@ export class PaymentRequests extends APIResource {
|
|
|
133
141
|
body,
|
|
134
142
|
...options,
|
|
135
143
|
headers: buildHeaders([
|
|
136
|
-
{
|
|
144
|
+
{
|
|
145
|
+
'Idempotency-Key': idempotencyKey,
|
|
146
|
+
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
147
|
+
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
148
|
+
},
|
|
137
149
|
options?.headers,
|
|
138
150
|
]),
|
|
139
151
|
});
|
|
@@ -146,22 +158,24 @@ export class PaymentRequests extends APIResource {
|
|
|
146
158
|
* ```ts
|
|
147
159
|
* const paymentRequest = await client.paymentRequests.get(
|
|
148
160
|
* 'prq_ecc2efdd09bd231a9ad9bd2aada37aa7',
|
|
149
|
-
* {
|
|
150
|
-
* 'X-Agent-ID': 'X-Agent-ID',
|
|
151
|
-
* 'X-Instance-ID': 'X-Instance-ID',
|
|
152
|
-
* },
|
|
153
161
|
* );
|
|
154
162
|
* ```
|
|
155
163
|
*/
|
|
156
164
|
get(
|
|
157
165
|
paymentRequestID: string,
|
|
158
|
-
params: PaymentRequestGetParams,
|
|
166
|
+
params: PaymentRequestGetParams | null | undefined = {},
|
|
159
167
|
options?: RequestOptions,
|
|
160
168
|
): APIPromise<PaymentRequestGetResponse> {
|
|
161
|
-
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params;
|
|
169
|
+
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID } = params ?? {};
|
|
162
170
|
return this._client.get(path`/payment-requests/${paymentRequestID}`, {
|
|
163
171
|
...options,
|
|
164
|
-
headers: buildHeaders([
|
|
172
|
+
headers: buildHeaders([
|
|
173
|
+
{
|
|
174
|
+
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
175
|
+
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
176
|
+
},
|
|
177
|
+
options?.headers,
|
|
178
|
+
]),
|
|
165
179
|
});
|
|
166
180
|
}
|
|
167
181
|
|
|
@@ -170,21 +184,25 @@ export class PaymentRequests extends APIResource {
|
|
|
170
184
|
*
|
|
171
185
|
* @example
|
|
172
186
|
* ```ts
|
|
173
|
-
* const response =
|
|
174
|
-
*
|
|
175
|
-
* 'X-Instance-ID': 'X-Instance-ID',
|
|
176
|
-
* });
|
|
187
|
+
* const response =
|
|
188
|
+
* await client.paymentRequests.listIncoming();
|
|
177
189
|
* ```
|
|
178
190
|
*/
|
|
179
191
|
listIncoming(
|
|
180
|
-
params: PaymentRequestListIncomingParams,
|
|
192
|
+
params: PaymentRequestListIncomingParams | null | undefined = {},
|
|
181
193
|
options?: RequestOptions,
|
|
182
194
|
): APIPromise<PaymentRequestListIncomingResponse> {
|
|
183
|
-
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params;
|
|
195
|
+
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
|
|
184
196
|
return this._client.get('/payment-requests/incoming', {
|
|
185
197
|
query,
|
|
186
198
|
...options,
|
|
187
|
-
headers: buildHeaders([
|
|
199
|
+
headers: buildHeaders([
|
|
200
|
+
{
|
|
201
|
+
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
202
|
+
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
203
|
+
},
|
|
204
|
+
options?.headers,
|
|
205
|
+
]),
|
|
188
206
|
});
|
|
189
207
|
}
|
|
190
208
|
}
|
|
@@ -1638,16 +1656,6 @@ export interface PaymentRequestCreateParams {
|
|
|
1638
1656
|
*/
|
|
1639
1657
|
'Idempotency-Key': string;
|
|
1640
1658
|
|
|
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
|
-
|
|
1651
1659
|
/**
|
|
1652
1660
|
* Body param: Currency code (currently only USD)
|
|
1653
1661
|
*/
|
|
@@ -1669,17 +1677,25 @@ export interface PaymentRequestCreateParams {
|
|
|
1669
1677
|
*/
|
|
1670
1678
|
payerName?: string;
|
|
1671
1679
|
|
|
1672
|
-
/**
|
|
1673
|
-
* Body param: If provided, immediately deliver the payment link to the payer via
|
|
1674
|
-
* the named channel
|
|
1675
|
-
*/
|
|
1676
|
-
sendLink?: PaymentRequestCreateParams.SendLink;
|
|
1677
|
-
|
|
1678
1680
|
/**
|
|
1679
1681
|
* Body param: Wallet that should receive the funds. Omit to use the requester
|
|
1680
1682
|
* party's default wallet.
|
|
1681
1683
|
*/
|
|
1682
1684
|
walletId?: string;
|
|
1685
|
+
|
|
1686
|
+
/**
|
|
1687
|
+
* Header param: Conditionally required for payment-related API requests. Pass an
|
|
1688
|
+
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1689
|
+
* one active agent, which Natural defaults automatically.
|
|
1690
|
+
*/
|
|
1691
|
+
'X-Agent-ID'?: string;
|
|
1692
|
+
|
|
1693
|
+
/**
|
|
1694
|
+
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1695
|
+
* If omitted on a payment-related API request, Natural generates one after
|
|
1696
|
+
* resolving the attribution agent.
|
|
1697
|
+
*/
|
|
1698
|
+
'X-Instance-ID'?: string;
|
|
1683
1699
|
}
|
|
1684
1700
|
|
|
1685
1701
|
export namespace PaymentRequestCreateParams {
|
|
@@ -1718,39 +1734,32 @@ export namespace PaymentRequestCreateParams {
|
|
|
1718
1734
|
*/
|
|
1719
1735
|
value: string;
|
|
1720
1736
|
}
|
|
1721
|
-
|
|
1722
|
-
/**
|
|
1723
|
-
* If provided, immediately deliver the payment link to the payer via the named
|
|
1724
|
-
* channel
|
|
1725
|
-
*/
|
|
1726
|
-
export interface SendLink {
|
|
1727
|
-
/**
|
|
1728
|
-
* Channel to deliver the payment link
|
|
1729
|
-
*/
|
|
1730
|
-
channel: 'EMAIL' | 'SMS';
|
|
1731
|
-
}
|
|
1732
1737
|
}
|
|
1733
1738
|
|
|
1734
1739
|
export interface PaymentRequestListParams {
|
|
1735
1740
|
/**
|
|
1736
|
-
*
|
|
1741
|
+
* Query param: Pagination cursor returned by the previous response
|
|
1737
1742
|
*/
|
|
1738
|
-
|
|
1743
|
+
cursor?: string;
|
|
1739
1744
|
|
|
1740
1745
|
/**
|
|
1741
|
-
*
|
|
1746
|
+
* Query param: Results per page (1-100)
|
|
1742
1747
|
*/
|
|
1743
|
-
|
|
1748
|
+
limit?: number;
|
|
1744
1749
|
|
|
1745
1750
|
/**
|
|
1746
|
-
*
|
|
1751
|
+
* Header param: Conditionally required for payment-related API requests. Pass an
|
|
1752
|
+
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1753
|
+
* one active agent, which Natural defaults automatically.
|
|
1747
1754
|
*/
|
|
1748
|
-
|
|
1755
|
+
'X-Agent-ID'?: string;
|
|
1749
1756
|
|
|
1750
1757
|
/**
|
|
1751
|
-
*
|
|
1758
|
+
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1759
|
+
* If omitted on a payment-related API request, Natural generates one after
|
|
1760
|
+
* resolving the attribution agent.
|
|
1752
1761
|
*/
|
|
1753
|
-
|
|
1762
|
+
'X-Instance-ID'?: string;
|
|
1754
1763
|
}
|
|
1755
1764
|
|
|
1756
1765
|
export interface PaymentRequestDeclineParams {
|
|
@@ -1761,14 +1770,18 @@ export interface PaymentRequestDeclineParams {
|
|
|
1761
1770
|
'Idempotency-Key': string;
|
|
1762
1771
|
|
|
1763
1772
|
/**
|
|
1764
|
-
*
|
|
1773
|
+
* Conditionally required for payment-related API requests. Pass an agent ID
|
|
1774
|
+
* (agt_xxx) for attribution, or omit it only when your party has exactly one
|
|
1775
|
+
* active agent, which Natural defaults automatically.
|
|
1765
1776
|
*/
|
|
1766
|
-
'X-Agent-ID'
|
|
1777
|
+
'X-Agent-ID'?: string;
|
|
1767
1778
|
|
|
1768
1779
|
/**
|
|
1769
|
-
* Stable run, session, or conversation ID for agent observability.
|
|
1780
|
+
* Stable run, session, or conversation ID for agent observability. If omitted on a
|
|
1781
|
+
* payment-related API request, Natural generates one after resolving the
|
|
1782
|
+
* attribution agent.
|
|
1770
1783
|
*/
|
|
1771
|
-
'X-Instance-ID'
|
|
1784
|
+
'X-Instance-ID'?: string;
|
|
1772
1785
|
}
|
|
1773
1786
|
|
|
1774
1787
|
export interface PaymentRequestFulfillParams {
|
|
@@ -1784,14 +1797,18 @@ export interface PaymentRequestFulfillParams {
|
|
|
1784
1797
|
'Idempotency-Key': string;
|
|
1785
1798
|
|
|
1786
1799
|
/**
|
|
1787
|
-
* Header param:
|
|
1800
|
+
* Header param: Conditionally required for payment-related API requests. Pass an
|
|
1801
|
+
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1802
|
+
* one active agent, which Natural defaults automatically.
|
|
1788
1803
|
*/
|
|
1789
|
-
'X-Agent-ID'
|
|
1804
|
+
'X-Agent-ID'?: string;
|
|
1790
1805
|
|
|
1791
1806
|
/**
|
|
1792
1807
|
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1808
|
+
* If omitted on a payment-related API request, Natural generates one after
|
|
1809
|
+
* resolving the attribution agent.
|
|
1793
1810
|
*/
|
|
1794
|
-
'X-Instance-ID'
|
|
1811
|
+
'X-Instance-ID'?: string;
|
|
1795
1812
|
}
|
|
1796
1813
|
|
|
1797
1814
|
export namespace PaymentRequestFulfillParams {
|
|
@@ -1810,36 +1827,44 @@ export namespace PaymentRequestFulfillParams {
|
|
|
1810
1827
|
|
|
1811
1828
|
export interface PaymentRequestGetParams {
|
|
1812
1829
|
/**
|
|
1813
|
-
*
|
|
1830
|
+
* Conditionally required for payment-related API requests. Pass an agent ID
|
|
1831
|
+
* (agt_xxx) for attribution, or omit it only when your party has exactly one
|
|
1832
|
+
* active agent, which Natural defaults automatically.
|
|
1814
1833
|
*/
|
|
1815
|
-
'X-Agent-ID'
|
|
1834
|
+
'X-Agent-ID'?: string;
|
|
1816
1835
|
|
|
1817
1836
|
/**
|
|
1818
|
-
* Stable run, session, or conversation ID for agent observability.
|
|
1837
|
+
* Stable run, session, or conversation ID for agent observability. If omitted on a
|
|
1838
|
+
* payment-related API request, Natural generates one after resolving the
|
|
1839
|
+
* attribution agent.
|
|
1819
1840
|
*/
|
|
1820
|
-
'X-Instance-ID'
|
|
1841
|
+
'X-Instance-ID'?: string;
|
|
1821
1842
|
}
|
|
1822
1843
|
|
|
1823
1844
|
export interface PaymentRequestListIncomingParams {
|
|
1824
1845
|
/**
|
|
1825
|
-
*
|
|
1846
|
+
* Query param: Pagination cursor returned by the previous response
|
|
1826
1847
|
*/
|
|
1827
|
-
|
|
1848
|
+
cursor?: string;
|
|
1828
1849
|
|
|
1829
1850
|
/**
|
|
1830
|
-
*
|
|
1851
|
+
* Query param: Results per page (1-100)
|
|
1831
1852
|
*/
|
|
1832
|
-
|
|
1853
|
+
limit?: number;
|
|
1833
1854
|
|
|
1834
1855
|
/**
|
|
1835
|
-
*
|
|
1856
|
+
* Header param: Conditionally required for payment-related API requests. Pass an
|
|
1857
|
+
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1858
|
+
* one active agent, which Natural defaults automatically.
|
|
1836
1859
|
*/
|
|
1837
|
-
|
|
1860
|
+
'X-Agent-ID'?: string;
|
|
1838
1861
|
|
|
1839
1862
|
/**
|
|
1840
|
-
*
|
|
1863
|
+
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1864
|
+
* If omitted on a payment-related API request, Natural generates one after
|
|
1865
|
+
* resolving the attribution agent.
|
|
1841
1866
|
*/
|
|
1842
|
-
|
|
1867
|
+
'X-Instance-ID'?: string;
|
|
1843
1868
|
}
|
|
1844
1869
|
|
|
1845
1870
|
export declare namespace PaymentRequests {
|
|
@@ -22,8 +22,6 @@ export class Payments extends APIResource {
|
|
|
22
22
|
* value: 'dev@stainless.com',
|
|
23
23
|
* },
|
|
24
24
|
* 'Idempotency-Key': 'Idempotency-Key',
|
|
25
|
-
* 'X-Agent-ID': 'X-Agent-ID',
|
|
26
|
-
* 'X-Instance-ID': 'X-Instance-ID',
|
|
27
25
|
* });
|
|
28
26
|
* ```
|
|
29
27
|
*/
|
|
@@ -38,7 +36,11 @@ export class Payments extends APIResource {
|
|
|
38
36
|
body,
|
|
39
37
|
...options,
|
|
40
38
|
headers: buildHeaders([
|
|
41
|
-
{
|
|
39
|
+
{
|
|
40
|
+
'Idempotency-Key': idempotencyKey,
|
|
41
|
+
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
42
|
+
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
43
|
+
},
|
|
42
44
|
options?.headers,
|
|
43
45
|
]),
|
|
44
46
|
});
|
|
@@ -49,18 +51,24 @@ export class Payments extends APIResource {
|
|
|
49
51
|
*
|
|
50
52
|
* @example
|
|
51
53
|
* ```ts
|
|
52
|
-
* const payments = await client.payments.list(
|
|
53
|
-
* 'X-Agent-ID': 'X-Agent-ID',
|
|
54
|
-
* 'X-Instance-ID': 'X-Instance-ID',
|
|
55
|
-
* });
|
|
54
|
+
* const payments = await client.payments.list();
|
|
56
55
|
* ```
|
|
57
56
|
*/
|
|
58
|
-
list(
|
|
59
|
-
|
|
57
|
+
list(
|
|
58
|
+
params: PaymentListParams | null | undefined = {},
|
|
59
|
+
options?: RequestOptions,
|
|
60
|
+
): APIPromise<PaymentListResponse> {
|
|
61
|
+
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
|
|
60
62
|
return this._client.get('/payments', {
|
|
61
63
|
query,
|
|
62
64
|
...options,
|
|
63
|
-
headers: buildHeaders([
|
|
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
|
+
]),
|
|
64
72
|
});
|
|
65
73
|
}
|
|
66
74
|
|
|
@@ -71,11 +79,7 @@ export class Payments extends APIResource {
|
|
|
71
79
|
* ```ts
|
|
72
80
|
* const response = await client.payments.cancel(
|
|
73
81
|
* 'pay_ecc2efdd09bd231a9ad9bd2aada37aa7',
|
|
74
|
-
* {
|
|
75
|
-
* 'Idempotency-Key': 'Idempotency-Key',
|
|
76
|
-
* 'X-Agent-ID': 'X-Agent-ID',
|
|
77
|
-
* 'X-Instance-ID': 'X-Instance-ID',
|
|
78
|
-
* },
|
|
82
|
+
* { 'Idempotency-Key': 'Idempotency-Key' },
|
|
79
83
|
* );
|
|
80
84
|
* ```
|
|
81
85
|
*/
|
|
@@ -92,7 +96,11 @@ export class Payments extends APIResource {
|
|
|
92
96
|
return this._client.post(path`/payments/${paymentID}/cancel`, {
|
|
93
97
|
...options,
|
|
94
98
|
headers: buildHeaders([
|
|
95
|
-
{
|
|
99
|
+
{
|
|
100
|
+
'Idempotency-Key': idempotencyKey,
|
|
101
|
+
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
102
|
+
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
103
|
+
},
|
|
96
104
|
options?.headers,
|
|
97
105
|
]),
|
|
98
106
|
});
|
|
@@ -105,19 +113,25 @@ export class Payments extends APIResource {
|
|
|
105
113
|
* ```ts
|
|
106
114
|
* const payment = await client.payments.get(
|
|
107
115
|
* 'pay_ecc2efdd09bd231a9ad9bd2aada37aa7',
|
|
108
|
-
* {
|
|
109
|
-
* 'X-Agent-ID': 'X-Agent-ID',
|
|
110
|
-
* 'X-Instance-ID': 'X-Instance-ID',
|
|
111
|
-
* },
|
|
112
116
|
* );
|
|
113
117
|
* ```
|
|
114
118
|
*/
|
|
115
|
-
get(
|
|
116
|
-
|
|
119
|
+
get(
|
|
120
|
+
paymentID: string,
|
|
121
|
+
params: PaymentGetParams | null | undefined = {},
|
|
122
|
+
options?: RequestOptions,
|
|
123
|
+
): APIPromise<PaymentGetResponse> {
|
|
124
|
+
const { 'X-Agent-ID': xAgentID, 'X-Instance-ID': xInstanceID, ...query } = params ?? {};
|
|
117
125
|
return this._client.get(path`/payments/${paymentID}`, {
|
|
118
126
|
query,
|
|
119
127
|
...options,
|
|
120
|
-
headers: buildHeaders([
|
|
128
|
+
headers: buildHeaders([
|
|
129
|
+
{
|
|
130
|
+
...(xAgentID != null ? { 'X-Agent-ID': xAgentID } : undefined),
|
|
131
|
+
...(xInstanceID != null ? { 'X-Instance-ID': xInstanceID } : undefined),
|
|
132
|
+
},
|
|
133
|
+
options?.headers,
|
|
134
|
+
]),
|
|
121
135
|
});
|
|
122
136
|
}
|
|
123
137
|
}
|
|
@@ -1046,16 +1060,6 @@ export interface PaymentCreateParams {
|
|
|
1046
1060
|
*/
|
|
1047
1061
|
'Idempotency-Key': string;
|
|
1048
1062
|
|
|
1049
|
-
/**
|
|
1050
|
-
* Header param: Agent ID (agt_xxx) used for attribution and audit.
|
|
1051
|
-
*/
|
|
1052
|
-
'X-Agent-ID': string;
|
|
1053
|
-
|
|
1054
|
-
/**
|
|
1055
|
-
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1056
|
-
*/
|
|
1057
|
-
'X-Instance-ID': string;
|
|
1058
|
-
|
|
1059
1063
|
/**
|
|
1060
1064
|
* Body param: Currency code
|
|
1061
1065
|
*/
|
|
@@ -1071,6 +1075,20 @@ export interface PaymentCreateParams {
|
|
|
1071
1075
|
* Body param: Payment description. Maximum 500 characters.
|
|
1072
1076
|
*/
|
|
1073
1077
|
description?: string;
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* Header param: Conditionally required for payment-related API requests. Pass an
|
|
1081
|
+
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1082
|
+
* one active agent, which Natural defaults automatically.
|
|
1083
|
+
*/
|
|
1084
|
+
'X-Agent-ID'?: string;
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1088
|
+
* If omitted on a payment-related API request, Natural generates one after
|
|
1089
|
+
* resolving the attribution agent.
|
|
1090
|
+
*/
|
|
1091
|
+
'X-Instance-ID'?: string;
|
|
1074
1092
|
}
|
|
1075
1093
|
|
|
1076
1094
|
export namespace PaymentCreateParams {
|
|
@@ -1112,16 +1130,6 @@ export namespace PaymentCreateParams {
|
|
|
1112
1130
|
}
|
|
1113
1131
|
|
|
1114
1132
|
export interface PaymentListParams {
|
|
1115
|
-
/**
|
|
1116
|
-
* Header param: Agent ID (agt_xxx) used for attribution and audit.
|
|
1117
|
-
*/
|
|
1118
|
-
'X-Agent-ID': string;
|
|
1119
|
-
|
|
1120
|
-
/**
|
|
1121
|
-
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1122
|
-
*/
|
|
1123
|
-
'X-Instance-ID': string;
|
|
1124
|
-
|
|
1125
1133
|
/**
|
|
1126
1134
|
* Query param: Pagination cursor from previous response
|
|
1127
1135
|
*/
|
|
@@ -1136,6 +1144,20 @@ export interface PaymentListParams {
|
|
|
1136
1144
|
* Query param: Party ID for delegated payment lookup
|
|
1137
1145
|
*/
|
|
1138
1146
|
partyId?: string;
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Header param: Conditionally required for payment-related API requests. Pass an
|
|
1150
|
+
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1151
|
+
* one active agent, which Natural defaults automatically.
|
|
1152
|
+
*/
|
|
1153
|
+
'X-Agent-ID'?: string;
|
|
1154
|
+
|
|
1155
|
+
/**
|
|
1156
|
+
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1157
|
+
* If omitted on a payment-related API request, Natural generates one after
|
|
1158
|
+
* resolving the attribution agent.
|
|
1159
|
+
*/
|
|
1160
|
+
'X-Instance-ID'?: string;
|
|
1139
1161
|
}
|
|
1140
1162
|
|
|
1141
1163
|
export interface PaymentCancelParams {
|
|
@@ -1146,31 +1168,39 @@ export interface PaymentCancelParams {
|
|
|
1146
1168
|
'Idempotency-Key': string;
|
|
1147
1169
|
|
|
1148
1170
|
/**
|
|
1149
|
-
*
|
|
1171
|
+
* Conditionally required for payment-related API requests. Pass an agent ID
|
|
1172
|
+
* (agt_xxx) for attribution, or omit it only when your party has exactly one
|
|
1173
|
+
* active agent, which Natural defaults automatically.
|
|
1150
1174
|
*/
|
|
1151
|
-
'X-Agent-ID'
|
|
1175
|
+
'X-Agent-ID'?: string;
|
|
1152
1176
|
|
|
1153
1177
|
/**
|
|
1154
|
-
* Stable run, session, or conversation ID for agent observability.
|
|
1178
|
+
* Stable run, session, or conversation ID for agent observability. If omitted on a
|
|
1179
|
+
* payment-related API request, Natural generates one after resolving the
|
|
1180
|
+
* attribution agent.
|
|
1155
1181
|
*/
|
|
1156
|
-
'X-Instance-ID'
|
|
1182
|
+
'X-Instance-ID'?: string;
|
|
1157
1183
|
}
|
|
1158
1184
|
|
|
1159
1185
|
export interface PaymentGetParams {
|
|
1160
1186
|
/**
|
|
1161
|
-
*
|
|
1187
|
+
* Query param: Party ID for delegated payment lookup
|
|
1162
1188
|
*/
|
|
1163
|
-
|
|
1189
|
+
partyId?: string;
|
|
1164
1190
|
|
|
1165
1191
|
/**
|
|
1166
|
-
* Header param:
|
|
1192
|
+
* Header param: Conditionally required for payment-related API requests. Pass an
|
|
1193
|
+
* agent ID (agt_xxx) for attribution, or omit it only when your party has exactly
|
|
1194
|
+
* one active agent, which Natural defaults automatically.
|
|
1167
1195
|
*/
|
|
1168
|
-
'X-
|
|
1196
|
+
'X-Agent-ID'?: string;
|
|
1169
1197
|
|
|
1170
1198
|
/**
|
|
1171
|
-
*
|
|
1199
|
+
* Header param: Stable run, session, or conversation ID for agent observability.
|
|
1200
|
+
* If omitted on a payment-related API request, Natural generates one after
|
|
1201
|
+
* resolving the attribution agent.
|
|
1172
1202
|
*/
|
|
1173
|
-
|
|
1203
|
+
'X-Instance-ID'?: string;
|
|
1174
1204
|
}
|
|
1175
1205
|
|
|
1176
1206
|
export declare namespace Payments {
|