@metronome/sdk 0.1.0-beta.9 → 0.2.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 (286) hide show
  1. package/CHANGELOG.md +194 -0
  2. package/README.md +30 -46
  3. package/_shims/index.d.ts +2 -0
  4. package/_shims/index.js +5 -1
  5. package/_shims/index.mjs +5 -1
  6. package/core.d.ts +19 -5
  7. package/core.d.ts.map +1 -1
  8. package/core.js +23 -14
  9. package/core.js.map +1 -1
  10. package/core.mjs +24 -15
  11. package/core.mjs.map +1 -1
  12. package/index.d.mts +3 -2
  13. package/index.d.ts +3 -2
  14. package/index.d.ts.map +1 -1
  15. package/index.js +6 -3
  16. package/index.js.map +1 -1
  17. package/index.mjs +6 -3
  18. package/index.mjs.map +1 -1
  19. package/package.json +1 -5
  20. package/pagination.d.ts +1 -0
  21. package/pagination.d.ts.map +1 -1
  22. package/pagination.js +3 -0
  23. package/pagination.js.map +1 -1
  24. package/pagination.mjs +3 -0
  25. package/pagination.mjs.map +1 -1
  26. package/resource.d.ts +1 -1
  27. package/resource.d.ts.map +1 -1
  28. package/resource.js.map +1 -1
  29. package/resource.mjs.map +1 -1
  30. package/resources/shared.d.ts +521 -37
  31. package/resources/shared.d.ts.map +1 -1
  32. package/resources/v1/alerts.d.ts +30 -10
  33. package/resources/v1/alerts.d.ts.map +1 -1
  34. package/resources/v1/alerts.js +19 -0
  35. package/resources/v1/alerts.js.map +1 -1
  36. package/resources/v1/alerts.mjs +19 -0
  37. package/resources/v1/alerts.mjs.map +1 -1
  38. package/resources/v1/audit-logs.d.ts +8 -0
  39. package/resources/v1/audit-logs.d.ts.map +1 -1
  40. package/resources/v1/audit-logs.js.map +1 -1
  41. package/resources/v1/audit-logs.mjs.map +1 -1
  42. package/resources/v1/billable-metrics.d.ts +58 -3
  43. package/resources/v1/billable-metrics.d.ts.map +1 -1
  44. package/resources/v1/billable-metrics.js +41 -0
  45. package/resources/v1/billable-metrics.js.map +1 -1
  46. package/resources/v1/billable-metrics.mjs +41 -0
  47. package/resources/v1/billable-metrics.mjs.map +1 -1
  48. package/resources/v1/contracts/contracts.d.ts +1556 -122
  49. package/resources/v1/contracts/contracts.d.ts.map +1 -1
  50. package/resources/v1/contracts/contracts.js +180 -3
  51. package/resources/v1/contracts/contracts.js.map +1 -1
  52. package/resources/v1/contracts/contracts.mjs +180 -3
  53. package/resources/v1/contracts/contracts.mjs.map +1 -1
  54. package/resources/v1/contracts/index.d.ts +2 -2
  55. package/resources/v1/contracts/index.d.ts.map +1 -1
  56. package/resources/v1/contracts/index.js.map +1 -1
  57. package/resources/v1/contracts/index.mjs.map +1 -1
  58. package/resources/v1/contracts/named-schedules.d.ts +21 -0
  59. package/resources/v1/contracts/named-schedules.d.ts.map +1 -1
  60. package/resources/v1/contracts/named-schedules.js +21 -0
  61. package/resources/v1/contracts/named-schedules.js.map +1 -1
  62. package/resources/v1/contracts/named-schedules.mjs +21 -0
  63. package/resources/v1/contracts/named-schedules.mjs.map +1 -1
  64. package/resources/v1/contracts/products.d.ts +51 -3
  65. package/resources/v1/contracts/products.d.ts.map +1 -1
  66. package/resources/v1/contracts/products.js +33 -0
  67. package/resources/v1/contracts/products.js.map +1 -1
  68. package/resources/v1/contracts/products.mjs +33 -0
  69. package/resources/v1/contracts/products.mjs.map +1 -1
  70. package/resources/v1/contracts/rate-cards/index.d.ts +1 -1
  71. package/resources/v1/contracts/rate-cards/index.d.ts.map +1 -1
  72. package/resources/v1/contracts/rate-cards/index.js.map +1 -1
  73. package/resources/v1/contracts/rate-cards/index.mjs.map +1 -1
  74. package/resources/v1/contracts/rate-cards/named-schedules.d.ts +25 -0
  75. package/resources/v1/contracts/rate-cards/named-schedules.d.ts.map +1 -1
  76. package/resources/v1/contracts/rate-cards/named-schedules.js +25 -0
  77. package/resources/v1/contracts/rate-cards/named-schedules.js.map +1 -1
  78. package/resources/v1/contracts/rate-cards/named-schedules.mjs +25 -0
  79. package/resources/v1/contracts/rate-cards/named-schedules.mjs.map +1 -1
  80. package/resources/v1/contracts/rate-cards/product-orders.d.ts +30 -0
  81. package/resources/v1/contracts/rate-cards/product-orders.d.ts.map +1 -1
  82. package/resources/v1/contracts/rate-cards/product-orders.js +30 -0
  83. package/resources/v1/contracts/rate-cards/product-orders.js.map +1 -1
  84. package/resources/v1/contracts/rate-cards/product-orders.mjs +30 -0
  85. package/resources/v1/contracts/rate-cards/product-orders.mjs.map +1 -1
  86. package/resources/v1/contracts/rate-cards/rate-cards.d.ts +107 -10
  87. package/resources/v1/contracts/rate-cards/rate-cards.d.ts.map +1 -1
  88. package/resources/v1/contracts/rate-cards/rate-cards.js +71 -0
  89. package/resources/v1/contracts/rate-cards/rate-cards.js.map +1 -1
  90. package/resources/v1/contracts/rate-cards/rate-cards.mjs +71 -0
  91. package/resources/v1/contracts/rate-cards/rate-cards.mjs.map +1 -1
  92. package/resources/v1/contracts/rate-cards/rates.d.ts +102 -14
  93. package/resources/v1/contracts/rate-cards/rates.d.ts.map +1 -1
  94. package/resources/v1/contracts/rate-cards/rates.js +68 -0
  95. package/resources/v1/contracts/rate-cards/rates.js.map +1 -1
  96. package/resources/v1/contracts/rate-cards/rates.mjs +68 -0
  97. package/resources/v1/contracts/rate-cards/rates.mjs.map +1 -1
  98. package/resources/v1/credit-grants.d.ts +77 -2
  99. package/resources/v1/credit-grants.d.ts.map +1 -1
  100. package/resources/v1/credit-grants.js +39 -2
  101. package/resources/v1/credit-grants.js.map +1 -1
  102. package/resources/v1/credit-grants.mjs +39 -2
  103. package/resources/v1/credit-grants.mjs.map +1 -1
  104. package/resources/v1/custom-fields.d.ts +51 -7
  105. package/resources/v1/custom-fields.d.ts.map +1 -1
  106. package/resources/v1/custom-fields.js +35 -0
  107. package/resources/v1/custom-fields.js.map +1 -1
  108. package/resources/v1/custom-fields.mjs +35 -0
  109. package/resources/v1/custom-fields.mjs.map +1 -1
  110. package/resources/v1/customers/alerts.d.ts +37 -0
  111. package/resources/v1/customers/alerts.d.ts.map +1 -1
  112. package/resources/v1/customers/alerts.js +23 -0
  113. package/resources/v1/customers/alerts.js.map +1 -1
  114. package/resources/v1/customers/alerts.mjs +23 -0
  115. package/resources/v1/customers/alerts.mjs.map +1 -1
  116. package/resources/v1/customers/billing-config.d.ts +31 -0
  117. package/resources/v1/customers/billing-config.d.ts.map +1 -1
  118. package/resources/v1/customers/billing-config.js +27 -0
  119. package/resources/v1/customers/billing-config.js.map +1 -1
  120. package/resources/v1/customers/billing-config.mjs +27 -0
  121. package/resources/v1/customers/billing-config.mjs.map +1 -1
  122. package/resources/v1/customers/commits.d.ts +94 -7
  123. package/resources/v1/customers/commits.d.ts.map +1 -1
  124. package/resources/v1/customers/commits.js +56 -1
  125. package/resources/v1/customers/commits.js.map +1 -1
  126. package/resources/v1/customers/commits.mjs +56 -1
  127. package/resources/v1/customers/commits.mjs.map +1 -1
  128. package/resources/v1/customers/credits.d.ts +73 -3
  129. package/resources/v1/customers/credits.d.ts.map +1 -1
  130. package/resources/v1/customers/credits.js +41 -1
  131. package/resources/v1/customers/credits.js.map +1 -1
  132. package/resources/v1/customers/credits.mjs +41 -1
  133. package/resources/v1/customers/credits.mjs.map +1 -1
  134. package/resources/v1/customers/customers.d.ts +186 -9
  135. package/resources/v1/customers/customers.d.ts.map +1 -1
  136. package/resources/v1/customers/customers.js +106 -1
  137. package/resources/v1/customers/customers.js.map +1 -1
  138. package/resources/v1/customers/customers.mjs +106 -1
  139. package/resources/v1/customers/customers.mjs.map +1 -1
  140. package/resources/v1/customers/index.d.ts +1 -1
  141. package/resources/v1/customers/index.d.ts.map +1 -1
  142. package/resources/v1/customers/index.js.map +1 -1
  143. package/resources/v1/customers/index.mjs.map +1 -1
  144. package/resources/v1/customers/invoices.d.ts +144 -52
  145. package/resources/v1/customers/invoices.d.ts.map +1 -1
  146. package/resources/v1/customers/invoices.js +49 -0
  147. package/resources/v1/customers/invoices.js.map +1 -1
  148. package/resources/v1/customers/invoices.mjs +49 -0
  149. package/resources/v1/customers/invoices.mjs.map +1 -1
  150. package/resources/v1/customers/named-schedules.d.ts +21 -0
  151. package/resources/v1/customers/named-schedules.d.ts.map +1 -1
  152. package/resources/v1/customers/named-schedules.js +21 -0
  153. package/resources/v1/customers/named-schedules.js.map +1 -1
  154. package/resources/v1/customers/named-schedules.mjs +21 -0
  155. package/resources/v1/customers/named-schedules.mjs.map +1 -1
  156. package/resources/v1/customers/plans.d.ts +46 -1
  157. package/resources/v1/customers/plans.d.ts.map +1 -1
  158. package/resources/v1/customers/plans.js +43 -0
  159. package/resources/v1/customers/plans.js.map +1 -1
  160. package/resources/v1/customers/plans.mjs +43 -0
  161. package/resources/v1/customers/plans.mjs.map +1 -1
  162. package/resources/v1/dashboards.d.ts +31 -3
  163. package/resources/v1/dashboards.d.ts.map +1 -1
  164. package/resources/v1/dashboards.js +26 -0
  165. package/resources/v1/dashboards.js.map +1 -1
  166. package/resources/v1/dashboards.mjs +26 -0
  167. package/resources/v1/dashboards.mjs.map +1 -1
  168. package/resources/v1/index.d.ts +3 -3
  169. package/resources/v1/index.d.ts.map +1 -1
  170. package/resources/v1/index.js.map +1 -1
  171. package/resources/v1/index.mjs.map +1 -1
  172. package/resources/v1/invoices.d.ts +14 -0
  173. package/resources/v1/invoices.d.ts.map +1 -1
  174. package/resources/v1/invoices.js +14 -0
  175. package/resources/v1/invoices.js.map +1 -1
  176. package/resources/v1/invoices.mjs +14 -0
  177. package/resources/v1/invoices.mjs.map +1 -1
  178. package/resources/v1/plans.d.ts +47 -4
  179. package/resources/v1/plans.d.ts.map +1 -1
  180. package/resources/v1/plans.js +27 -0
  181. package/resources/v1/plans.js.map +1 -1
  182. package/resources/v1/plans.mjs +27 -0
  183. package/resources/v1/plans.mjs.map +1 -1
  184. package/resources/v1/pricing-units.d.ts +8 -0
  185. package/resources/v1/pricing-units.d.ts.map +1 -1
  186. package/resources/v1/pricing-units.js.map +1 -1
  187. package/resources/v1/pricing-units.mjs.map +1 -1
  188. package/resources/v1/services.d.ts +5 -0
  189. package/resources/v1/services.d.ts.map +1 -1
  190. package/resources/v1/services.js +5 -0
  191. package/resources/v1/services.js.map +1 -1
  192. package/resources/v1/services.mjs +5 -0
  193. package/resources/v1/services.mjs.map +1 -1
  194. package/resources/v1/usage.d.ts +161 -3
  195. package/resources/v1/usage.d.ts.map +1 -1
  196. package/resources/v1/usage.js +46 -0
  197. package/resources/v1/usage.js.map +1 -1
  198. package/resources/v1/usage.mjs +46 -0
  199. package/resources/v1/usage.mjs.map +1 -1
  200. package/resources/v1/v1.d.ts +6 -6
  201. package/resources/v1/v1.d.ts.map +1 -1
  202. package/resources/v1/v1.js.map +1 -1
  203. package/resources/v1/v1.mjs.map +1 -1
  204. package/resources/v2/contracts.d.ts +3241 -205
  205. package/resources/v2/contracts.d.ts.map +1 -1
  206. package/resources/v2/contracts.js +90 -2
  207. package/resources/v2/contracts.js.map +1 -1
  208. package/resources/v2/contracts.mjs +90 -2
  209. package/resources/v2/contracts.mjs.map +1 -1
  210. package/resources/webhooks.js +5 -5
  211. package/resources/webhooks.js.map +1 -1
  212. package/resources/webhooks.mjs +5 -5
  213. package/resources/webhooks.mjs.map +1 -1
  214. package/src/_shims/auto/runtime-bun.ts +1 -1
  215. package/src/_shims/auto/runtime-node.ts +1 -1
  216. package/src/_shims/auto/runtime.ts +1 -1
  217. package/src/_shims/auto/types-node.ts +1 -1
  218. package/src/_shims/bun-runtime.ts +2 -2
  219. package/src/_shims/index.d.ts +5 -3
  220. package/src/_shims/index.js +5 -1
  221. package/src/_shims/index.mjs +6 -2
  222. package/src/_shims/node-runtime.ts +3 -3
  223. package/src/_shims/registry.ts +1 -1
  224. package/src/_shims/web-runtime.ts +3 -3
  225. package/src/core.ts +46 -18
  226. package/src/error.ts +1 -1
  227. package/src/index.ts +22 -16
  228. package/src/internal/qs/formats.ts +1 -1
  229. package/src/internal/qs/index.ts +3 -3
  230. package/src/internal/qs/stringify.ts +3 -3
  231. package/src/internal/qs/utils.ts +2 -2
  232. package/src/pagination.ts +5 -1
  233. package/src/resource.ts +2 -2
  234. package/src/resources/index.ts +4 -4
  235. package/src/resources/shared.ts +605 -40
  236. package/src/resources/v1/alerts.ts +33 -13
  237. package/src/resources/v1/audit-logs.ts +12 -4
  238. package/src/resources/v1/billable-metrics.ts +57 -8
  239. package/src/resources/v1/contracts/contracts.ts +1723 -135
  240. package/src/resources/v1/contracts/index.ts +8 -4
  241. package/src/resources/v1/contracts/named-schedules.ts +23 -2
  242. package/src/resources/v1/contracts/products.ts +53 -9
  243. package/src/resources/v1/contracts/rate-cards/index.ts +6 -4
  244. package/src/resources/v1/contracts/rate-cards/named-schedules.ts +27 -2
  245. package/src/resources/v1/contracts/rate-cards/product-orders.ts +33 -3
  246. package/src/resources/v1/contracts/rate-cards/rate-cards.ts +113 -20
  247. package/src/resources/v1/contracts/rate-cards/rates.ts +86 -18
  248. package/src/resources/v1/contracts/rate-cards.ts +1 -1
  249. package/src/resources/v1/contracts.ts +1 -1
  250. package/src/resources/v1/credit-grants.ts +82 -10
  251. package/src/resources/v1/custom-fields.ts +57 -9
  252. package/src/resources/v1/customers/alerts.ts +44 -3
  253. package/src/resources/v1/customers/billing-config.ts +34 -2
  254. package/src/resources/v1/customers/commits.ts +97 -10
  255. package/src/resources/v1/customers/credits.ts +76 -6
  256. package/src/resources/v1/customers/customers.ts +208 -27
  257. package/src/resources/v1/customers/index.ts +10 -8
  258. package/src/resources/v1/customers/invoices.ts +123 -57
  259. package/src/resources/v1/customers/named-schedules.ts +23 -2
  260. package/src/resources/v1/customers/plans.ts +48 -5
  261. package/src/resources/v1/customers.ts +1 -1
  262. package/src/resources/v1/dashboards.ts +33 -5
  263. package/src/resources/v1/index.ts +20 -14
  264. package/src/resources/v1/invoices.ts +16 -2
  265. package/src/resources/v1/plans.ts +45 -10
  266. package/src/resources/v1/pricing-units.ts +12 -4
  267. package/src/resources/v1/services.ts +7 -2
  268. package/src/resources/v1/usage.ts +187 -6
  269. package/src/resources/v1/v1.ts +39 -27
  270. package/src/resources/v1.ts +1 -1
  271. package/src/resources/v2/contracts.ts +3838 -261
  272. package/src/resources/v2/index.ts +2 -2
  273. package/src/resources/v2/v2.ts +3 -3
  274. package/src/resources/v2.ts +1 -1
  275. package/src/resources/webhooks.ts +7 -7
  276. package/src/resources.ts +1 -1
  277. package/src/shims/node.ts +3 -3
  278. package/src/shims/web.ts +3 -3
  279. package/src/uploads.ts +4 -4
  280. package/src/version.ts +1 -1
  281. package/version.d.ts +1 -1
  282. package/version.d.ts.map +1 -1
  283. package/version.js +1 -1
  284. package/version.js.map +1 -1
  285. package/version.mjs +1 -1
  286. package/version.mjs.map +1 -1
@@ -1,16 +1,16 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- import { APIResource } from '../../../resource';
4
- import * as Core from '../../../core';
5
- import * as Shared from '../../shared';
6
- import * as NamedSchedulesAPI from './named-schedules';
3
+ import { APIResource } from "../../../resource.js";
4
+ import * as Core from "../../../core.js";
5
+ import * as Shared from "../../shared.js";
6
+ import * as NamedSchedulesAPI from "./named-schedules.js";
7
7
  import {
8
8
  NamedScheduleRetrieveParams,
9
9
  NamedScheduleRetrieveResponse,
10
10
  NamedScheduleUpdateParams,
11
11
  NamedSchedules,
12
- } from './named-schedules';
13
- import * as ProductsAPI from './products';
12
+ } from "./named-schedules.js";
13
+ import * as ProductsAPI from "./products.js";
14
14
  import {
15
15
  ProductArchiveParams,
16
16
  ProductArchiveResponse,
@@ -27,10 +27,12 @@ import {
27
27
  Products,
28
28
  QuantityConversion,
29
29
  QuantityRounding,
30
- } from './products';
31
- import * as InvoicesAPI from '../customers/invoices';
32
- import * as RateCardsAPI from './rate-cards/rate-cards';
30
+ } from "./products.js";
31
+ import * as InvoicesAPI from "../customers/invoices.js";
32
+ import * as RateCardsAPI from "./rate-cards/rate-cards.js";
33
33
  import {
34
+ RateCardArchiveParams,
35
+ RateCardArchiveResponse,
34
36
  RateCardCreateParams,
35
37
  RateCardCreateResponse,
36
38
  RateCardListParams,
@@ -43,7 +45,7 @@ import {
43
45
  RateCardUpdateParams,
44
46
  RateCardUpdateResponse,
45
47
  RateCards,
46
- } from './rate-cards/rate-cards';
48
+ } from "./rate-cards/rate-cards.js";
47
49
 
48
50
  export class Contracts extends APIResource {
49
51
  products: ProductsAPI.Products = new ProductsAPI.Products(this._client);
@@ -52,13 +54,35 @@ export class Contracts extends APIResource {
52
54
 
53
55
  /**
54
56
  * Create a new contract
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const contract = await client.v1.contracts.create({
61
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
62
+ * starting_at: '2020-01-01T00:00:00.000Z',
63
+ * billing_provider_configuration: {
64
+ * billing_provider: 'stripe',
65
+ * delivery_method: 'direct_to_billing_provider',
66
+ * },
67
+ * rate_card_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
68
+ * });
69
+ * ```
55
70
  */
56
71
  create(body: ContractCreateParams, options?: Core.RequestOptions): Core.APIPromise<ContractCreateResponse> {
57
72
  return this._client.post('/v1/contracts/create', { body, ...options });
58
73
  }
59
74
 
60
75
  /**
61
- * Get a specific contract
76
+ * This is the v1 endpoint to get a contract. New clients should implement using
77
+ * the v2 endpoint.
78
+ *
79
+ * @example
80
+ * ```ts
81
+ * const contract = await client.v1.contracts.retrieve({
82
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
83
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
84
+ * });
85
+ * ```
62
86
  */
63
87
  retrieve(
64
88
  body: ContractRetrieveParams,
@@ -68,7 +92,15 @@ export class Contracts extends APIResource {
68
92
  }
69
93
 
70
94
  /**
71
- * List all contracts for a customer
95
+ * This is the v1 endpoint to list all contracts for a customer. New clients should
96
+ * implement using the v2 endpoint.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const contracts = await client.v1.contracts.list({
101
+ * customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
102
+ * });
103
+ * ```
72
104
  */
73
105
  list(body: ContractListParams, options?: Core.RequestOptions): Core.APIPromise<ContractListResponse> {
74
106
  return this._client.post('/v1/contracts/list', { body, ...options });
@@ -76,6 +108,18 @@ export class Contracts extends APIResource {
76
108
 
77
109
  /**
78
110
  * Add a manual balance entry
111
+ *
112
+ * @example
113
+ * ```ts
114
+ * await client.v1.contracts.addManualBalanceEntry({
115
+ * id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
116
+ * amount: -1000,
117
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
118
+ * reason: 'Reason for entry',
119
+ * segment_id: '66368e29-3f97-4d15-a6e9-120897f0070a',
120
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
121
+ * });
122
+ * ```
79
123
  */
80
124
  addManualBalanceEntry(
81
125
  body: ContractAddManualBalanceEntryParams,
@@ -89,7 +133,20 @@ export class Contracts extends APIResource {
89
133
  }
90
134
 
91
135
  /**
92
- * Amend a contract
136
+ * Amendments will be replaced by Contract editing. New clients should implement
137
+ * using the editContract endpoint. Read more about the migration to contract
138
+ * editing [here](https://docs.metronome.com/migrate-amendments-to-edits/) and
139
+ * reach out to your Metronome representative for more details. Once contract
140
+ * editing is enabled, access to this endpoint will be removed.
141
+ *
142
+ * @example
143
+ * ```ts
144
+ * const response = await client.v1.contracts.amend({
145
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
146
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
147
+ * starting_at: '2020-01-01T00:00:00.000Z',
148
+ * });
149
+ * ```
93
150
  */
94
151
  amend(body: ContractAmendParams, options?: Core.RequestOptions): Core.APIPromise<ContractAmendResponse> {
95
152
  return this._client.post('/v1/contracts/amend', { body, ...options });
@@ -97,6 +154,15 @@ export class Contracts extends APIResource {
97
154
 
98
155
  /**
99
156
  * Archive a contract
157
+ *
158
+ * @example
159
+ * ```ts
160
+ * const response = await client.v1.contracts.archive({
161
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
162
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
163
+ * void_invoices: true,
164
+ * });
165
+ * ```
100
166
  */
101
167
  archive(
102
168
  body: ContractArchiveParams,
@@ -107,6 +173,35 @@ export class Contracts extends APIResource {
107
173
 
108
174
  /**
109
175
  * Creates historical usage invoices for a contract
176
+ *
177
+ * @example
178
+ * ```ts
179
+ * const response =
180
+ * await client.v1.contracts.createHistoricalInvoices({
181
+ * invoices: [
182
+ * {
183
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
184
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
185
+ * credit_type_id:
186
+ * '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
187
+ * inclusive_start_date: '2020-01-01T00:00:00.000Z',
188
+ * exclusive_end_date: '2020-02-01T00:00:00.000Z',
189
+ * issue_date: '2020-02-01T00:00:00.000Z',
190
+ * usage_line_items: [
191
+ * {
192
+ * product_id:
193
+ * 'f14d6729-6a44-4b13-9908-9387f1918790',
194
+ * inclusive_start_date:
195
+ * '2020-01-01T00:00:00.000Z',
196
+ * exclusive_end_date: '2020-02-01T00:00:00.000Z',
197
+ * quantity: 100,
198
+ * },
199
+ * ],
200
+ * },
201
+ * ],
202
+ * preview: false,
203
+ * });
204
+ * ```
110
205
  */
111
206
  createHistoricalInvoices(
112
207
  body: ContractCreateHistoricalInvoicesParams,
@@ -117,6 +212,15 @@ export class Contracts extends APIResource {
117
212
 
118
213
  /**
119
214
  * List balances (commits and credits).
215
+ *
216
+ * @example
217
+ * ```ts
218
+ * const response = await client.v1.contracts.listBalances({
219
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
220
+ * id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
221
+ * include_ledgers: true,
222
+ * });
223
+ * ```
120
224
  */
121
225
  listBalances(
122
226
  body: ContractListBalancesParams,
@@ -127,6 +231,25 @@ export class Contracts extends APIResource {
127
231
 
128
232
  /**
129
233
  * Get the rate schedule for the rate card on a given contract.
234
+ *
235
+ * @example
236
+ * ```ts
237
+ * const response =
238
+ * await client.v1.contracts.retrieveRateSchedule({
239
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
240
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
241
+ * at: '2020-01-01T00:00:00.000Z',
242
+ * selectors: [
243
+ * {
244
+ * product_id: 'd6300dbb-882e-4d2d-8dec-5125d16b65d0',
245
+ * partial_pricing_group_values: {
246
+ * region: 'us-west-2',
247
+ * cloud: 'aws',
248
+ * },
249
+ * },
250
+ * ],
251
+ * });
252
+ * ```
130
253
  */
131
254
  retrieveRateSchedule(
132
255
  params: ContractRetrieveRateScheduleParams,
@@ -140,9 +263,49 @@ export class Contracts extends APIResource {
140
263
  });
141
264
  }
142
265
 
266
+ /**
267
+ * Fetch the quantity and price for a subscription over time. End-point does not
268
+ * return future scheduled changes.
269
+ *
270
+ * @example
271
+ * ```ts
272
+ * const response =
273
+ * await client.v1.contracts.retrieveSubscriptionQuantityHistory(
274
+ * {
275
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
276
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
277
+ * subscription_id:
278
+ * '1a824d53-bde6-4d82-96d7-6347ff227d5c',
279
+ * },
280
+ * );
281
+ * ```
282
+ */
283
+ retrieveSubscriptionQuantityHistory(
284
+ body: ContractRetrieveSubscriptionQuantityHistoryParams,
285
+ options?: Core.RequestOptions,
286
+ ): Core.APIPromise<ContractRetrieveSubscriptionQuantityHistoryResponse> {
287
+ return this._client.post('/v1/contracts/getSubscriptionQuantityHistory', { body, ...options });
288
+ }
289
+
143
290
  /**
144
291
  * Create a new scheduled invoice for Professional Services terms on a contract.
145
292
  * This endpoint's availability is dependent on your client's configuration.
293
+ *
294
+ * @example
295
+ * ```ts
296
+ * const response =
297
+ * await client.v1.contracts.scheduleProServicesInvoice({
298
+ * contract_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
299
+ * customer_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
300
+ * issued_at: '2019-12-27T18:11:19.117Z',
301
+ * line_items: [
302
+ * {
303
+ * professional_service_id:
304
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
305
+ * },
306
+ * ],
307
+ * });
308
+ * ```
146
309
  */
147
310
  scheduleProServicesInvoice(
148
311
  body: ContractScheduleProServicesInvoiceParams,
@@ -153,6 +316,17 @@ export class Contracts extends APIResource {
153
316
 
154
317
  /**
155
318
  * Set usage filter for a contract
319
+ *
320
+ * @example
321
+ * ```ts
322
+ * await client.v1.contracts.setUsageFilter({
323
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
324
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
325
+ * group_key: 'business_subscription_id',
326
+ * group_values: ['ID-1', 'ID-2'],
327
+ * starting_at: '2020-01-01T00:00:00.000Z',
328
+ * });
329
+ * ```
156
330
  */
157
331
  setUsageFilter(body: ContractSetUsageFilterParams, options?: Core.RequestOptions): Core.APIPromise<void> {
158
332
  return this._client.post('/v1/contracts/setUsageFilter', {
@@ -164,6 +338,15 @@ export class Contracts extends APIResource {
164
338
 
165
339
  /**
166
340
  * Update the end date of a contract
341
+ *
342
+ * @example
343
+ * ```ts
344
+ * const response = await client.v1.contracts.updateEndDate({
345
+ * contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
346
+ * customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
347
+ * ending_before: '2020-01-01T00:00:00.000Z',
348
+ * });
349
+ * ```
167
350
  */
168
351
  updateEndDate(
169
352
  body: ContractUpdateEndDateParams,
@@ -199,13 +382,20 @@ export namespace ContractRetrieveResponse {
199
382
  */
200
383
  archived_at?: string;
201
384
 
202
- custom_fields?: Record<string, string>;
385
+ custom_fields?: { [key: string]: string };
203
386
 
204
387
  /**
205
388
  * The billing provider configuration associated with a contract.
206
389
  */
207
390
  customer_billing_provider_configuration?: Data.CustomerBillingProviderConfiguration;
208
391
 
392
+ prepaid_balance_threshold_configuration?: Data.PrepaidBalanceThresholdConfiguration;
393
+
394
+ /**
395
+ * Priority of the contract.
396
+ */
397
+ priority?: number;
398
+
209
399
  /**
210
400
  * Determines which scheduled and commit charges to consolidate onto the Contract's
211
401
  * usage invoice. The charge's `timestamp` must match the usage invoice's
@@ -215,6 +405,11 @@ export namespace ContractRetrieveResponse {
215
405
  */
216
406
  scheduled_charges_on_usage_invoices?: 'ALL';
217
407
 
408
+ spend_threshold_configuration?: Data.SpendThresholdConfiguration;
409
+
410
+ /**
411
+ * List of subscriptions on the contract.
412
+ */
218
413
  subscriptions?: Array<Data.Subscription>;
219
414
 
220
415
  /**
@@ -317,7 +512,257 @@ export namespace ContractRetrieveResponse {
317
512
  * Configuration for the billing provider. The structure of this object is specific
318
513
  * to the billing provider.
319
514
  */
320
- configuration?: Record<string, unknown>;
515
+ configuration?: { [key: string]: unknown };
516
+ }
517
+
518
+ export interface PrepaidBalanceThresholdConfiguration {
519
+ commit: PrepaidBalanceThresholdConfiguration.Commit;
520
+
521
+ /**
522
+ * When set to false, the contract will not be evaluated against the
523
+ * threshold_amount. Toggling to true will result an immediate evaluation,
524
+ * regardless of prior state.
525
+ */
526
+ is_enabled: boolean;
527
+
528
+ payment_gate_config: PrepaidBalanceThresholdConfiguration.PaymentGateConfig;
529
+
530
+ /**
531
+ * Specify the amount the balance should be recharged to.
532
+ */
533
+ recharge_to_amount: number;
534
+
535
+ /**
536
+ * Specify the threshold amount for the contract. Each time the contract's prepaid
537
+ * balance lowers to this amount, a threshold charge will be initiated.
538
+ */
539
+ threshold_amount: number;
540
+
541
+ /**
542
+ * If provided, the threshold, recharge-to amount, and the resulting threshold
543
+ * commit amount will be in terms of this credit type instead of the fiat currency.
544
+ */
545
+ custom_credit_type_id?: string;
546
+ }
547
+
548
+ export namespace PrepaidBalanceThresholdConfiguration {
549
+ export interface Commit {
550
+ /**
551
+ * The commit product that will be used to generate the line item for commit
552
+ * payment.
553
+ */
554
+ product_id: string;
555
+
556
+ /**
557
+ * Which products the threshold commit applies to. If applicable_product_ids,
558
+ * applicable_product_tags or specifiers are not provided, the commit applies to
559
+ * all products.
560
+ */
561
+ applicable_product_ids?: Array<string>;
562
+
563
+ /**
564
+ * Which tags the threshold commit applies to. If applicable_product_ids,
565
+ * applicable_product_tags or specifiers are not provided, the commit applies to
566
+ * all products.
567
+ */
568
+ applicable_product_tags?: Array<string>;
569
+
570
+ description?: string;
571
+
572
+ /**
573
+ * Specify the name of the line item for the threshold charge. If left blank, it
574
+ * will default to the commit product name.
575
+ */
576
+ name?: string;
577
+
578
+ /**
579
+ * List of filters that determine what kind of customer usage draws down a commit
580
+ * or credit. A customer's usage needs to meet the condition of at least one of the
581
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
582
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
583
+ */
584
+ specifiers?: Array<Commit.Specifier>;
585
+ }
586
+
587
+ export namespace Commit {
588
+ export interface Specifier {
589
+ presentation_group_values?: { [key: string]: string };
590
+
591
+ pricing_group_values?: { [key: string]: string };
592
+
593
+ /**
594
+ * If provided, the specifier will only apply to the product with the specified ID.
595
+ */
596
+ product_id?: string;
597
+
598
+ /**
599
+ * If provided, the specifier will only apply to products with all the specified
600
+ * tags.
601
+ */
602
+ product_tags?: Array<string>;
603
+ }
604
+ }
605
+
606
+ export interface PaymentGateConfig {
607
+ /**
608
+ * Gate access to the commit balance based on successful collection of payment.
609
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
610
+ * facilitate payment using your own payment integration. Select NONE if you do not
611
+ * wish to payment gate the commit balance.
612
+ */
613
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
614
+
615
+ /**
616
+ * Only applicable if using PRECALCULATED as your tax type.
617
+ */
618
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
619
+
620
+ /**
621
+ * Only applicable if using STRIPE as your payment gate type.
622
+ */
623
+ stripe_config?: PaymentGateConfig.StripeConfig;
624
+
625
+ /**
626
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
627
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
628
+ * will default to NONE.
629
+ */
630
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
631
+ }
632
+
633
+ export namespace PaymentGateConfig {
634
+ /**
635
+ * Only applicable if using PRECALCULATED as your tax type.
636
+ */
637
+ export interface PrecalculatedTaxConfig {
638
+ /**
639
+ * Amount of tax to be applied. This should be in the same currency and
640
+ * denomination as the commit's invoice schedule
641
+ */
642
+ tax_amount: number;
643
+
644
+ /**
645
+ * Name of the tax to be applied. This may be used in an invoice line item
646
+ * description.
647
+ */
648
+ tax_name?: string;
649
+ }
650
+
651
+ /**
652
+ * Only applicable if using STRIPE as your payment gate type.
653
+ */
654
+ export interface StripeConfig {
655
+ /**
656
+ * If left blank, will default to INVOICE
657
+ */
658
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
659
+
660
+ /**
661
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
662
+ * your payment type.
663
+ */
664
+ invoice_metadata?: { [key: string]: string };
665
+ }
666
+ }
667
+ }
668
+
669
+ export interface SpendThresholdConfiguration {
670
+ commit: SpendThresholdConfiguration.Commit;
671
+
672
+ /**
673
+ * When set to false, the contract will not be evaluated against the
674
+ * threshold_amount. Toggling to true will result an immediate evaluation,
675
+ * regardless of prior state.
676
+ */
677
+ is_enabled: boolean;
678
+
679
+ payment_gate_config: SpendThresholdConfiguration.PaymentGateConfig;
680
+
681
+ /**
682
+ * Specify the threshold amount for the contract. Each time the contract's usage
683
+ * hits this amount, a threshold charge will be initiated.
684
+ */
685
+ threshold_amount: number;
686
+ }
687
+
688
+ export namespace SpendThresholdConfiguration {
689
+ export interface Commit {
690
+ /**
691
+ * The commit product that will be used to generate the line item for commit
692
+ * payment.
693
+ */
694
+ product_id: string;
695
+
696
+ description?: string;
697
+
698
+ /**
699
+ * Specify the name of the line item for the threshold charge. If left blank, it
700
+ * will default to the commit product name.
701
+ */
702
+ name?: string;
703
+ }
704
+
705
+ export interface PaymentGateConfig {
706
+ /**
707
+ * Gate access to the commit balance based on successful collection of payment.
708
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
709
+ * facilitate payment using your own payment integration. Select NONE if you do not
710
+ * wish to payment gate the commit balance.
711
+ */
712
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
713
+
714
+ /**
715
+ * Only applicable if using PRECALCULATED as your tax type.
716
+ */
717
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
718
+
719
+ /**
720
+ * Only applicable if using STRIPE as your payment gate type.
721
+ */
722
+ stripe_config?: PaymentGateConfig.StripeConfig;
723
+
724
+ /**
725
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
726
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
727
+ * will default to NONE.
728
+ */
729
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
730
+ }
731
+
732
+ export namespace PaymentGateConfig {
733
+ /**
734
+ * Only applicable if using PRECALCULATED as your tax type.
735
+ */
736
+ export interface PrecalculatedTaxConfig {
737
+ /**
738
+ * Amount of tax to be applied. This should be in the same currency and
739
+ * denomination as the commit's invoice schedule
740
+ */
741
+ tax_amount: number;
742
+
743
+ /**
744
+ * Name of the tax to be applied. This may be used in an invoice line item
745
+ * description.
746
+ */
747
+ tax_name?: string;
748
+ }
749
+
750
+ /**
751
+ * Only applicable if using STRIPE as your payment gate type.
752
+ */
753
+ export interface StripeConfig {
754
+ /**
755
+ * If left blank, will default to INVOICE
756
+ */
757
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
758
+
759
+ /**
760
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
761
+ * your payment type.
762
+ */
763
+ invoice_metadata?: { [key: string]: string };
764
+ }
765
+ }
321
766
  }
322
767
 
323
768
  export interface Subscription {
@@ -325,16 +770,26 @@ export namespace ContractRetrieveResponse {
325
770
 
326
771
  proration: Subscription.Proration;
327
772
 
773
+ /**
774
+ * List of quantity schedule items for the subscription. Only includes the current
775
+ * quantity and future quantity changes.
776
+ */
328
777
  quantity_schedule: Array<Subscription.QuantitySchedule>;
329
778
 
330
779
  starting_at: string;
331
780
 
332
781
  subscription_rate: Subscription.SubscriptionRate;
333
782
 
783
+ id?: string;
784
+
785
+ custom_fields?: { [key: string]: string };
786
+
334
787
  description?: string;
335
788
 
336
789
  ending_before?: string;
337
790
 
791
+ fiat_credit_type_id?: string;
792
+
338
793
  name?: string;
339
794
  }
340
795
 
@@ -354,7 +809,7 @@ export namespace ContractRetrieveResponse {
354
809
  }
355
810
 
356
811
  export interface SubscriptionRate {
357
- billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
812
+ billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
358
813
 
359
814
  product: SubscriptionRate.Product;
360
815
  }
@@ -392,13 +847,20 @@ export namespace ContractListResponse {
392
847
  */
393
848
  archived_at?: string;
394
849
 
395
- custom_fields?: Record<string, string>;
850
+ custom_fields?: { [key: string]: string };
396
851
 
397
852
  /**
398
853
  * The billing provider configuration associated with a contract.
399
854
  */
400
855
  customer_billing_provider_configuration?: Data.CustomerBillingProviderConfiguration;
401
856
 
857
+ prepaid_balance_threshold_configuration?: Data.PrepaidBalanceThresholdConfiguration;
858
+
859
+ /**
860
+ * Priority of the contract.
861
+ */
862
+ priority?: number;
863
+
402
864
  /**
403
865
  * Determines which scheduled and commit charges to consolidate onto the Contract's
404
866
  * usage invoice. The charge's `timestamp` must match the usage invoice's
@@ -408,6 +870,11 @@ export namespace ContractListResponse {
408
870
  */
409
871
  scheduled_charges_on_usage_invoices?: 'ALL';
410
872
 
873
+ spend_threshold_configuration?: Data.SpendThresholdConfiguration;
874
+
875
+ /**
876
+ * List of subscriptions on the contract.
877
+ */
411
878
  subscriptions?: Array<Data.Subscription>;
412
879
 
413
880
  /**
@@ -510,7 +977,257 @@ export namespace ContractListResponse {
510
977
  * Configuration for the billing provider. The structure of this object is specific
511
978
  * to the billing provider.
512
979
  */
513
- configuration?: Record<string, unknown>;
980
+ configuration?: { [key: string]: unknown };
981
+ }
982
+
983
+ export interface PrepaidBalanceThresholdConfiguration {
984
+ commit: PrepaidBalanceThresholdConfiguration.Commit;
985
+
986
+ /**
987
+ * When set to false, the contract will not be evaluated against the
988
+ * threshold_amount. Toggling to true will result an immediate evaluation,
989
+ * regardless of prior state.
990
+ */
991
+ is_enabled: boolean;
992
+
993
+ payment_gate_config: PrepaidBalanceThresholdConfiguration.PaymentGateConfig;
994
+
995
+ /**
996
+ * Specify the amount the balance should be recharged to.
997
+ */
998
+ recharge_to_amount: number;
999
+
1000
+ /**
1001
+ * Specify the threshold amount for the contract. Each time the contract's prepaid
1002
+ * balance lowers to this amount, a threshold charge will be initiated.
1003
+ */
1004
+ threshold_amount: number;
1005
+
1006
+ /**
1007
+ * If provided, the threshold, recharge-to amount, and the resulting threshold
1008
+ * commit amount will be in terms of this credit type instead of the fiat currency.
1009
+ */
1010
+ custom_credit_type_id?: string;
1011
+ }
1012
+
1013
+ export namespace PrepaidBalanceThresholdConfiguration {
1014
+ export interface Commit {
1015
+ /**
1016
+ * The commit product that will be used to generate the line item for commit
1017
+ * payment.
1018
+ */
1019
+ product_id: string;
1020
+
1021
+ /**
1022
+ * Which products the threshold commit applies to. If applicable_product_ids,
1023
+ * applicable_product_tags or specifiers are not provided, the commit applies to
1024
+ * all products.
1025
+ */
1026
+ applicable_product_ids?: Array<string>;
1027
+
1028
+ /**
1029
+ * Which tags the threshold commit applies to. If applicable_product_ids,
1030
+ * applicable_product_tags or specifiers are not provided, the commit applies to
1031
+ * all products.
1032
+ */
1033
+ applicable_product_tags?: Array<string>;
1034
+
1035
+ description?: string;
1036
+
1037
+ /**
1038
+ * Specify the name of the line item for the threshold charge. If left blank, it
1039
+ * will default to the commit product name.
1040
+ */
1041
+ name?: string;
1042
+
1043
+ /**
1044
+ * List of filters that determine what kind of customer usage draws down a commit
1045
+ * or credit. A customer's usage needs to meet the condition of at least one of the
1046
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
1047
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
1048
+ */
1049
+ specifiers?: Array<Commit.Specifier>;
1050
+ }
1051
+
1052
+ export namespace Commit {
1053
+ export interface Specifier {
1054
+ presentation_group_values?: { [key: string]: string };
1055
+
1056
+ pricing_group_values?: { [key: string]: string };
1057
+
1058
+ /**
1059
+ * If provided, the specifier will only apply to the product with the specified ID.
1060
+ */
1061
+ product_id?: string;
1062
+
1063
+ /**
1064
+ * If provided, the specifier will only apply to products with all the specified
1065
+ * tags.
1066
+ */
1067
+ product_tags?: Array<string>;
1068
+ }
1069
+ }
1070
+
1071
+ export interface PaymentGateConfig {
1072
+ /**
1073
+ * Gate access to the commit balance based on successful collection of payment.
1074
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
1075
+ * facilitate payment using your own payment integration. Select NONE if you do not
1076
+ * wish to payment gate the commit balance.
1077
+ */
1078
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
1079
+
1080
+ /**
1081
+ * Only applicable if using PRECALCULATED as your tax type.
1082
+ */
1083
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
1084
+
1085
+ /**
1086
+ * Only applicable if using STRIPE as your payment gate type.
1087
+ */
1088
+ stripe_config?: PaymentGateConfig.StripeConfig;
1089
+
1090
+ /**
1091
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
1092
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
1093
+ * will default to NONE.
1094
+ */
1095
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
1096
+ }
1097
+
1098
+ export namespace PaymentGateConfig {
1099
+ /**
1100
+ * Only applicable if using PRECALCULATED as your tax type.
1101
+ */
1102
+ export interface PrecalculatedTaxConfig {
1103
+ /**
1104
+ * Amount of tax to be applied. This should be in the same currency and
1105
+ * denomination as the commit's invoice schedule
1106
+ */
1107
+ tax_amount: number;
1108
+
1109
+ /**
1110
+ * Name of the tax to be applied. This may be used in an invoice line item
1111
+ * description.
1112
+ */
1113
+ tax_name?: string;
1114
+ }
1115
+
1116
+ /**
1117
+ * Only applicable if using STRIPE as your payment gate type.
1118
+ */
1119
+ export interface StripeConfig {
1120
+ /**
1121
+ * If left blank, will default to INVOICE
1122
+ */
1123
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
1124
+
1125
+ /**
1126
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
1127
+ * your payment type.
1128
+ */
1129
+ invoice_metadata?: { [key: string]: string };
1130
+ }
1131
+ }
1132
+ }
1133
+
1134
+ export interface SpendThresholdConfiguration {
1135
+ commit: SpendThresholdConfiguration.Commit;
1136
+
1137
+ /**
1138
+ * When set to false, the contract will not be evaluated against the
1139
+ * threshold_amount. Toggling to true will result an immediate evaluation,
1140
+ * regardless of prior state.
1141
+ */
1142
+ is_enabled: boolean;
1143
+
1144
+ payment_gate_config: SpendThresholdConfiguration.PaymentGateConfig;
1145
+
1146
+ /**
1147
+ * Specify the threshold amount for the contract. Each time the contract's usage
1148
+ * hits this amount, a threshold charge will be initiated.
1149
+ */
1150
+ threshold_amount: number;
1151
+ }
1152
+
1153
+ export namespace SpendThresholdConfiguration {
1154
+ export interface Commit {
1155
+ /**
1156
+ * The commit product that will be used to generate the line item for commit
1157
+ * payment.
1158
+ */
1159
+ product_id: string;
1160
+
1161
+ description?: string;
1162
+
1163
+ /**
1164
+ * Specify the name of the line item for the threshold charge. If left blank, it
1165
+ * will default to the commit product name.
1166
+ */
1167
+ name?: string;
1168
+ }
1169
+
1170
+ export interface PaymentGateConfig {
1171
+ /**
1172
+ * Gate access to the commit balance based on successful collection of payment.
1173
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
1174
+ * facilitate payment using your own payment integration. Select NONE if you do not
1175
+ * wish to payment gate the commit balance.
1176
+ */
1177
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
1178
+
1179
+ /**
1180
+ * Only applicable if using PRECALCULATED as your tax type.
1181
+ */
1182
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
1183
+
1184
+ /**
1185
+ * Only applicable if using STRIPE as your payment gate type.
1186
+ */
1187
+ stripe_config?: PaymentGateConfig.StripeConfig;
1188
+
1189
+ /**
1190
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
1191
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
1192
+ * will default to NONE.
1193
+ */
1194
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
1195
+ }
1196
+
1197
+ export namespace PaymentGateConfig {
1198
+ /**
1199
+ * Only applicable if using PRECALCULATED as your tax type.
1200
+ */
1201
+ export interface PrecalculatedTaxConfig {
1202
+ /**
1203
+ * Amount of tax to be applied. This should be in the same currency and
1204
+ * denomination as the commit's invoice schedule
1205
+ */
1206
+ tax_amount: number;
1207
+
1208
+ /**
1209
+ * Name of the tax to be applied. This may be used in an invoice line item
1210
+ * description.
1211
+ */
1212
+ tax_name?: string;
1213
+ }
1214
+
1215
+ /**
1216
+ * Only applicable if using STRIPE as your payment gate type.
1217
+ */
1218
+ export interface StripeConfig {
1219
+ /**
1220
+ * If left blank, will default to INVOICE
1221
+ */
1222
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
1223
+
1224
+ /**
1225
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
1226
+ * your payment type.
1227
+ */
1228
+ invoice_metadata?: { [key: string]: string };
1229
+ }
1230
+ }
514
1231
  }
515
1232
 
516
1233
  export interface Subscription {
@@ -518,16 +1235,26 @@ export namespace ContractListResponse {
518
1235
 
519
1236
  proration: Subscription.Proration;
520
1237
 
1238
+ /**
1239
+ * List of quantity schedule items for the subscription. Only includes the current
1240
+ * quantity and future quantity changes.
1241
+ */
521
1242
  quantity_schedule: Array<Subscription.QuantitySchedule>;
522
1243
 
523
1244
  starting_at: string;
524
1245
 
525
1246
  subscription_rate: Subscription.SubscriptionRate;
526
1247
 
1248
+ id?: string;
1249
+
1250
+ custom_fields?: { [key: string]: string };
1251
+
527
1252
  description?: string;
528
1253
 
529
1254
  ending_before?: string;
530
1255
 
1256
+ fiat_credit_type_id?: string;
1257
+
531
1258
  name?: string;
532
1259
  }
533
1260
 
@@ -547,7 +1274,7 @@ export namespace ContractListResponse {
547
1274
  }
548
1275
 
549
1276
  export interface SubscriptionRate {
550
- billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
1277
+ billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
551
1278
 
552
1279
  product: SubscriptionRate.Product;
553
1280
  }
@@ -593,7 +1320,7 @@ export namespace ContractRetrieveRateScheduleResponse {
593
1320
 
594
1321
  list_rate: Shared.Rate;
595
1322
 
596
- product_custom_fields: Record<string, string>;
1323
+ product_custom_fields: { [key: string]: string };
597
1324
 
598
1325
  product_id: string;
599
1326
 
@@ -605,7 +1332,7 @@ export namespace ContractRetrieveRateScheduleResponse {
605
1332
 
606
1333
  starting_at: string;
607
1334
 
608
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
1335
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
609
1336
 
610
1337
  /**
611
1338
  * A distinct rate on the rate card. You can choose to use this rate rather than
@@ -617,7 +1344,7 @@ export namespace ContractRetrieveRateScheduleResponse {
617
1344
 
618
1345
  override_rate?: Shared.Rate;
619
1346
 
620
- pricing_group_values?: Record<string, string>;
1347
+ pricing_group_values?: { [key: string]: string };
621
1348
  }
622
1349
 
623
1350
  export namespace Data {
@@ -641,6 +1368,38 @@ export namespace ContractRetrieveRateScheduleResponse {
641
1368
  }
642
1369
  }
643
1370
 
1371
+ export interface ContractRetrieveSubscriptionQuantityHistoryResponse {
1372
+ data: ContractRetrieveSubscriptionQuantityHistoryResponse.Data;
1373
+ }
1374
+
1375
+ export namespace ContractRetrieveSubscriptionQuantityHistoryResponse {
1376
+ export interface Data {
1377
+ fiat_credit_type_id?: string;
1378
+
1379
+ history?: Array<Data.History>;
1380
+
1381
+ subscription_id?: string;
1382
+ }
1383
+
1384
+ export namespace Data {
1385
+ export interface History {
1386
+ data: Array<History.Data>;
1387
+
1388
+ starting_at: string;
1389
+ }
1390
+
1391
+ export namespace History {
1392
+ export interface Data {
1393
+ quantity: number;
1394
+
1395
+ total: number;
1396
+
1397
+ unit_price: number;
1398
+ }
1399
+ }
1400
+ }
1401
+ }
1402
+
644
1403
  export interface ContractScheduleProServicesInvoiceResponse {
645
1404
  data: Array<InvoicesAPI.Invoice>;
646
1405
  }
@@ -658,7 +1417,8 @@ export interface ContractCreateParams {
658
1417
  starting_at: string;
659
1418
 
660
1419
  /**
661
- * The billing provider configuration associated with a contract.
1420
+ * The billing provider configuration associated with a contract. Provide either an
1421
+ * ID or the provider and delivery method.
662
1422
  */
663
1423
  billing_provider_configuration?: ContractCreateParams.BillingProviderConfiguration;
664
1424
 
@@ -666,7 +1426,7 @@ export interface ContractCreateParams {
666
1426
 
667
1427
  credits?: Array<ContractCreateParams.Credit>;
668
1428
 
669
- custom_fields?: Record<string, string>;
1429
+ custom_fields?: { [key: string]: string };
670
1430
 
671
1431
  /**
672
1432
  * This field's availability is dependent on your client's configuration.
@@ -678,6 +1438,8 @@ export interface ContractCreateParams {
678
1438
  */
679
1439
  ending_before?: string;
680
1440
 
1441
+ hierarchy_configuration?: ContractCreateParams.HierarchyConfiguration;
1442
+
681
1443
  /**
682
1444
  * Defaults to LOWEST_MULTIPLIER, which applies the greatest discount to list
683
1445
  * prices automatically. EXPLICIT prioritization requires specifying priorities for
@@ -697,6 +1459,13 @@ export interface ContractCreateParams {
697
1459
 
698
1460
  overrides?: Array<ContractCreateParams.Override>;
699
1461
 
1462
+ prepaid_balance_threshold_configuration?: ContractCreateParams.PrepaidBalanceThresholdConfiguration;
1463
+
1464
+ /**
1465
+ * Priority of the contract.
1466
+ */
1467
+ priority?: number;
1468
+
700
1469
  /**
701
1470
  * This field's availability is dependent on your client's configuration.
702
1471
  */
@@ -735,9 +1504,14 @@ export interface ContractCreateParams {
735
1504
  */
736
1505
  scheduled_charges_on_usage_invoices?: 'ALL';
737
1506
 
738
- subscriptions?: Array<ContractCreateParams.Subscription>;
1507
+ spend_threshold_configuration?: ContractCreateParams.SpendThresholdConfiguration;
739
1508
 
740
- threshold_billing_configuration?: ContractCreateParams.ThresholdBillingConfiguration;
1509
+ /**
1510
+ * Optional list of
1511
+ * [subscriptions](https://docs.metronome.com/manage-product-access/create-subscription/)
1512
+ * to add to the contract.
1513
+ */
1514
+ subscriptions?: Array<ContractCreateParams.Subscription>;
741
1515
 
742
1516
  /**
743
1517
  * This field's availability is dependent on your client's configuration.
@@ -760,16 +1534,25 @@ export interface ContractCreateParams {
760
1534
 
761
1535
  export namespace ContractCreateParams {
762
1536
  /**
763
- * The billing provider configuration associated with a contract.
1537
+ * The billing provider configuration associated with a contract. Provide either an
1538
+ * ID or the provider and delivery method.
764
1539
  */
765
1540
  export interface BillingProviderConfiguration {
1541
+ /**
1542
+ * Do not specify if using billing_provider_configuration_id.
1543
+ */
766
1544
  billing_provider?: 'aws_marketplace' | 'azure_marketplace' | 'gcp_marketplace' | 'stripe' | 'netsuite';
767
1545
 
768
1546
  /**
769
- * The Metronome ID of the billing provider configuration
1547
+ * The Metronome ID of the billing provider configuration. Use when a customer has
1548
+ * multiple configurations with the same billing provider and delivery method.
1549
+ * Otherwise, specify the billing_provider and delivery_method.
770
1550
  */
771
1551
  billing_provider_configuration_id?: string;
772
1552
 
1553
+ /**
1554
+ * Do not specify if using billing_provider_configuration_id.
1555
+ */
773
1556
  delivery_method?: 'direct_to_billing_provider' | 'aws_sqs' | 'tackle' | 'aws_sns';
774
1557
  }
775
1558
 
@@ -791,24 +1574,31 @@ export namespace ContractCreateParams {
791
1574
  amount?: number;
792
1575
 
793
1576
  /**
794
- * Which products the commit applies to. If both applicable_product_ids and
795
- * applicable_product_tags are not provided, the commit applies to all products.
1577
+ * Which products the commit applies to. If applicable_product_ids,
1578
+ * applicable_product_tags or specifiers are not provided, the commit applies to
1579
+ * all products.
796
1580
  */
797
1581
  applicable_product_ids?: Array<string>;
798
1582
 
799
1583
  /**
800
- * Which tags the commit applies to. If both applicable_product_ids and
801
- * applicable_product_tags are not provided, the commit applies to all products.
1584
+ * Which tags the commit applies to. If applicable_product_ids,
1585
+ * applicable_product_tags or specifiers are not provided, the commit applies to
1586
+ * all products.
802
1587
  */
803
1588
  applicable_product_tags?: Array<string>;
804
1589
 
805
- custom_fields?: Record<string, string>;
1590
+ custom_fields?: { [key: string]: string };
806
1591
 
807
1592
  /**
808
1593
  * Used only in UI/API. It is not exposed to end customers.
809
1594
  */
810
1595
  description?: string;
811
1596
 
1597
+ /**
1598
+ * Optional configuration for commit hierarchy access control
1599
+ */
1600
+ hierarchy_configuration?: Commit.HierarchyConfiguration;
1601
+
812
1602
  /**
813
1603
  * Required for "POSTPAID" commits: the true up invoice will be generated at this
814
1604
  * time and only one schedule item is allowed; the total must match access_schedule
@@ -827,6 +1617,11 @@ export namespace ContractCreateParams {
827
1617
  */
828
1618
  netsuite_sales_order_id?: string;
829
1619
 
1620
+ /**
1621
+ * optionally payment gate this commit
1622
+ */
1623
+ payment_gate_config?: Commit.PaymentGateConfig;
1624
+
830
1625
  /**
831
1626
  * If multiple commits are applicable, the one with the lower priority will apply
832
1627
  * first.
@@ -840,6 +1635,14 @@ export namespace ContractCreateParams {
840
1635
  */
841
1636
  rollover_fraction?: number;
842
1637
 
1638
+ /**
1639
+ * List of filters that determine what kind of customer usage draws down a commit
1640
+ * or credit. A customer's usage needs to meet the condition of at least one of the
1641
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
1642
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
1643
+ */
1644
+ specifiers?: Array<Commit.Specifier>;
1645
+
843
1646
  /**
844
1647
  * A temporary ID for the commit that can be used to reference the commit for
845
1648
  * commit specific overrides.
@@ -878,6 +1681,32 @@ export namespace ContractCreateParams {
878
1681
  }
879
1682
  }
880
1683
 
1684
+ /**
1685
+ * Optional configuration for commit hierarchy access control
1686
+ */
1687
+ export interface HierarchyConfiguration {
1688
+ child_access:
1689
+ | HierarchyConfiguration.CommitHierarchyChildAccessAll
1690
+ | HierarchyConfiguration.CommitHierarchyChildAccessNone
1691
+ | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
1692
+ }
1693
+
1694
+ export namespace HierarchyConfiguration {
1695
+ export interface CommitHierarchyChildAccessAll {
1696
+ type: 'ALL';
1697
+ }
1698
+
1699
+ export interface CommitHierarchyChildAccessNone {
1700
+ type: 'NONE';
1701
+ }
1702
+
1703
+ export interface CommitHierarchyChildAccessContractIDs {
1704
+ contract_ids: Array<string>;
1705
+
1706
+ type: 'CONTRACT_IDS';
1707
+ }
1708
+ }
1709
+
881
1710
  /**
882
1711
  * Required for "POSTPAID" commits: the true up invoice will be generated at this
883
1712
  * time and only one schedule item is allowed; the total must match access_schedule
@@ -974,6 +1803,88 @@ export namespace ContractCreateParams {
974
1803
  unit_price?: number;
975
1804
  }
976
1805
  }
1806
+
1807
+ /**
1808
+ * optionally payment gate this commit
1809
+ */
1810
+ export interface PaymentGateConfig {
1811
+ /**
1812
+ * Gate access to the commit balance based on successful collection of payment.
1813
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
1814
+ * facilitate payment using your own payment integration. Select NONE if you do not
1815
+ * wish to payment gate the commit balance.
1816
+ */
1817
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
1818
+
1819
+ /**
1820
+ * Only applicable if using PRECALCULATED as your tax type.
1821
+ */
1822
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
1823
+
1824
+ /**
1825
+ * Only applicable if using STRIPE as your payment gate type.
1826
+ */
1827
+ stripe_config?: PaymentGateConfig.StripeConfig;
1828
+
1829
+ /**
1830
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
1831
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
1832
+ * will default to NONE.
1833
+ */
1834
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
1835
+ }
1836
+
1837
+ export namespace PaymentGateConfig {
1838
+ /**
1839
+ * Only applicable if using PRECALCULATED as your tax type.
1840
+ */
1841
+ export interface PrecalculatedTaxConfig {
1842
+ /**
1843
+ * Amount of tax to be applied. This should be in the same currency and
1844
+ * denomination as the commit's invoice schedule
1845
+ */
1846
+ tax_amount: number;
1847
+
1848
+ /**
1849
+ * Name of the tax to be applied. This may be used in an invoice line item
1850
+ * description.
1851
+ */
1852
+ tax_name?: string;
1853
+ }
1854
+
1855
+ /**
1856
+ * Only applicable if using STRIPE as your payment gate type.
1857
+ */
1858
+ export interface StripeConfig {
1859
+ /**
1860
+ * If left blank, will default to INVOICE
1861
+ */
1862
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
1863
+
1864
+ /**
1865
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
1866
+ * your payment type.
1867
+ */
1868
+ invoice_metadata?: { [key: string]: string };
1869
+ }
1870
+ }
1871
+
1872
+ export interface Specifier {
1873
+ presentation_group_values?: { [key: string]: string };
1874
+
1875
+ pricing_group_values?: { [key: string]: string };
1876
+
1877
+ /**
1878
+ * If provided, the specifier will only apply to the product with the specified ID.
1879
+ */
1880
+ product_id?: string;
1881
+
1882
+ /**
1883
+ * If provided, the specifier will only apply to products with all the specified
1884
+ * tags.
1885
+ */
1886
+ product_tags?: Array<string>;
1887
+ }
977
1888
  }
978
1889
 
979
1890
  export interface Credit {
@@ -996,13 +1907,18 @@ export namespace ContractCreateParams {
996
1907
  */
997
1908
  applicable_product_tags?: Array<string>;
998
1909
 
999
- custom_fields?: Record<string, string>;
1910
+ custom_fields?: { [key: string]: string };
1000
1911
 
1001
1912
  /**
1002
1913
  * Used only in UI/API. It is not exposed to end customers.
1003
1914
  */
1004
1915
  description?: string;
1005
1916
 
1917
+ /**
1918
+ * Optional configuration for credit hierarchy access control
1919
+ */
1920
+ hierarchy_configuration?: Credit.HierarchyConfiguration;
1921
+
1006
1922
  /**
1007
1923
  * displayed on invoices
1008
1924
  */
@@ -1020,6 +1936,14 @@ export namespace ContractCreateParams {
1020
1936
  priority?: number;
1021
1937
 
1022
1938
  rate_type?: 'COMMIT_RATE' | 'LIST_RATE';
1939
+
1940
+ /**
1941
+ * List of filters that determine what kind of customer usage draws down a commit
1942
+ * or credit. A customer's usage needs to meet the condition of at least one of the
1943
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
1944
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
1945
+ */
1946
+ specifiers?: Array<Credit.Specifier>;
1023
1947
  }
1024
1948
 
1025
1949
  export namespace Credit {
@@ -1050,6 +1974,49 @@ export namespace ContractCreateParams {
1050
1974
  starting_at: string;
1051
1975
  }
1052
1976
  }
1977
+
1978
+ /**
1979
+ * Optional configuration for credit hierarchy access control
1980
+ */
1981
+ export interface HierarchyConfiguration {
1982
+ child_access:
1983
+ | HierarchyConfiguration.CommitHierarchyChildAccessAll
1984
+ | HierarchyConfiguration.CommitHierarchyChildAccessNone
1985
+ | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
1986
+ }
1987
+
1988
+ export namespace HierarchyConfiguration {
1989
+ export interface CommitHierarchyChildAccessAll {
1990
+ type: 'ALL';
1991
+ }
1992
+
1993
+ export interface CommitHierarchyChildAccessNone {
1994
+ type: 'NONE';
1995
+ }
1996
+
1997
+ export interface CommitHierarchyChildAccessContractIDs {
1998
+ contract_ids: Array<string>;
1999
+
2000
+ type: 'CONTRACT_IDS';
2001
+ }
2002
+ }
2003
+
2004
+ export interface Specifier {
2005
+ presentation_group_values?: { [key: string]: string };
2006
+
2007
+ pricing_group_values?: { [key: string]: string };
2008
+
2009
+ /**
2010
+ * If provided, the specifier will only apply to the product with the specified ID.
2011
+ */
2012
+ product_id?: string;
2013
+
2014
+ /**
2015
+ * If provided, the specifier will only apply to products with all the specified
2016
+ * tags.
2017
+ */
2018
+ product_tags?: Array<string>;
2019
+ }
1053
2020
  }
1054
2021
 
1055
2022
  export interface Discount {
@@ -1060,7 +2027,7 @@ export namespace ContractCreateParams {
1060
2027
  */
1061
2028
  schedule: Discount.Schedule;
1062
2029
 
1063
- custom_fields?: Record<string, string>;
2030
+ custom_fields?: { [key: string]: string };
1064
2031
 
1065
2032
  /**
1066
2033
  * displayed on invoices
@@ -1169,6 +2136,18 @@ export namespace ContractCreateParams {
1169
2136
  }
1170
2137
  }
1171
2138
 
2139
+ export interface HierarchyConfiguration {
2140
+ parent: HierarchyConfiguration.Parent;
2141
+ }
2142
+
2143
+ export namespace HierarchyConfiguration {
2144
+ export interface Parent {
2145
+ contract_id: string;
2146
+
2147
+ customer_id: string;
2148
+ }
2149
+ }
2150
+
1172
2151
  export interface Override {
1173
2152
  /**
1174
2153
  * RFC 3339 timestamp indicating when the override will start applying (inclusive)
@@ -1246,7 +2225,7 @@ export namespace ContractCreateParams {
1246
2225
 
1247
2226
  export namespace Override {
1248
2227
  export interface OverrideSpecifier {
1249
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
2228
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1250
2229
 
1251
2230
  /**
1252
2231
  * Can only be used for commit specific overrides. Must be used in conjunction with
@@ -1260,13 +2239,13 @@ export namespace ContractCreateParams {
1260
2239
  * A map of group names to values. The override will only apply to line items with
1261
2240
  * the specified presentation group values.
1262
2241
  */
1263
- presentation_group_values?: Record<string, string>;
2242
+ presentation_group_values?: { [key: string]: string };
1264
2243
 
1265
2244
  /**
1266
2245
  * A map of pricing group names to values. The override will only apply to products
1267
2246
  * with the specified pricing group values.
1268
2247
  */
1269
- pricing_group_values?: Record<string, string>;
2248
+ pricing_group_values?: { [key: string]: string };
1270
2249
 
1271
2250
  /**
1272
2251
  * If provided, the override will only apply to the product with the specified ID.
@@ -1308,7 +2287,7 @@ export namespace ContractCreateParams {
1308
2287
  * Only set for CUSTOM rate_type. This field is interpreted by custom rate
1309
2288
  * processors.
1310
2289
  */
1311
- custom_rate?: Record<string, unknown>;
2290
+ custom_rate?: { [key: string]: unknown };
1312
2291
 
1313
2292
  /**
1314
2293
  * Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be
@@ -1340,6 +2319,157 @@ export namespace ContractCreateParams {
1340
2319
  }
1341
2320
  }
1342
2321
 
2322
+ export interface PrepaidBalanceThresholdConfiguration {
2323
+ commit: PrepaidBalanceThresholdConfiguration.Commit;
2324
+
2325
+ /**
2326
+ * When set to false, the contract will not be evaluated against the
2327
+ * threshold_amount. Toggling to true will result an immediate evaluation,
2328
+ * regardless of prior state.
2329
+ */
2330
+ is_enabled: boolean;
2331
+
2332
+ payment_gate_config: PrepaidBalanceThresholdConfiguration.PaymentGateConfig;
2333
+
2334
+ /**
2335
+ * Specify the amount the balance should be recharged to.
2336
+ */
2337
+ recharge_to_amount: number;
2338
+
2339
+ /**
2340
+ * Specify the threshold amount for the contract. Each time the contract's prepaid
2341
+ * balance lowers to this amount, a threshold charge will be initiated.
2342
+ */
2343
+ threshold_amount: number;
2344
+
2345
+ /**
2346
+ * If provided, the threshold, recharge-to amount, and the resulting threshold
2347
+ * commit amount will be in terms of this credit type instead of the fiat currency.
2348
+ */
2349
+ custom_credit_type_id?: string;
2350
+ }
2351
+
2352
+ export namespace PrepaidBalanceThresholdConfiguration {
2353
+ export interface Commit {
2354
+ /**
2355
+ * The commit product that will be used to generate the line item for commit
2356
+ * payment.
2357
+ */
2358
+ product_id: string;
2359
+
2360
+ /**
2361
+ * Which products the threshold commit applies to. If applicable_product_ids,
2362
+ * applicable_product_tags or specifiers are not provided, the commit applies to
2363
+ * all products.
2364
+ */
2365
+ applicable_product_ids?: Array<string>;
2366
+
2367
+ /**
2368
+ * Which tags the threshold commit applies to. If applicable_product_ids,
2369
+ * applicable_product_tags or specifiers are not provided, the commit applies to
2370
+ * all products.
2371
+ */
2372
+ applicable_product_tags?: Array<string>;
2373
+
2374
+ description?: string;
2375
+
2376
+ /**
2377
+ * Specify the name of the line item for the threshold charge. If left blank, it
2378
+ * will default to the commit product name.
2379
+ */
2380
+ name?: string;
2381
+
2382
+ /**
2383
+ * List of filters that determine what kind of customer usage draws down a commit
2384
+ * or credit. A customer's usage needs to meet the condition of at least one of the
2385
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
2386
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
2387
+ */
2388
+ specifiers?: Array<Commit.Specifier>;
2389
+ }
2390
+
2391
+ export namespace Commit {
2392
+ export interface Specifier {
2393
+ presentation_group_values?: { [key: string]: string };
2394
+
2395
+ pricing_group_values?: { [key: string]: string };
2396
+
2397
+ /**
2398
+ * If provided, the specifier will only apply to the product with the specified ID.
2399
+ */
2400
+ product_id?: string;
2401
+
2402
+ /**
2403
+ * If provided, the specifier will only apply to products with all the specified
2404
+ * tags.
2405
+ */
2406
+ product_tags?: Array<string>;
2407
+ }
2408
+ }
2409
+
2410
+ export interface PaymentGateConfig {
2411
+ /**
2412
+ * Gate access to the commit balance based on successful collection of payment.
2413
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
2414
+ * facilitate payment using your own payment integration. Select NONE if you do not
2415
+ * wish to payment gate the commit balance.
2416
+ */
2417
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
2418
+
2419
+ /**
2420
+ * Only applicable if using PRECALCULATED as your tax type.
2421
+ */
2422
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
2423
+
2424
+ /**
2425
+ * Only applicable if using STRIPE as your payment gate type.
2426
+ */
2427
+ stripe_config?: PaymentGateConfig.StripeConfig;
2428
+
2429
+ /**
2430
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
2431
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
2432
+ * will default to NONE.
2433
+ */
2434
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
2435
+ }
2436
+
2437
+ export namespace PaymentGateConfig {
2438
+ /**
2439
+ * Only applicable if using PRECALCULATED as your tax type.
2440
+ */
2441
+ export interface PrecalculatedTaxConfig {
2442
+ /**
2443
+ * Amount of tax to be applied. This should be in the same currency and
2444
+ * denomination as the commit's invoice schedule
2445
+ */
2446
+ tax_amount: number;
2447
+
2448
+ /**
2449
+ * Name of the tax to be applied. This may be used in an invoice line item
2450
+ * description.
2451
+ */
2452
+ tax_name?: string;
2453
+ }
2454
+
2455
+ /**
2456
+ * Only applicable if using STRIPE as your payment gate type.
2457
+ */
2458
+ export interface StripeConfig {
2459
+ /**
2460
+ * If left blank, will default to INVOICE
2461
+ */
2462
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
2463
+
2464
+ /**
2465
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
2466
+ * your payment type.
2467
+ */
2468
+ invoice_metadata?: { [key: string]: string };
2469
+ }
2470
+ }
2471
+ }
2472
+
1343
2473
  export interface ProfessionalService {
1344
2474
  /**
1345
2475
  * Maximum amount for the term.
@@ -1360,7 +2490,7 @@ export namespace ContractCreateParams {
1360
2490
  */
1361
2491
  unit_price: number;
1362
2492
 
1363
- custom_fields?: Record<string, string>;
2493
+ custom_fields?: { [key: string]: string };
1364
2494
 
1365
2495
  description?: string;
1366
2496
 
@@ -1377,7 +2507,9 @@ export namespace ContractCreateParams {
1377
2507
  access_amount: RecurringCommit.AccessAmount;
1378
2508
 
1379
2509
  /**
1380
- * The amount of time the created commits will be valid for.
2510
+ * Defines the length of the access schedule for each created commit/credit. The
2511
+ * value represents the number of units. Unit defaults to "PERIODS", where the
2512
+ * length of a period is determined by the recurrence_frequency.
1381
2513
  */
1382
2514
  commit_duration: RecurringCommit.CommitDuration;
1383
2515
 
@@ -1413,6 +2545,11 @@ export namespace ContractCreateParams {
1413
2545
  */
1414
2546
  ending_before?: string;
1415
2547
 
2548
+ /**
2549
+ * Optional configuration for recurring commit/credit hierarchy access control
2550
+ */
2551
+ hierarchy_configuration?: RecurringCommit.HierarchyConfiguration;
2552
+
1416
2553
  /**
1417
2554
  * The amount the customer should be billed for the commit. Not required.
1418
2555
  */
@@ -1443,10 +2580,10 @@ export namespace ContractCreateParams {
1443
2580
  * The frequency at which the recurring commits will be created. If not provided: -
1444
2581
  * The commits will be created on the usage invoice frequency. If provided: - The
1445
2582
  * period defined in the duration will correspond to this frequency. - Commits will
1446
- * be created aligned with the recurring commit's start_date rather than the usage
2583
+ * be created aligned with the recurring commit's starting_at rather than the usage
1447
2584
  * invoice dates.
1448
2585
  */
1449
- recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
2586
+ recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1450
2587
 
1451
2588
  /**
1452
2589
  * Will be passed down to the individual commits. This controls how much of an
@@ -1455,6 +2592,19 @@ export namespace ContractCreateParams {
1455
2592
  */
1456
2593
  rollover_fraction?: number;
1457
2594
 
2595
+ /**
2596
+ * List of filters that determine what kind of customer usage draws down a commit
2597
+ * or credit. A customer's usage needs to meet the condition of at least one of the
2598
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
2599
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
2600
+ */
2601
+ specifiers?: Array<RecurringCommit.Specifier>;
2602
+
2603
+ /**
2604
+ * Attach a subscription to the recurring commit/credit.
2605
+ */
2606
+ subscription_config?: RecurringCommit.SubscriptionConfig;
2607
+
1458
2608
  /**
1459
2609
  * A temporary ID that can be used to reference the recurring commit for commit
1460
2610
  * specific overrides.
@@ -1469,18 +2619,50 @@ export namespace ContractCreateParams {
1469
2619
  export interface AccessAmount {
1470
2620
  credit_type_id: string;
1471
2621
 
1472
- quantity: number;
1473
-
1474
2622
  unit_price: number;
2623
+
2624
+ /**
2625
+ * This field is currently required. Upcoming recurring commit/credit configuration
2626
+ * options will allow it to be optional.
2627
+ */
2628
+ quantity?: number;
1475
2629
  }
1476
2630
 
1477
2631
  /**
1478
- * The amount of time the created commits will be valid for.
2632
+ * Defines the length of the access schedule for each created commit/credit. The
2633
+ * value represents the number of units. Unit defaults to "PERIODS", where the
2634
+ * length of a period is determined by the recurrence_frequency.
1479
2635
  */
1480
2636
  export interface CommitDuration {
1481
- unit: 'PERIODS';
1482
-
1483
2637
  value: number;
2638
+
2639
+ unit?: 'PERIODS';
2640
+ }
2641
+
2642
+ /**
2643
+ * Optional configuration for recurring commit/credit hierarchy access control
2644
+ */
2645
+ export interface HierarchyConfiguration {
2646
+ child_access:
2647
+ | HierarchyConfiguration.CommitHierarchyChildAccessAll
2648
+ | HierarchyConfiguration.CommitHierarchyChildAccessNone
2649
+ | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
2650
+ }
2651
+
2652
+ export namespace HierarchyConfiguration {
2653
+ export interface CommitHierarchyChildAccessAll {
2654
+ type: 'ALL';
2655
+ }
2656
+
2657
+ export interface CommitHierarchyChildAccessNone {
2658
+ type: 'NONE';
2659
+ }
2660
+
2661
+ export interface CommitHierarchyChildAccessContractIDs {
2662
+ contract_ids: Array<string>;
2663
+
2664
+ type: 'CONTRACT_IDS';
2665
+ }
1484
2666
  }
1485
2667
 
1486
2668
  /**
@@ -1493,6 +2675,49 @@ export namespace ContractCreateParams {
1493
2675
 
1494
2676
  unit_price: number;
1495
2677
  }
2678
+
2679
+ export interface Specifier {
2680
+ presentation_group_values?: { [key: string]: string };
2681
+
2682
+ pricing_group_values?: { [key: string]: string };
2683
+
2684
+ /**
2685
+ * If provided, the specifier will only apply to the product with the specified ID.
2686
+ */
2687
+ product_id?: string;
2688
+
2689
+ /**
2690
+ * If provided, the specifier will only apply to products with all the specified
2691
+ * tags.
2692
+ */
2693
+ product_tags?: Array<string>;
2694
+ }
2695
+
2696
+ /**
2697
+ * Attach a subscription to the recurring commit/credit.
2698
+ */
2699
+ export interface SubscriptionConfig {
2700
+ apply_seat_increase_config: SubscriptionConfig.ApplySeatIncreaseConfig;
2701
+
2702
+ /**
2703
+ * ID of the subscription to configure on the recurring commit/credit.
2704
+ */
2705
+ subscription_id: string;
2706
+
2707
+ /**
2708
+ * If set to POOLED, allocation added per seat is pooled across the account.
2709
+ */
2710
+ allocation?: 'POOLED';
2711
+ }
2712
+
2713
+ export namespace SubscriptionConfig {
2714
+ export interface ApplySeatIncreaseConfig {
2715
+ /**
2716
+ * Indicates whether a mid-period seat increase should be prorated.
2717
+ */
2718
+ is_prorated: boolean;
2719
+ }
2720
+ }
1496
2721
  }
1497
2722
 
1498
2723
  export interface RecurringCredit {
@@ -1502,7 +2727,9 @@ export namespace ContractCreateParams {
1502
2727
  access_amount: RecurringCredit.AccessAmount;
1503
2728
 
1504
2729
  /**
1505
- * The amount of time the created commits will be valid for.
2730
+ * Defines the length of the access schedule for each created commit/credit. The
2731
+ * value represents the number of units. Unit defaults to "PERIODS", where the
2732
+ * length of a period is determined by the recurrence_frequency.
1506
2733
  */
1507
2734
  commit_duration: RecurringCredit.CommitDuration;
1508
2735
 
@@ -1538,6 +2765,11 @@ export namespace ContractCreateParams {
1538
2765
  */
1539
2766
  ending_before?: string;
1540
2767
 
2768
+ /**
2769
+ * Optional configuration for recurring commit/credit hierarchy access control
2770
+ */
2771
+ hierarchy_configuration?: RecurringCredit.HierarchyConfiguration;
2772
+
1541
2773
  /**
1542
2774
  * displayed on invoices. will be passed through to the individual commits
1543
2775
  */
@@ -1563,10 +2795,10 @@ export namespace ContractCreateParams {
1563
2795
  * The frequency at which the recurring commits will be created. If not provided: -
1564
2796
  * The commits will be created on the usage invoice frequency. If provided: - The
1565
2797
  * period defined in the duration will correspond to this frequency. - Commits will
1566
- * be created aligned with the recurring commit's start_date rather than the usage
2798
+ * be created aligned with the recurring commit's starting_at rather than the usage
1567
2799
  * invoice dates.
1568
2800
  */
1569
- recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
2801
+ recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1570
2802
 
1571
2803
  /**
1572
2804
  * Will be passed down to the individual commits. This controls how much of an
@@ -1576,31 +2808,119 @@ export namespace ContractCreateParams {
1576
2808
  rollover_fraction?: number;
1577
2809
 
1578
2810
  /**
1579
- * A temporary ID that can be used to reference the recurring commit for commit
1580
- * specific overrides.
2811
+ * List of filters that determine what kind of customer usage draws down a commit
2812
+ * or credit. A customer's usage needs to meet the condition of at least one of the
2813
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
2814
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
2815
+ */
2816
+ specifiers?: Array<RecurringCredit.Specifier>;
2817
+
2818
+ /**
2819
+ * Attach a subscription to the recurring commit/credit.
2820
+ */
2821
+ subscription_config?: RecurringCredit.SubscriptionConfig;
2822
+
2823
+ /**
2824
+ * A temporary ID that can be used to reference the recurring commit for commit
2825
+ * specific overrides.
2826
+ */
2827
+ temporary_id?: string;
2828
+ }
2829
+
2830
+ export namespace RecurringCredit {
2831
+ /**
2832
+ * The amount of commit to grant.
2833
+ */
2834
+ export interface AccessAmount {
2835
+ credit_type_id: string;
2836
+
2837
+ unit_price: number;
2838
+
2839
+ /**
2840
+ * This field is currently required. Upcoming recurring commit/credit configuration
2841
+ * options will allow it to be optional.
2842
+ */
2843
+ quantity?: number;
2844
+ }
2845
+
2846
+ /**
2847
+ * Defines the length of the access schedule for each created commit/credit. The
2848
+ * value represents the number of units. Unit defaults to "PERIODS", where the
2849
+ * length of a period is determined by the recurrence_frequency.
1581
2850
  */
1582
- temporary_id?: string;
1583
- }
2851
+ export interface CommitDuration {
2852
+ value: number;
2853
+
2854
+ unit?: 'PERIODS';
2855
+ }
1584
2856
 
1585
- export namespace RecurringCredit {
1586
2857
  /**
1587
- * The amount of commit to grant.
2858
+ * Optional configuration for recurring commit/credit hierarchy access control
1588
2859
  */
1589
- export interface AccessAmount {
1590
- credit_type_id: string;
2860
+ export interface HierarchyConfiguration {
2861
+ child_access:
2862
+ | HierarchyConfiguration.CommitHierarchyChildAccessAll
2863
+ | HierarchyConfiguration.CommitHierarchyChildAccessNone
2864
+ | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
2865
+ }
1591
2866
 
1592
- quantity: number;
2867
+ export namespace HierarchyConfiguration {
2868
+ export interface CommitHierarchyChildAccessAll {
2869
+ type: 'ALL';
2870
+ }
1593
2871
 
1594
- unit_price: number;
2872
+ export interface CommitHierarchyChildAccessNone {
2873
+ type: 'NONE';
2874
+ }
2875
+
2876
+ export interface CommitHierarchyChildAccessContractIDs {
2877
+ contract_ids: Array<string>;
2878
+
2879
+ type: 'CONTRACT_IDS';
2880
+ }
2881
+ }
2882
+
2883
+ export interface Specifier {
2884
+ presentation_group_values?: { [key: string]: string };
2885
+
2886
+ pricing_group_values?: { [key: string]: string };
2887
+
2888
+ /**
2889
+ * If provided, the specifier will only apply to the product with the specified ID.
2890
+ */
2891
+ product_id?: string;
2892
+
2893
+ /**
2894
+ * If provided, the specifier will only apply to products with all the specified
2895
+ * tags.
2896
+ */
2897
+ product_tags?: Array<string>;
1595
2898
  }
1596
2899
 
1597
2900
  /**
1598
- * The amount of time the created commits will be valid for.
2901
+ * Attach a subscription to the recurring commit/credit.
1599
2902
  */
1600
- export interface CommitDuration {
1601
- unit: 'PERIODS';
2903
+ export interface SubscriptionConfig {
2904
+ apply_seat_increase_config: SubscriptionConfig.ApplySeatIncreaseConfig;
1602
2905
 
1603
- value: number;
2906
+ /**
2907
+ * ID of the subscription to configure on the recurring commit/credit.
2908
+ */
2909
+ subscription_id: string;
2910
+
2911
+ /**
2912
+ * If set to POOLED, allocation added per seat is pooled across the account.
2913
+ */
2914
+ allocation?: 'POOLED';
2915
+ }
2916
+
2917
+ export namespace SubscriptionConfig {
2918
+ export interface ApplySeatIncreaseConfig {
2919
+ /**
2920
+ * Indicates whether a mid-period seat increase should be prorated.
2921
+ */
2922
+ is_prorated: boolean;
2923
+ }
1604
2924
  }
1605
2925
  }
1606
2926
 
@@ -1763,15 +3083,119 @@ export namespace ContractCreateParams {
1763
3083
  }
1764
3084
  }
1765
3085
 
3086
+ export interface SpendThresholdConfiguration {
3087
+ commit: SpendThresholdConfiguration.Commit;
3088
+
3089
+ /**
3090
+ * When set to false, the contract will not be evaluated against the
3091
+ * threshold_amount. Toggling to true will result an immediate evaluation,
3092
+ * regardless of prior state.
3093
+ */
3094
+ is_enabled: boolean;
3095
+
3096
+ payment_gate_config: SpendThresholdConfiguration.PaymentGateConfig;
3097
+
3098
+ /**
3099
+ * Specify the threshold amount for the contract. Each time the contract's usage
3100
+ * hits this amount, a threshold charge will be initiated.
3101
+ */
3102
+ threshold_amount: number;
3103
+ }
3104
+
3105
+ export namespace SpendThresholdConfiguration {
3106
+ export interface Commit {
3107
+ /**
3108
+ * The commit product that will be used to generate the line item for commit
3109
+ * payment.
3110
+ */
3111
+ product_id: string;
3112
+
3113
+ description?: string;
3114
+
3115
+ /**
3116
+ * Specify the name of the line item for the threshold charge. If left blank, it
3117
+ * will default to the commit product name.
3118
+ */
3119
+ name?: string;
3120
+ }
3121
+
3122
+ export interface PaymentGateConfig {
3123
+ /**
3124
+ * Gate access to the commit balance based on successful collection of payment.
3125
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
3126
+ * facilitate payment using your own payment integration. Select NONE if you do not
3127
+ * wish to payment gate the commit balance.
3128
+ */
3129
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
3130
+
3131
+ /**
3132
+ * Only applicable if using PRECALCULATED as your tax type.
3133
+ */
3134
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
3135
+
3136
+ /**
3137
+ * Only applicable if using STRIPE as your payment gate type.
3138
+ */
3139
+ stripe_config?: PaymentGateConfig.StripeConfig;
3140
+
3141
+ /**
3142
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
3143
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
3144
+ * will default to NONE.
3145
+ */
3146
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
3147
+ }
3148
+
3149
+ export namespace PaymentGateConfig {
3150
+ /**
3151
+ * Only applicable if using PRECALCULATED as your tax type.
3152
+ */
3153
+ export interface PrecalculatedTaxConfig {
3154
+ /**
3155
+ * Amount of tax to be applied. This should be in the same currency and
3156
+ * denomination as the commit's invoice schedule
3157
+ */
3158
+ tax_amount: number;
3159
+
3160
+ /**
3161
+ * Name of the tax to be applied. This may be used in an invoice line item
3162
+ * description.
3163
+ */
3164
+ tax_name?: string;
3165
+ }
3166
+
3167
+ /**
3168
+ * Only applicable if using STRIPE as your payment gate type.
3169
+ */
3170
+ export interface StripeConfig {
3171
+ /**
3172
+ * If left blank, will default to INVOICE
3173
+ */
3174
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
3175
+
3176
+ /**
3177
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
3178
+ * your payment type.
3179
+ */
3180
+ invoice_metadata?: { [key: string]: string };
3181
+ }
3182
+ }
3183
+ }
3184
+
1766
3185
  export interface Subscription {
1767
3186
  collection_schedule: 'ADVANCE' | 'ARREARS';
1768
3187
 
3188
+ /**
3189
+ * The initial quantity for the subscription. It must be non-negative value.
3190
+ */
1769
3191
  initial_quantity: number;
1770
3192
 
1771
3193
  proration: Subscription.Proration;
1772
3194
 
1773
3195
  subscription_rate: Subscription.SubscriptionRate;
1774
3196
 
3197
+ custom_fields?: { [key: string]: string };
3198
+
1775
3199
  description?: string;
1776
3200
 
1777
3201
  /**
@@ -1787,15 +3211,22 @@ export namespace ContractCreateParams {
1787
3211
  * start date
1788
3212
  */
1789
3213
  starting_at?: string;
3214
+
3215
+ /**
3216
+ * A temporary ID used to reference the subscription in recurring commit/credit
3217
+ * subscription configs created within the same payload.
3218
+ */
3219
+ temporary_id?: string;
1790
3220
  }
1791
3221
 
1792
3222
  export namespace Subscription {
1793
3223
  export interface Proration {
1794
3224
  /**
1795
- * Indicates how mid-period quantity adjustments are invoiced. If BILL_IMMEDIATELY
1796
- * is selected, the quantity increase will be billed on the scheduled date. If
1797
- * BILL_ON_NEXT_COLLECTION_DATE is selected, the quantity increase will be billed
1798
- * for in-arrears at the end of the period.
3225
+ * Indicates how mid-period quantity adjustments are invoiced.
3226
+ * **BILL_IMMEDIATELY**: Only available when collection schedule is `ADVANCE`. The
3227
+ * quantity increase will be billed immediately on the scheduled date.
3228
+ * **BILL_ON_NEXT_COLLECTION_DATE**: The quantity increase will be billed for
3229
+ * in-arrears at the end of the period.
1799
3230
  */
1800
3231
  invoice_behavior?: 'BILL_IMMEDIATELY' | 'BILL_ON_NEXT_COLLECTION_DATE';
1801
3232
 
@@ -1810,7 +3241,7 @@ export namespace ContractCreateParams {
1810
3241
  * Frequency to bill subscription with. Together with product_id, must match
1811
3242
  * existing rate on the rate card.
1812
3243
  */
1813
- billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
3244
+ billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1814
3245
 
1815
3246
  /**
1816
3247
  * Must be subscription type product
@@ -1819,50 +3250,6 @@ export namespace ContractCreateParams {
1819
3250
  }
1820
3251
  }
1821
3252
 
1822
- export interface ThresholdBillingConfiguration {
1823
- commit: ThresholdBillingConfiguration.Commit;
1824
-
1825
- /**
1826
- * When set to false, the contract will not be evaluated against the
1827
- * threshold_amount. Toggling to true will result an immediate evaluation,
1828
- * regardless of prior state
1829
- */
1830
- is_enabled: boolean;
1831
-
1832
- /**
1833
- * Specify the threshold amount for the contract. Each time the contract's usage
1834
- * hits this amount, a threshold charge will be initiated.
1835
- */
1836
- threshold_amount: number;
1837
- }
1838
-
1839
- export namespace ThresholdBillingConfiguration {
1840
- export interface Commit {
1841
- product_id: string;
1842
-
1843
- /**
1844
- * Which products the threshold commit applies to. If both applicable_product_ids
1845
- * and applicable_product_tags are not provided, the commit applies to all
1846
- * products.
1847
- */
1848
- applicable_product_ids?: Array<string>;
1849
-
1850
- /**
1851
- * Which tags the threshold commit applies to. If both applicable_product_ids and
1852
- * applicable_product_tags are not provided, the commit applies to all products.
1853
- */
1854
- applicable_product_tags?: Array<string>;
1855
-
1856
- description?: string;
1857
-
1858
- /**
1859
- * Specify the name of the line item for the threshold charge. If left blank, it
1860
- * will default to the commit product name.
1861
- */
1862
- name?: string;
1863
- }
1864
- }
1865
-
1866
3253
  export interface Transition {
1867
3254
  from_contract_id: string;
1868
3255
 
@@ -1885,7 +3272,7 @@ export namespace ContractCreateParams {
1885
3272
  }
1886
3273
 
1887
3274
  export interface UsageStatementSchedule {
1888
- frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
3275
+ frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1889
3276
 
1890
3277
  /**
1891
3278
  * Required when using CUSTOM_DATE. This option lets you set a historical billing
@@ -2022,7 +3409,7 @@ export interface ContractAmendParams {
2022
3409
 
2023
3410
  credits?: Array<ContractAmendParams.Credit>;
2024
3411
 
2025
- custom_fields?: Record<string, string>;
3412
+ custom_fields?: { [key: string]: string };
2026
3413
 
2027
3414
  /**
2028
3415
  * This field's availability is dependent on your client's configuration.
@@ -2078,24 +3465,31 @@ export namespace ContractAmendParams {
2078
3465
  amount?: number;
2079
3466
 
2080
3467
  /**
2081
- * Which products the commit applies to. If both applicable_product_ids and
2082
- * applicable_product_tags are not provided, the commit applies to all products.
3468
+ * Which products the commit applies to. If applicable_product_ids,
3469
+ * applicable_product_tags or specifiers are not provided, the commit applies to
3470
+ * all products.
2083
3471
  */
2084
3472
  applicable_product_ids?: Array<string>;
2085
3473
 
2086
3474
  /**
2087
- * Which tags the commit applies to. If both applicable_product_ids and
2088
- * applicable_product_tags are not provided, the commit applies to all products.
3475
+ * Which tags the commit applies to. If applicable_product_ids,
3476
+ * applicable_product_tags or specifiers are not provided, the commit applies to
3477
+ * all products.
2089
3478
  */
2090
3479
  applicable_product_tags?: Array<string>;
2091
3480
 
2092
- custom_fields?: Record<string, string>;
3481
+ custom_fields?: { [key: string]: string };
2093
3482
 
2094
3483
  /**
2095
3484
  * Used only in UI/API. It is not exposed to end customers.
2096
3485
  */
2097
3486
  description?: string;
2098
3487
 
3488
+ /**
3489
+ * Optional configuration for commit hierarchy access control
3490
+ */
3491
+ hierarchy_configuration?: Commit.HierarchyConfiguration;
3492
+
2099
3493
  /**
2100
3494
  * Required for "POSTPAID" commits: the true up invoice will be generated at this
2101
3495
  * time and only one schedule item is allowed; the total must match access_schedule
@@ -2114,6 +3508,11 @@ export namespace ContractAmendParams {
2114
3508
  */
2115
3509
  netsuite_sales_order_id?: string;
2116
3510
 
3511
+ /**
3512
+ * optionally payment gate this commit
3513
+ */
3514
+ payment_gate_config?: Commit.PaymentGateConfig;
3515
+
2117
3516
  /**
2118
3517
  * If multiple commits are applicable, the one with the lower priority will apply
2119
3518
  * first.
@@ -2127,6 +3526,14 @@ export namespace ContractAmendParams {
2127
3526
  */
2128
3527
  rollover_fraction?: number;
2129
3528
 
3529
+ /**
3530
+ * List of filters that determine what kind of customer usage draws down a commit
3531
+ * or credit. A customer's usage needs to meet the condition of at least one of the
3532
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
3533
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
3534
+ */
3535
+ specifiers?: Array<Commit.Specifier>;
3536
+
2130
3537
  /**
2131
3538
  * A temporary ID for the commit that can be used to reference the commit for
2132
3539
  * commit specific overrides.
@@ -2165,6 +3572,32 @@ export namespace ContractAmendParams {
2165
3572
  }
2166
3573
  }
2167
3574
 
3575
+ /**
3576
+ * Optional configuration for commit hierarchy access control
3577
+ */
3578
+ export interface HierarchyConfiguration {
3579
+ child_access:
3580
+ | HierarchyConfiguration.CommitHierarchyChildAccessAll
3581
+ | HierarchyConfiguration.CommitHierarchyChildAccessNone
3582
+ | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
3583
+ }
3584
+
3585
+ export namespace HierarchyConfiguration {
3586
+ export interface CommitHierarchyChildAccessAll {
3587
+ type: 'ALL';
3588
+ }
3589
+
3590
+ export interface CommitHierarchyChildAccessNone {
3591
+ type: 'NONE';
3592
+ }
3593
+
3594
+ export interface CommitHierarchyChildAccessContractIDs {
3595
+ contract_ids: Array<string>;
3596
+
3597
+ type: 'CONTRACT_IDS';
3598
+ }
3599
+ }
3600
+
2168
3601
  /**
2169
3602
  * Required for "POSTPAID" commits: the true up invoice will be generated at this
2170
3603
  * time and only one schedule item is allowed; the total must match access_schedule
@@ -2261,6 +3694,88 @@ export namespace ContractAmendParams {
2261
3694
  unit_price?: number;
2262
3695
  }
2263
3696
  }
3697
+
3698
+ /**
3699
+ * optionally payment gate this commit
3700
+ */
3701
+ export interface PaymentGateConfig {
3702
+ /**
3703
+ * Gate access to the commit balance based on successful collection of payment.
3704
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
3705
+ * facilitate payment using your own payment integration. Select NONE if you do not
3706
+ * wish to payment gate the commit balance.
3707
+ */
3708
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
3709
+
3710
+ /**
3711
+ * Only applicable if using PRECALCULATED as your tax type.
3712
+ */
3713
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
3714
+
3715
+ /**
3716
+ * Only applicable if using STRIPE as your payment gate type.
3717
+ */
3718
+ stripe_config?: PaymentGateConfig.StripeConfig;
3719
+
3720
+ /**
3721
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
3722
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
3723
+ * will default to NONE.
3724
+ */
3725
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
3726
+ }
3727
+
3728
+ export namespace PaymentGateConfig {
3729
+ /**
3730
+ * Only applicable if using PRECALCULATED as your tax type.
3731
+ */
3732
+ export interface PrecalculatedTaxConfig {
3733
+ /**
3734
+ * Amount of tax to be applied. This should be in the same currency and
3735
+ * denomination as the commit's invoice schedule
3736
+ */
3737
+ tax_amount: number;
3738
+
3739
+ /**
3740
+ * Name of the tax to be applied. This may be used in an invoice line item
3741
+ * description.
3742
+ */
3743
+ tax_name?: string;
3744
+ }
3745
+
3746
+ /**
3747
+ * Only applicable if using STRIPE as your payment gate type.
3748
+ */
3749
+ export interface StripeConfig {
3750
+ /**
3751
+ * If left blank, will default to INVOICE
3752
+ */
3753
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
3754
+
3755
+ /**
3756
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
3757
+ * your payment type.
3758
+ */
3759
+ invoice_metadata?: { [key: string]: string };
3760
+ }
3761
+ }
3762
+
3763
+ export interface Specifier {
3764
+ presentation_group_values?: { [key: string]: string };
3765
+
3766
+ pricing_group_values?: { [key: string]: string };
3767
+
3768
+ /**
3769
+ * If provided, the specifier will only apply to the product with the specified ID.
3770
+ */
3771
+ product_id?: string;
3772
+
3773
+ /**
3774
+ * If provided, the specifier will only apply to products with all the specified
3775
+ * tags.
3776
+ */
3777
+ product_tags?: Array<string>;
3778
+ }
2264
3779
  }
2265
3780
 
2266
3781
  export interface Credit {
@@ -2283,13 +3798,18 @@ export namespace ContractAmendParams {
2283
3798
  */
2284
3799
  applicable_product_tags?: Array<string>;
2285
3800
 
2286
- custom_fields?: Record<string, string>;
3801
+ custom_fields?: { [key: string]: string };
2287
3802
 
2288
3803
  /**
2289
3804
  * Used only in UI/API. It is not exposed to end customers.
2290
3805
  */
2291
3806
  description?: string;
2292
3807
 
3808
+ /**
3809
+ * Optional configuration for credit hierarchy access control
3810
+ */
3811
+ hierarchy_configuration?: Credit.HierarchyConfiguration;
3812
+
2293
3813
  /**
2294
3814
  * displayed on invoices
2295
3815
  */
@@ -2307,6 +3827,14 @@ export namespace ContractAmendParams {
2307
3827
  priority?: number;
2308
3828
 
2309
3829
  rate_type?: 'COMMIT_RATE' | 'LIST_RATE';
3830
+
3831
+ /**
3832
+ * List of filters that determine what kind of customer usage draws down a commit
3833
+ * or credit. A customer's usage needs to meet the condition of at least one of the
3834
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
3835
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
3836
+ */
3837
+ specifiers?: Array<Credit.Specifier>;
2310
3838
  }
2311
3839
 
2312
3840
  export namespace Credit {
@@ -2337,6 +3865,49 @@ export namespace ContractAmendParams {
2337
3865
  starting_at: string;
2338
3866
  }
2339
3867
  }
3868
+
3869
+ /**
3870
+ * Optional configuration for credit hierarchy access control
3871
+ */
3872
+ export interface HierarchyConfiguration {
3873
+ child_access:
3874
+ | HierarchyConfiguration.CommitHierarchyChildAccessAll
3875
+ | HierarchyConfiguration.CommitHierarchyChildAccessNone
3876
+ | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
3877
+ }
3878
+
3879
+ export namespace HierarchyConfiguration {
3880
+ export interface CommitHierarchyChildAccessAll {
3881
+ type: 'ALL';
3882
+ }
3883
+
3884
+ export interface CommitHierarchyChildAccessNone {
3885
+ type: 'NONE';
3886
+ }
3887
+
3888
+ export interface CommitHierarchyChildAccessContractIDs {
3889
+ contract_ids: Array<string>;
3890
+
3891
+ type: 'CONTRACT_IDS';
3892
+ }
3893
+ }
3894
+
3895
+ export interface Specifier {
3896
+ presentation_group_values?: { [key: string]: string };
3897
+
3898
+ pricing_group_values?: { [key: string]: string };
3899
+
3900
+ /**
3901
+ * If provided, the specifier will only apply to the product with the specified ID.
3902
+ */
3903
+ product_id?: string;
3904
+
3905
+ /**
3906
+ * If provided, the specifier will only apply to products with all the specified
3907
+ * tags.
3908
+ */
3909
+ product_tags?: Array<string>;
3910
+ }
2340
3911
  }
2341
3912
 
2342
3913
  export interface Discount {
@@ -2347,7 +3918,7 @@ export namespace ContractAmendParams {
2347
3918
  */
2348
3919
  schedule: Discount.Schedule;
2349
3920
 
2350
- custom_fields?: Record<string, string>;
3921
+ custom_fields?: { [key: string]: string };
2351
3922
 
2352
3923
  /**
2353
3924
  * displayed on invoices
@@ -2533,7 +4104,7 @@ export namespace ContractAmendParams {
2533
4104
 
2534
4105
  export namespace Override {
2535
4106
  export interface OverrideSpecifier {
2536
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
4107
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
2537
4108
 
2538
4109
  /**
2539
4110
  * Can only be used for commit specific overrides. Must be used in conjunction with
@@ -2547,13 +4118,13 @@ export namespace ContractAmendParams {
2547
4118
  * A map of group names to values. The override will only apply to line items with
2548
4119
  * the specified presentation group values.
2549
4120
  */
2550
- presentation_group_values?: Record<string, string>;
4121
+ presentation_group_values?: { [key: string]: string };
2551
4122
 
2552
4123
  /**
2553
4124
  * A map of pricing group names to values. The override will only apply to products
2554
4125
  * with the specified pricing group values.
2555
4126
  */
2556
- pricing_group_values?: Record<string, string>;
4127
+ pricing_group_values?: { [key: string]: string };
2557
4128
 
2558
4129
  /**
2559
4130
  * If provided, the override will only apply to the product with the specified ID.
@@ -2595,7 +4166,7 @@ export namespace ContractAmendParams {
2595
4166
  * Only set for CUSTOM rate_type. This field is interpreted by custom rate
2596
4167
  * processors.
2597
4168
  */
2598
- custom_rate?: Record<string, unknown>;
4169
+ custom_rate?: { [key: string]: unknown };
2599
4170
 
2600
4171
  /**
2601
4172
  * Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be
@@ -2647,7 +4218,7 @@ export namespace ContractAmendParams {
2647
4218
  */
2648
4219
  unit_price: number;
2649
4220
 
2650
- custom_fields?: Record<string, string>;
4221
+ custom_fields?: { [key: string]: string };
2651
4222
 
2652
4223
  description?: string;
2653
4224
 
@@ -2867,7 +4438,7 @@ export namespace ContractCreateHistoricalInvoicesParams {
2867
4438
 
2868
4439
  breakdown_granularity?: 'HOUR' | 'DAY';
2869
4440
 
2870
- custom_fields?: Record<string, string>;
4441
+ custom_fields?: { [key: string]: string };
2871
4442
  }
2872
4443
 
2873
4444
  export namespace Invoice {
@@ -2878,9 +4449,9 @@ export namespace ContractCreateHistoricalInvoicesParams {
2878
4449
 
2879
4450
  product_id: string;
2880
4451
 
2881
- presentation_group_values?: Record<string, string>;
4452
+ presentation_group_values?: { [key: string]: string };
2882
4453
 
2883
- pricing_group_values?: Record<string, string>;
4454
+ pricing_group_values?: { [key: string]: string };
2884
4455
 
2885
4456
  quantity?: number;
2886
4457
 
@@ -2915,7 +4486,7 @@ export interface ContractListBalancesParams {
2915
4486
  effective_before?: string;
2916
4487
 
2917
4488
  /**
2918
- * Include credits from archived contracts.
4489
+ * Include archived credits and credits from archived contracts.
2919
4490
  */
2920
4491
  include_archived?: boolean;
2921
4492
 
@@ -2936,6 +4507,11 @@ export interface ContractListBalancesParams {
2936
4507
  */
2937
4508
  include_ledgers?: boolean;
2938
4509
 
4510
+ /**
4511
+ * The maximum number of commits to return. Defaults to 25.
4512
+ */
4513
+ limit?: number;
4514
+
2939
4515
  /**
2940
4516
  * The next page token from a previous response.
2941
4517
  */
@@ -2988,19 +4564,19 @@ export namespace ContractRetrieveRateScheduleParams {
2988
4564
  * Subscription rates matching the billing frequency will be included in the
2989
4565
  * response.
2990
4566
  */
2991
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
4567
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
2992
4568
 
2993
4569
  /**
2994
4570
  * List of pricing group key value pairs, rates containing the matching key / value
2995
4571
  * pairs will be included in the response.
2996
4572
  */
2997
- partial_pricing_group_values?: Record<string, string>;
4573
+ partial_pricing_group_values?: { [key: string]: string };
2998
4574
 
2999
4575
  /**
3000
4576
  * List of pricing group key value pairs, rates matching all of the key / value
3001
4577
  * pairs will be included in the response.
3002
4578
  */
3003
- pricing_group_values?: Record<string, string>;
4579
+ pricing_group_values?: { [key: string]: string };
3004
4580
 
3005
4581
  /**
3006
4582
  * Rates matching the product id will be included in the response.
@@ -3015,6 +4591,14 @@ export namespace ContractRetrieveRateScheduleParams {
3015
4591
  }
3016
4592
  }
3017
4593
 
4594
+ export interface ContractRetrieveSubscriptionQuantityHistoryParams {
4595
+ contract_id: string;
4596
+
4597
+ customer_id: string;
4598
+
4599
+ subscription_id: string;
4600
+ }
4601
+
3018
4602
  export interface ContractScheduleProServicesInvoiceParams {
3019
4603
  contract_id: string;
3020
4604
 
@@ -3141,6 +4725,7 @@ export declare namespace Contracts {
3141
4725
  type ContractCreateHistoricalInvoicesResponse as ContractCreateHistoricalInvoicesResponse,
3142
4726
  type ContractListBalancesResponse as ContractListBalancesResponse,
3143
4727
  type ContractRetrieveRateScheduleResponse as ContractRetrieveRateScheduleResponse,
4728
+ type ContractRetrieveSubscriptionQuantityHistoryResponse as ContractRetrieveSubscriptionQuantityHistoryResponse,
3144
4729
  type ContractScheduleProServicesInvoiceResponse as ContractScheduleProServicesInvoiceResponse,
3145
4730
  type ContractUpdateEndDateResponse as ContractUpdateEndDateResponse,
3146
4731
  type ContractCreateParams as ContractCreateParams,
@@ -3152,6 +4737,7 @@ export declare namespace Contracts {
3152
4737
  type ContractCreateHistoricalInvoicesParams as ContractCreateHistoricalInvoicesParams,
3153
4738
  type ContractListBalancesParams as ContractListBalancesParams,
3154
4739
  type ContractRetrieveRateScheduleParams as ContractRetrieveRateScheduleParams,
4740
+ type ContractRetrieveSubscriptionQuantityHistoryParams as ContractRetrieveSubscriptionQuantityHistoryParams,
3155
4741
  type ContractScheduleProServicesInvoiceParams as ContractScheduleProServicesInvoiceParams,
3156
4742
  type ContractSetUsageFilterParams as ContractSetUsageFilterParams,
3157
4743
  type ContractUpdateEndDateParams as ContractUpdateEndDateParams,
@@ -3181,12 +4767,14 @@ export declare namespace Contracts {
3181
4767
  type RateCardRetrieveResponse as RateCardRetrieveResponse,
3182
4768
  type RateCardUpdateResponse as RateCardUpdateResponse,
3183
4769
  type RateCardListResponse as RateCardListResponse,
4770
+ type RateCardArchiveResponse as RateCardArchiveResponse,
3184
4771
  type RateCardRetrieveRateScheduleResponse as RateCardRetrieveRateScheduleResponse,
3185
4772
  RateCardListResponsesCursorPage as RateCardListResponsesCursorPage,
3186
4773
  type RateCardCreateParams as RateCardCreateParams,
3187
4774
  type RateCardRetrieveParams as RateCardRetrieveParams,
3188
4775
  type RateCardUpdateParams as RateCardUpdateParams,
3189
4776
  type RateCardListParams as RateCardListParams,
4777
+ type RateCardArchiveParams as RateCardArchiveParams,
3190
4778
  type RateCardRetrieveRateScheduleParams as RateCardRetrieveRateScheduleParams,
3191
4779
  };
3192
4780