orb-billing 4.32.0 → 4.47.1

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 (252) hide show
  1. package/CHANGELOG.md +184 -0
  2. package/LICENSE +1 -1
  3. package/README.md +12 -3
  4. package/core.d.ts +4 -5
  5. package/core.d.ts.map +1 -1
  6. package/core.js +16 -11
  7. package/core.js.map +1 -1
  8. package/core.mjs +16 -11
  9. package/core.mjs.map +1 -1
  10. package/error.d.ts +30 -36
  11. package/error.d.ts.map +1 -1
  12. package/error.js +24 -43
  13. package/error.js.map +1 -1
  14. package/error.mjs +24 -43
  15. package/error.mjs.map +1 -1
  16. package/index.d.mts +43 -109
  17. package/index.d.ts +43 -109
  18. package/index.d.ts.map +1 -1
  19. package/index.js +71 -33
  20. package/index.js.map +1 -1
  21. package/index.mjs +43 -32
  22. package/index.mjs.map +1 -1
  23. package/package.json +2 -2
  24. package/resources/alerts.d.ts +58 -19
  25. package/resources/alerts.d.ts.map +1 -1
  26. package/resources/alerts.js +19 -37
  27. package/resources/alerts.js.map +1 -1
  28. package/resources/alerts.mjs +19 -14
  29. package/resources/alerts.mjs.map +1 -1
  30. package/resources/coupons/coupons.d.ts +3 -7
  31. package/resources/coupons/coupons.d.ts.map +1 -1
  32. package/resources/coupons/coupons.js +3 -5
  33. package/resources/coupons/coupons.js.map +1 -1
  34. package/resources/coupons/coupons.mjs +3 -5
  35. package/resources/coupons/coupons.mjs.map +1 -1
  36. package/resources/coupons/index.d.ts +2 -2
  37. package/resources/coupons/index.d.ts.map +1 -1
  38. package/resources/coupons/index.js.map +1 -1
  39. package/resources/coupons/index.mjs.map +1 -1
  40. package/resources/coupons/subscriptions.d.ts +1 -2
  41. package/resources/coupons/subscriptions.d.ts.map +1 -1
  42. package/resources/coupons/subscriptions.js +0 -2
  43. package/resources/coupons/subscriptions.js.map +1 -1
  44. package/resources/coupons/subscriptions.mjs +0 -2
  45. package/resources/coupons/subscriptions.mjs.map +1 -1
  46. package/resources/credit-notes.d.ts +29 -4
  47. package/resources/credit-notes.d.ts.map +1 -1
  48. package/resources/credit-notes.js +8 -27
  49. package/resources/credit-notes.js.map +1 -1
  50. package/resources/credit-notes.mjs +8 -4
  51. package/resources/credit-notes.mjs.map +1 -1
  52. package/resources/customers/balance-transactions.d.ts +1 -6
  53. package/resources/customers/balance-transactions.d.ts.map +1 -1
  54. package/resources/customers/balance-transactions.js +1 -27
  55. package/resources/customers/balance-transactions.js.map +1 -1
  56. package/resources/customers/balance-transactions.mjs +1 -4
  57. package/resources/customers/balance-transactions.mjs.map +1 -1
  58. package/resources/customers/costs.d.ts +1 -5
  59. package/resources/customers/costs.d.ts.map +1 -1
  60. package/resources/customers/costs.js +0 -2
  61. package/resources/customers/costs.js.map +1 -1
  62. package/resources/customers/costs.mjs +0 -2
  63. package/resources/customers/costs.mjs.map +1 -1
  64. package/resources/customers/credits/credits.d.ts +15 -31
  65. package/resources/customers/credits/credits.d.ts.map +1 -1
  66. package/resources/customers/credits/credits.js +10 -11
  67. package/resources/customers/credits/credits.js.map +1 -1
  68. package/resources/customers/credits/credits.mjs +10 -11
  69. package/resources/customers/credits/credits.mjs.map +1 -1
  70. package/resources/customers/credits/index.d.ts +3 -3
  71. package/resources/customers/credits/index.d.ts.map +1 -1
  72. package/resources/customers/credits/index.js.map +1 -1
  73. package/resources/customers/credits/index.mjs.map +1 -1
  74. package/resources/customers/credits/ledger.d.ts +15 -23
  75. package/resources/customers/credits/ledger.d.ts.map +1 -1
  76. package/resources/customers/credits/ledger.js +12 -36
  77. package/resources/customers/credits/ledger.js.map +1 -1
  78. package/resources/customers/credits/ledger.mjs +12 -13
  79. package/resources/customers/credits/ledger.mjs.map +1 -1
  80. package/resources/customers/credits/top-ups.d.ts +1 -11
  81. package/resources/customers/credits/top-ups.d.ts.map +1 -1
  82. package/resources/customers/credits/top-ups.js +2 -28
  83. package/resources/customers/credits/top-ups.js.map +1 -1
  84. package/resources/customers/credits/top-ups.mjs +2 -5
  85. package/resources/customers/credits/top-ups.mjs.map +1 -1
  86. package/resources/customers/customers.d.ts +9 -29
  87. package/resources/customers/customers.d.ts.map +1 -1
  88. package/resources/customers/customers.js +25 -18
  89. package/resources/customers/customers.js.map +1 -1
  90. package/resources/customers/customers.mjs +25 -18
  91. package/resources/customers/customers.mjs.map +1 -1
  92. package/resources/customers/index.d.ts +4 -4
  93. package/resources/customers/index.d.ts.map +1 -1
  94. package/resources/customers/index.js.map +1 -1
  95. package/resources/customers/index.mjs.map +1 -1
  96. package/resources/dimensional-price-groups/dimensional-price-groups.d.ts +90 -0
  97. package/resources/dimensional-price-groups/dimensional-price-groups.d.ts.map +1 -0
  98. package/resources/dimensional-price-groups/dimensional-price-groups.js +73 -0
  99. package/resources/dimensional-price-groups/dimensional-price-groups.js.map +1 -0
  100. package/resources/dimensional-price-groups/dimensional-price-groups.mjs +45 -0
  101. package/resources/dimensional-price-groups/dimensional-price-groups.mjs.map +1 -0
  102. package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.ts +10 -0
  103. package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.ts.map +1 -0
  104. package/resources/dimensional-price-groups/external-dimensional-price-group-id.js +15 -0
  105. package/resources/dimensional-price-groups/external-dimensional-price-group-id.js.map +1 -0
  106. package/resources/dimensional-price-groups/external-dimensional-price-group-id.mjs +11 -0
  107. package/resources/dimensional-price-groups/external-dimensional-price-group-id.mjs.map +1 -0
  108. package/resources/dimensional-price-groups/index.d.ts +3 -0
  109. package/resources/dimensional-price-groups/index.d.ts.map +1 -0
  110. package/resources/dimensional-price-groups/index.js +9 -0
  111. package/resources/dimensional-price-groups/index.js.map +1 -0
  112. package/resources/dimensional-price-groups/index.mjs +4 -0
  113. package/resources/dimensional-price-groups/index.mjs.map +1 -0
  114. package/resources/events/backfills.d.ts +5 -11
  115. package/resources/events/backfills.d.ts.map +1 -1
  116. package/resources/events/backfills.js +5 -29
  117. package/resources/events/backfills.js.map +1 -1
  118. package/resources/events/backfills.mjs +5 -6
  119. package/resources/events/backfills.mjs.map +1 -1
  120. package/resources/events/events.d.ts +7 -22
  121. package/resources/events/events.d.ts.map +1 -1
  122. package/resources/events/events.js +7 -7
  123. package/resources/events/events.js.map +1 -1
  124. package/resources/events/events.mjs +7 -7
  125. package/resources/events/events.mjs.map +1 -1
  126. package/resources/events/index.d.ts +3 -3
  127. package/resources/events/index.d.ts.map +1 -1
  128. package/resources/events/index.js.map +1 -1
  129. package/resources/events/index.mjs.map +1 -1
  130. package/resources/events/volume.d.ts +9 -12
  131. package/resources/events/volume.d.ts.map +1 -1
  132. package/resources/events/volume.js +16 -7
  133. package/resources/events/volume.js.map +1 -1
  134. package/resources/events/volume.mjs +16 -7
  135. package/resources/events/volume.mjs.map +1 -1
  136. package/resources/index.d.ts +14 -13
  137. package/resources/index.d.ts.map +1 -1
  138. package/resources/index.js +10 -7
  139. package/resources/index.js.map +1 -1
  140. package/resources/index.mjs +8 -7
  141. package/resources/index.mjs.map +1 -1
  142. package/resources/invoice-line-items.d.ts +1 -3
  143. package/resources/invoice-line-items.d.ts.map +1 -1
  144. package/resources/invoice-line-items.js +0 -2
  145. package/resources/invoice-line-items.js.map +1 -1
  146. package/resources/invoice-line-items.mjs +0 -2
  147. package/resources/invoice-line-items.mjs.map +1 -1
  148. package/resources/invoices.d.ts +81 -18
  149. package/resources/invoices.d.ts.map +1 -1
  150. package/resources/invoices.js +22 -35
  151. package/resources/invoices.js.map +1 -1
  152. package/resources/invoices.mjs +22 -12
  153. package/resources/invoices.mjs.map +1 -1
  154. package/resources/items.d.ts +2 -8
  155. package/resources/items.d.ts.map +1 -1
  156. package/resources/items.js +5 -31
  157. package/resources/items.js.map +1 -1
  158. package/resources/items.mjs +5 -8
  159. package/resources/items.mjs.map +1 -1
  160. package/resources/metrics.d.ts +2 -8
  161. package/resources/metrics.d.ts.map +1 -1
  162. package/resources/metrics.js +7 -31
  163. package/resources/metrics.js.map +1 -1
  164. package/resources/metrics.mjs +7 -8
  165. package/resources/metrics.mjs.map +1 -1
  166. package/resources/plans/external-plan-id.d.ts +2 -4
  167. package/resources/plans/external-plan-id.d.ts.map +1 -1
  168. package/resources/plans/external-plan-id.js +7 -7
  169. package/resources/plans/external-plan-id.js.map +1 -1
  170. package/resources/plans/external-plan-id.mjs +7 -7
  171. package/resources/plans/external-plan-id.mjs.map +1 -1
  172. package/resources/plans/index.d.ts +2 -2
  173. package/resources/plans/index.d.ts.map +1 -1
  174. package/resources/plans/index.js.map +1 -1
  175. package/resources/plans/index.mjs +1 -1
  176. package/resources/plans/index.mjs.map +1 -1
  177. package/resources/plans/plans.d.ts +332 -11
  178. package/resources/plans/plans.d.ts.map +1 -1
  179. package/resources/plans/plans.js +10 -9
  180. package/resources/plans/plans.js.map +1 -1
  181. package/resources/plans/plans.mjs +10 -9
  182. package/resources/plans/plans.mjs.map +1 -1
  183. package/resources/prices/external-price-id.d.ts +2 -4
  184. package/resources/prices/external-price-id.d.ts.map +1 -1
  185. package/resources/prices/external-price-id.js +6 -7
  186. package/resources/prices/external-price-id.js.map +1 -1
  187. package/resources/prices/external-price-id.mjs +6 -7
  188. package/resources/prices/external-price-id.mjs.map +1 -1
  189. package/resources/prices/index.d.ts +2 -2
  190. package/resources/prices/index.d.ts.map +1 -1
  191. package/resources/prices/index.js +3 -3
  192. package/resources/prices/index.js.map +1 -1
  193. package/resources/prices/index.mjs +1 -1
  194. package/resources/prices/index.mjs.map +1 -1
  195. package/resources/prices/prices.d.ts +340 -15
  196. package/resources/prices/prices.d.ts.map +1 -1
  197. package/resources/prices/prices.js +9 -9
  198. package/resources/prices/prices.js.map +1 -1
  199. package/resources/prices/prices.mjs +9 -9
  200. package/resources/prices/prices.mjs.map +1 -1
  201. package/resources/subscriptions.d.ts +7636 -200
  202. package/resources/subscriptions.d.ts.map +1 -1
  203. package/resources/subscriptions.js +348 -47
  204. package/resources/subscriptions.js.map +1 -1
  205. package/resources/subscriptions.mjs +348 -24
  206. package/resources/subscriptions.mjs.map +1 -1
  207. package/resources/top-level.d.ts +1 -2
  208. package/resources/top-level.d.ts.map +1 -1
  209. package/resources/top-level.js +0 -2
  210. package/resources/top-level.js.map +1 -1
  211. package/resources/top-level.mjs +0 -2
  212. package/resources/top-level.mjs.map +1 -1
  213. package/src/core.ts +23 -19
  214. package/src/error.ts +82 -125
  215. package/src/index.ts +334 -130
  216. package/src/resources/alerts.ts +117 -24
  217. package/src/resources/coupons/coupons.ts +13 -8
  218. package/src/resources/coupons/index.ts +2 -2
  219. package/src/resources/coupons/subscriptions.ts +2 -3
  220. package/src/resources/credit-notes.ts +45 -5
  221. package/src/resources/customers/balance-transactions.ts +10 -7
  222. package/src/resources/customers/costs.ts +7 -6
  223. package/src/resources/customers/credits/credits.ts +82 -32
  224. package/src/resources/customers/credits/index.ts +20 -20
  225. package/src/resources/customers/credits/ledger.ts +30 -24
  226. package/src/resources/customers/credits/top-ups.ts +16 -12
  227. package/src/resources/customers/customers.ts +70 -46
  228. package/src/resources/customers/index.ts +17 -17
  229. package/src/resources/dimensional-price-groups/dimensional-price-groups.ts +146 -0
  230. package/src/resources/dimensional-price-groups/external-dimensional-price-group-id.ts +20 -0
  231. package/src/resources/dimensional-price-groups/index.ts +10 -0
  232. package/src/resources/events/backfills.ts +17 -12
  233. package/src/resources/events/events.ts +42 -23
  234. package/src/resources/events/index.ts +15 -15
  235. package/src/resources/events/volume.ts +11 -22
  236. package/src/resources/index.ts +113 -67
  237. package/src/resources/invoice-line-items.ts +5 -4
  238. package/src/resources/invoices.ts +111 -34
  239. package/src/resources/items.ts +11 -17
  240. package/src/resources/metrics.ts +11 -17
  241. package/src/resources/plans/external-plan-id.ts +3 -14
  242. package/src/resources/plans/index.ts +9 -2
  243. package/src/resources/plans/plans.ts +425 -19
  244. package/src/resources/prices/external-price-id.ts +3 -14
  245. package/src/resources/prices/index.ts +8 -8
  246. package/src/resources/prices/prices.ts +471 -24
  247. package/src/resources/subscriptions.ts +9238 -440
  248. package/src/resources/top-level.ts +2 -3
  249. package/src/version.ts +1 -1
  250. package/version.d.ts +1 -1
  251. package/version.js +1 -1
  252. package/version.mjs +1 -1
@@ -2,95 +2,141 @@
2
2
 
3
3
  export * from './shared';
4
4
  export {
5
- Alert,
6
- AlertUpdateParams,
7
- AlertListParams,
8
- AlertCreateForCustomerParams,
9
- AlertCreateForExternalCustomerParams,
10
- AlertCreateForSubscriptionParams,
11
5
  AlertsPage,
12
6
  Alerts,
7
+ type Alert,
8
+ type AlertUpdateParams,
9
+ type AlertListParams,
10
+ type AlertCreateForCustomerParams,
11
+ type AlertCreateForExternalCustomerParams,
12
+ type AlertCreateForSubscriptionParams,
13
+ type AlertDisableParams,
14
+ type AlertEnableParams,
13
15
  } from './alerts';
14
16
  export {
15
- BillableMetric,
16
- MetricCreateParams,
17
- MetricUpdateParams,
18
- MetricListParams,
19
17
  BillableMetricsPage,
20
18
  Metrics,
19
+ type BillableMetric,
20
+ type MetricCreateParams,
21
+ type MetricUpdateParams,
22
+ type MetricListParams,
21
23
  } from './metrics';
22
- export { Coupon, CouponCreateParams, CouponListParams, CouponsPage, Coupons } from './coupons/coupons';
23
- export { CreditNote, CreditNoteListParams, CreditNotesPage, CreditNotes } from './credit-notes';
24
24
  export {
25
- Customer,
26
- CustomerCreateParams,
27
- CustomerUpdateParams,
28
- CustomerListParams,
29
- CustomerUpdateByExternalIDParams,
25
+ CouponsPage,
26
+ Coupons,
27
+ type Coupon,
28
+ type CouponCreateParams,
29
+ type CouponListParams,
30
+ } from './coupons/coupons';
31
+ export {
32
+ CreditNotesPage,
33
+ CreditNotes,
34
+ type CreditNote,
35
+ type CreditNoteCreateParams,
36
+ type CreditNoteListParams,
37
+ } from './credit-notes';
38
+ export {
30
39
  CustomersPage,
31
40
  Customers,
41
+ type Customer,
42
+ type CustomerCreateParams,
43
+ type CustomerUpdateParams,
44
+ type CustomerListParams,
45
+ type CustomerUpdateByExternalIDParams,
32
46
  } from './customers/customers';
33
47
  export {
34
- EvaluatePriceGroup,
35
- Price,
36
- PriceEvaluateResponse,
37
- PriceCreateParams,
38
- PriceUpdateParams,
39
- PriceListParams,
40
- PriceEvaluateParams,
41
- PricesPage,
42
- Prices,
43
- } from './prices/prices';
48
+ DimensionalPriceGroupsPage,
49
+ DimensionalPriceGroups,
50
+ type DimensionalPriceGroup,
51
+ type DimensionalPriceGroupCreateParams,
52
+ type DimensionalPriceGroupListParams,
53
+ } from './dimensional-price-groups/dimensional-price-groups';
44
54
  export {
45
- EventUpdateResponse,
46
- EventDeprecateResponse,
47
- EventIngestResponse,
48
- EventSearchResponse,
49
- EventUpdateParams,
50
- EventIngestParams,
51
- EventSearchParams,
52
55
  Events,
56
+ type EventUpdateResponse,
57
+ type EventDeprecateResponse,
58
+ type EventIngestResponse,
59
+ type EventSearchResponse,
60
+ type EventUpdateParams,
61
+ type EventIngestParams,
62
+ type EventSearchParams,
53
63
  } from './events/events';
54
64
  export {
55
- Invoice,
56
- InvoiceFetchUpcomingResponse,
57
- InvoiceCreateParams,
58
- InvoiceUpdateParams,
59
- InvoiceListParams,
60
- InvoiceFetchUpcomingParams,
61
- InvoiceIssueParams,
62
- InvoiceMarkPaidParams,
65
+ InvoiceLineItems,
66
+ type InvoiceLineItemCreateResponse,
67
+ type InvoiceLineItemCreateParams,
68
+ } from './invoice-line-items';
69
+ export {
63
70
  InvoicesPage,
64
71
  Invoices,
72
+ type Invoice,
73
+ type InvoiceFetchUpcomingResponse,
74
+ type InvoiceCreateParams,
75
+ type InvoiceUpdateParams,
76
+ type InvoiceListParams,
77
+ type InvoiceFetchUpcomingParams,
78
+ type InvoiceIssueParams,
79
+ type InvoiceMarkPaidParams,
65
80
  } from './invoices';
66
81
  export {
67
- InvoiceLineItemCreateResponse,
68
- InvoiceLineItemCreateParams,
69
- InvoiceLineItems,
70
- } from './invoice-line-items';
71
- export { Item, ItemCreateParams, ItemUpdateParams, ItemListParams, ItemsPage, Items } from './items';
72
- export { Plan, PlanCreateParams, PlanUpdateParams, PlanListParams, PlansPage, Plans } from './plans/plans';
82
+ ItemsPage,
83
+ Items,
84
+ type Item,
85
+ type ItemCreateParams,
86
+ type ItemUpdateParams,
87
+ type ItemListParams,
88
+ } from './items';
89
+ export {
90
+ PlansPage,
91
+ Plans,
92
+ type Plan,
93
+ type PlanCreateParams,
94
+ type PlanUpdateParams,
95
+ type PlanListParams,
96
+ } from './plans/plans';
97
+ export {
98
+ PricesPage,
99
+ Prices,
100
+ type EvaluatePriceGroup,
101
+ type Price,
102
+ type PriceEvaluateResponse,
103
+ type PriceCreateParams,
104
+ type PriceUpdateParams,
105
+ type PriceListParams,
106
+ type PriceEvaluateParams,
107
+ } from './prices/prices';
73
108
  export {
74
- Subscription,
75
- SubscriptionUsage,
76
- Subscriptions,
77
- SubscriptionFetchCostsResponse,
78
- SubscriptionFetchScheduleResponse,
79
- SubscriptionCreateParams,
80
- SubscriptionUpdateParams,
81
- SubscriptionListParams,
82
- SubscriptionCancelParams,
83
- SubscriptionFetchCostsParams,
84
- SubscriptionFetchScheduleParams,
85
- SubscriptionFetchUsageParams,
86
- SubscriptionPriceIntervalsParams,
87
- SubscriptionSchedulePlanChangeParams,
88
- SubscriptionTriggerPhaseParams,
89
- SubscriptionUnscheduleFixedFeeQuantityUpdatesParams,
90
- SubscriptionUpdateFixedFeeQuantityParams,
91
- SubscriptionUpdateTrialParams,
92
109
  SubscriptionsPage,
93
110
  SubscriptionFetchScheduleResponsesPage,
111
+ Subscriptions,
112
+ type Subscription,
113
+ type SubscriptionUsage,
114
+ type SubscriptionCreateResponse,
115
+ type SubscriptionCancelResponse,
116
+ type SubscriptionFetchCostsResponse,
117
+ type SubscriptionFetchScheduleResponse,
118
+ type SubscriptionPriceIntervalsResponse,
119
+ type SubscriptionSchedulePlanChangeResponse,
120
+ type SubscriptionTriggerPhaseResponse,
121
+ type SubscriptionUnscheduleCancellationResponse,
122
+ type SubscriptionUnscheduleFixedFeeQuantityUpdatesResponse,
123
+ type SubscriptionUnschedulePendingPlanChangesResponse,
124
+ type SubscriptionUpdateFixedFeeQuantityResponse,
125
+ type SubscriptionUpdateTrialResponse,
126
+ type SubscriptionCreateParams,
127
+ type SubscriptionUpdateParams,
128
+ type SubscriptionListParams,
129
+ type SubscriptionCancelParams,
130
+ type SubscriptionFetchCostsParams,
131
+ type SubscriptionFetchScheduleParams,
132
+ type SubscriptionFetchUsageParams,
133
+ type SubscriptionPriceIntervalsParams,
134
+ type SubscriptionSchedulePlanChangeParams,
135
+ type SubscriptionTriggerPhaseParams,
136
+ type SubscriptionUnscheduleFixedFeeQuantityUpdatesParams,
137
+ type SubscriptionUpdateFixedFeeQuantityParams,
138
+ type SubscriptionUpdateTrialParams,
94
139
  } from './subscriptions';
95
- export { TopLevelPingResponse, TopLevel } from './top-level';
140
+ export { TopLevel, type TopLevelPingResponse } from './top-level';
141
+
96
142
  export { Webhooks } from './webhooks';
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { APIResource } from '../resource';
4
4
  import * as Core from '../core';
5
- import * as InvoiceLineItemsAPI from './invoice-line-items';
6
5
  import * as Shared from './shared';
7
6
  import * as PricesAPI from './prices/prices';
8
7
 
@@ -496,7 +495,9 @@ export interface InvoiceLineItemCreateParams {
496
495
  start_date: string;
497
496
  }
498
497
 
499
- export namespace InvoiceLineItems {
500
- export import InvoiceLineItemCreateResponse = InvoiceLineItemsAPI.InvoiceLineItemCreateResponse;
501
- export import InvoiceLineItemCreateParams = InvoiceLineItemsAPI.InvoiceLineItemCreateParams;
498
+ export declare namespace InvoiceLineItems {
499
+ export {
500
+ type InvoiceLineItemCreateResponse as InvoiceLineItemCreateResponse,
501
+ type InvoiceLineItemCreateParams as InvoiceLineItemCreateParams,
502
+ };
502
503
  }
@@ -3,7 +3,6 @@
3
3
  import { APIResource } from '../resource';
4
4
  import { isRequestOptions } from '../core';
5
5
  import * as Core from '../core';
6
- import * as InvoicesAPI from './invoices';
7
6
  import * as Shared from './shared';
8
7
  import * as PricesAPI from './prices/prices';
9
8
  import { Page, type PageParams } from '../pagination';
@@ -25,18 +24,9 @@ export class Invoices extends APIResource {
25
24
  */
26
25
  update(
27
26
  invoiceId: string,
28
- body?: InvoiceUpdateParams,
29
- options?: Core.RequestOptions,
30
- ): Core.APIPromise<Invoice>;
31
- update(invoiceId: string, options?: Core.RequestOptions): Core.APIPromise<Invoice>;
32
- update(
33
- invoiceId: string,
34
- body: InvoiceUpdateParams | Core.RequestOptions = {},
27
+ body: InvoiceUpdateParams,
35
28
  options?: Core.RequestOptions,
36
29
  ): Core.APIPromise<Invoice> {
37
- if (isRequestOptions(body)) {
38
- return this.update(invoiceId, {}, body);
39
- }
40
30
  return this._client.put(`/invoices/${invoiceId}`, { body, ...options });
41
31
  }
42
32
 
@@ -81,17 +71,9 @@ export class Invoices extends APIResource {
81
71
  * subscription.
82
72
  */
83
73
  fetchUpcoming(
84
- query?: InvoiceFetchUpcomingParams,
85
- options?: Core.RequestOptions,
86
- ): Core.APIPromise<InvoiceFetchUpcomingResponse>;
87
- fetchUpcoming(options?: Core.RequestOptions): Core.APIPromise<InvoiceFetchUpcomingResponse>;
88
- fetchUpcoming(
89
- query: InvoiceFetchUpcomingParams | Core.RequestOptions = {},
74
+ query: InvoiceFetchUpcomingParams,
90
75
  options?: Core.RequestOptions,
91
76
  ): Core.APIPromise<InvoiceFetchUpcomingResponse> {
92
- if (isRequestOptions(query)) {
93
- return this.fetchUpcoming({}, query);
94
- }
95
77
  return this._client.get('/invoices/upcoming', { query, ...options });
96
78
  }
97
79
 
@@ -132,6 +114,14 @@ export class Invoices extends APIResource {
132
114
  return this._client.post(`/invoices/${invoiceId}/mark_paid`, { body, ...options });
133
115
  }
134
116
 
117
+ /**
118
+ * This endpoint collects payment for an invoice using the customer's default
119
+ * payment method. This action can only be taken on invoices with status "issued".
120
+ */
121
+ pay(invoiceId: string, options?: Core.RequestOptions): Core.APIPromise<Invoice> {
122
+ return this._client.post(`/invoices/${invoiceId}/pay`, options);
123
+ }
124
+
135
125
  /**
136
126
  * This endpoint allows an invoice's status to be set the `void` status. This can
137
127
  * only be done to invoices that are in the `issued` status.
@@ -301,7 +291,7 @@ export interface Invoice {
301
291
  * list is provided, the first discount in the list will be returned. If the list
302
292
  * is empty, `None` will be returned.
303
293
  */
304
- discount: unknown | null;
294
+ discount: unknown;
305
295
 
306
296
  discounts: Array<Shared.InvoiceLevelDiscount>;
307
297
 
@@ -386,6 +376,11 @@ export interface Invoice {
386
376
  */
387
377
  paid_at: string | null;
388
378
 
379
+ /**
380
+ * A list of payment attempts associated with the invoice
381
+ */
382
+ payment_attempts: Array<Invoice.PaymentAttempt>;
383
+
389
384
  /**
390
385
  * If payment was attempted on this invoice but failed, this will be the time of
391
386
  * the most recent attempt.
@@ -1310,6 +1305,38 @@ export namespace Invoice {
1310
1305
  minimum_amount: string;
1311
1306
  }
1312
1307
 
1308
+ export interface PaymentAttempt {
1309
+ /**
1310
+ * The ID of the payment attempt.
1311
+ */
1312
+ id: string;
1313
+
1314
+ /**
1315
+ * The amount of the payment attempt.
1316
+ */
1317
+ amount: string;
1318
+
1319
+ /**
1320
+ * The time at which the payment attempt was created.
1321
+ */
1322
+ created_at: string;
1323
+
1324
+ /**
1325
+ * The payment provider that attempted to collect the payment.
1326
+ */
1327
+ payment_provider: 'stripe' | null;
1328
+
1329
+ /**
1330
+ * The ID of the payment attempt in the payment provider.
1331
+ */
1332
+ payment_provider_id: string | null;
1333
+
1334
+ /**
1335
+ * Whether the payment attempt succeeded.
1336
+ */
1337
+ succeeded: boolean;
1338
+ }
1339
+
1313
1340
  export interface ShippingAddress {
1314
1341
  city: string | null;
1315
1342
 
@@ -1475,7 +1502,7 @@ export interface InvoiceFetchUpcomingResponse {
1475
1502
  * list is provided, the first discount in the list will be returned. If the list
1476
1503
  * is empty, `None` will be returned.
1477
1504
  */
1478
- discount: unknown | null;
1505
+ discount: unknown;
1479
1506
 
1480
1507
  discounts: Array<Shared.InvoiceLevelDiscount>;
1481
1508
 
@@ -1555,6 +1582,11 @@ export interface InvoiceFetchUpcomingResponse {
1555
1582
  */
1556
1583
  paid_at: string | null;
1557
1584
 
1585
+ /**
1586
+ * A list of payment attempts associated with the invoice
1587
+ */
1588
+ payment_attempts: Array<InvoiceFetchUpcomingResponse.PaymentAttempt>;
1589
+
1558
1590
  /**
1559
1591
  * If payment was attempted on this invoice but failed, this will be the time of
1560
1592
  * the most recent attempt.
@@ -2484,6 +2516,38 @@ export namespace InvoiceFetchUpcomingResponse {
2484
2516
  minimum_amount: string;
2485
2517
  }
2486
2518
 
2519
+ export interface PaymentAttempt {
2520
+ /**
2521
+ * The ID of the payment attempt.
2522
+ */
2523
+ id: string;
2524
+
2525
+ /**
2526
+ * The amount of the payment attempt.
2527
+ */
2528
+ amount: string;
2529
+
2530
+ /**
2531
+ * The time at which the payment attempt was created.
2532
+ */
2533
+ created_at: string;
2534
+
2535
+ /**
2536
+ * The payment provider that attempted to collect the payment.
2537
+ */
2538
+ payment_provider: 'stripe' | null;
2539
+
2540
+ /**
2541
+ * The ID of the payment attempt in the payment provider.
2542
+ */
2543
+ payment_provider_id: string | null;
2544
+
2545
+ /**
2546
+ * Whether the payment attempt succeeded.
2547
+ */
2548
+ succeeded: boolean;
2549
+ }
2550
+
2487
2551
  export interface ShippingAddress {
2488
2552
  city: string | null;
2489
2553
 
@@ -2623,6 +2687,12 @@ export interface InvoiceListParams extends PageParams {
2623
2687
 
2624
2688
  due_date?: string | null;
2625
2689
 
2690
+ /**
2691
+ * Filters invoices by their due dates within a specific time range in the past.
2692
+ * Specify the range as a number followed by 'd' (days) or 'm' (months). For
2693
+ * example, '7d' filters invoices due in the last 7 days, and '2m' filters those
2694
+ * due in the last 2 months.
2695
+ */
2626
2696
  due_date_window?: string | null;
2627
2697
 
2628
2698
  'due_date[gt]'?: string | null;
@@ -2647,13 +2717,16 @@ export interface InvoiceListParams extends PageParams {
2647
2717
  }
2648
2718
 
2649
2719
  export interface InvoiceFetchUpcomingParams {
2650
- subscription_id?: string;
2720
+ subscription_id: string;
2651
2721
  }
2652
2722
 
2653
2723
  export interface InvoiceIssueParams {
2654
2724
  /**
2655
2725
  * If true, the invoice will be issued synchronously. If false, the invoice will be
2656
- * issued asynchronously.
2726
+ * issued asynchronously. The synchronous option is only available for invoices
2727
+ * containin no usage fees. If the invoice is configured to sync to an external
2728
+ * provider, a successful response from this endpoint guarantees the invoice is
2729
+ * present in the provider.
2657
2730
  */
2658
2731
  synchronous?: boolean;
2659
2732
  }
@@ -2675,14 +2748,18 @@ export interface InvoiceMarkPaidParams {
2675
2748
  notes?: string | null;
2676
2749
  }
2677
2750
 
2678
- export namespace Invoices {
2679
- export import Invoice = InvoicesAPI.Invoice;
2680
- export import InvoiceFetchUpcomingResponse = InvoicesAPI.InvoiceFetchUpcomingResponse;
2681
- export import InvoicesPage = InvoicesAPI.InvoicesPage;
2682
- export import InvoiceCreateParams = InvoicesAPI.InvoiceCreateParams;
2683
- export import InvoiceUpdateParams = InvoicesAPI.InvoiceUpdateParams;
2684
- export import InvoiceListParams = InvoicesAPI.InvoiceListParams;
2685
- export import InvoiceFetchUpcomingParams = InvoicesAPI.InvoiceFetchUpcomingParams;
2686
- export import InvoiceIssueParams = InvoicesAPI.InvoiceIssueParams;
2687
- export import InvoiceMarkPaidParams = InvoicesAPI.InvoiceMarkPaidParams;
2751
+ Invoices.InvoicesPage = InvoicesPage;
2752
+
2753
+ export declare namespace Invoices {
2754
+ export {
2755
+ type Invoice as Invoice,
2756
+ type InvoiceFetchUpcomingResponse as InvoiceFetchUpcomingResponse,
2757
+ InvoicesPage as InvoicesPage,
2758
+ type InvoiceCreateParams as InvoiceCreateParams,
2759
+ type InvoiceUpdateParams as InvoiceUpdateParams,
2760
+ type InvoiceListParams as InvoiceListParams,
2761
+ type InvoiceFetchUpcomingParams as InvoiceFetchUpcomingParams,
2762
+ type InvoiceIssueParams as InvoiceIssueParams,
2763
+ type InvoiceMarkPaidParams as InvoiceMarkPaidParams,
2764
+ };
2688
2765
  }
@@ -3,7 +3,6 @@
3
3
  import { APIResource } from '../resource';
4
4
  import { isRequestOptions } from '../core';
5
5
  import * as Core from '../core';
6
- import * as ItemsAPI from './items';
7
6
  import { Page, type PageParams } from '../pagination';
8
7
 
9
8
  export class Items extends APIResource {
@@ -17,16 +16,7 @@ export class Items extends APIResource {
17
16
  /**
18
17
  * This endpoint can be used to update properties on the Item.
19
18
  */
20
- update(itemId: string, body?: ItemUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Item>;
21
- update(itemId: string, options?: Core.RequestOptions): Core.APIPromise<Item>;
22
- update(
23
- itemId: string,
24
- body: ItemUpdateParams | Core.RequestOptions = {},
25
- options?: Core.RequestOptions,
26
- ): Core.APIPromise<Item> {
27
- if (isRequestOptions(body)) {
28
- return this.update(itemId, {}, body);
29
- }
19
+ update(itemId: string, body: ItemUpdateParams, options?: Core.RequestOptions): Core.APIPromise<Item> {
30
20
  return this._client.put(`/items/${itemId}`, { body, ...options });
31
21
  }
32
22
 
@@ -116,10 +106,14 @@ export namespace ItemUpdateParams {
116
106
 
117
107
  export interface ItemListParams extends PageParams {}
118
108
 
119
- export namespace Items {
120
- export import Item = ItemsAPI.Item;
121
- export import ItemsPage = ItemsAPI.ItemsPage;
122
- export import ItemCreateParams = ItemsAPI.ItemCreateParams;
123
- export import ItemUpdateParams = ItemsAPI.ItemUpdateParams;
124
- export import ItemListParams = ItemsAPI.ItemListParams;
109
+ Items.ItemsPage = ItemsPage;
110
+
111
+ export declare namespace Items {
112
+ export {
113
+ type Item as Item,
114
+ ItemsPage as ItemsPage,
115
+ type ItemCreateParams as ItemCreateParams,
116
+ type ItemUpdateParams as ItemUpdateParams,
117
+ type ItemListParams as ItemListParams,
118
+ };
125
119
  }
@@ -3,7 +3,6 @@
3
3
  import { APIResource } from '../resource';
4
4
  import { isRequestOptions } from '../core';
5
5
  import * as Core from '../core';
6
- import * as MetricsAPI from './metrics';
7
6
  import * as ItemsAPI from './items';
8
7
  import { Page, type PageParams } from '../pagination';
9
8
 
@@ -25,18 +24,9 @@ export class Metrics extends APIResource {
25
24
  */
26
25
  update(
27
26
  metricId: string,
28
- body?: MetricUpdateParams,
29
- options?: Core.RequestOptions,
30
- ): Core.APIPromise<BillableMetric>;
31
- update(metricId: string, options?: Core.RequestOptions): Core.APIPromise<BillableMetric>;
32
- update(
33
- metricId: string,
34
- body: MetricUpdateParams | Core.RequestOptions = {},
27
+ body: MetricUpdateParams,
35
28
  options?: Core.RequestOptions,
36
29
  ): Core.APIPromise<BillableMetric> {
37
- if (isRequestOptions(body)) {
38
- return this.update(metricId, {}, body);
39
- }
40
30
  return this._client.put(`/metrics/${metricId}`, { body, ...options });
41
31
  }
42
32
 
@@ -149,10 +139,14 @@ export interface MetricListParams extends PageParams {
149
139
  'created_at[lte]'?: string | null;
150
140
  }
151
141
 
152
- export namespace Metrics {
153
- export import BillableMetric = MetricsAPI.BillableMetric;
154
- export import BillableMetricsPage = MetricsAPI.BillableMetricsPage;
155
- export import MetricCreateParams = MetricsAPI.MetricCreateParams;
156
- export import MetricUpdateParams = MetricsAPI.MetricUpdateParams;
157
- export import MetricListParams = MetricsAPI.MetricListParams;
142
+ Metrics.BillableMetricsPage = BillableMetricsPage;
143
+
144
+ export declare namespace Metrics {
145
+ export {
146
+ type BillableMetric as BillableMetric,
147
+ BillableMetricsPage as BillableMetricsPage,
148
+ type MetricCreateParams as MetricCreateParams,
149
+ type MetricUpdateParams as MetricUpdateParams,
150
+ type MetricListParams as MetricListParams,
151
+ };
158
152
  }
@@ -1,9 +1,7 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../../resource';
4
- import { isRequestOptions } from '../../core';
5
4
  import * as Core from '../../core';
6
- import * as ExternalPlanIDAPI from './external-plan-id';
7
5
  import * as PlansAPI from './plans';
8
6
 
9
7
  export class ExternalPlanID extends APIResource {
@@ -15,18 +13,9 @@ export class ExternalPlanID extends APIResource {
15
13
  */
16
14
  update(
17
15
  otherExternalPlanId: string,
18
- body?: ExternalPlanIDUpdateParams,
19
- options?: Core.RequestOptions,
20
- ): Core.APIPromise<PlansAPI.Plan>;
21
- update(otherExternalPlanId: string, options?: Core.RequestOptions): Core.APIPromise<PlansAPI.Plan>;
22
- update(
23
- otherExternalPlanId: string,
24
- body: ExternalPlanIDUpdateParams | Core.RequestOptions = {},
16
+ body: ExternalPlanIDUpdateParams,
25
17
  options?: Core.RequestOptions,
26
18
  ): Core.APIPromise<PlansAPI.Plan> {
27
- if (isRequestOptions(body)) {
28
- return this.update(otherExternalPlanId, {}, body);
29
- }
30
19
  return this._client.put(`/plans/external_plan_id/${otherExternalPlanId}`, { body, ...options });
31
20
  }
32
21
 
@@ -69,6 +58,6 @@ export interface ExternalPlanIDUpdateParams {
69
58
  metadata?: Record<string, string | null> | null;
70
59
  }
71
60
 
72
- export namespace ExternalPlanID {
73
- export import ExternalPlanIDUpdateParams = ExternalPlanIDAPI.ExternalPlanIDUpdateParams;
61
+ export declare namespace ExternalPlanID {
62
+ export { type ExternalPlanIDUpdateParams as ExternalPlanIDUpdateParams };
74
63
  }
@@ -1,4 +1,11 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export { ExternalPlanIDUpdateParams, ExternalPlanID } from './external-plan-id';
4
- export { Plan, PlanCreateParams, PlanUpdateParams, PlanListParams, PlansPage, Plans } from './plans';
3
+ export { ExternalPlanID, type ExternalPlanIDUpdateParams } from './external-plan-id';
4
+ export {
5
+ PlansPage,
6
+ Plans,
7
+ type Plan,
8
+ type PlanCreateParams,
9
+ type PlanUpdateParams,
10
+ type PlanListParams,
11
+ } from './plans';