@metronome/sdk 0.1.0-beta.9 → 0.1.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 +179 -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 -1
  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 +473 -37
  31. package/resources/shared.d.ts.map +1 -1
  32. package/resources/v1/alerts.d.ts +26 -2
  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 +1478 -102
  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 +28 -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 +30 -2
  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 +2923 -207
  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 +539 -40
  236. package/src/resources/v1/alerts.ts +29 -5
  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 +1643 -124
  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 +32 -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 +30 -4
  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 +3397 -235
  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,14 @@ 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
+
1458
2603
  /**
1459
2604
  * A temporary ID that can be used to reference the recurring commit for commit
1460
2605
  * specific overrides.
@@ -1469,18 +2614,50 @@ export namespace ContractCreateParams {
1469
2614
  export interface AccessAmount {
1470
2615
  credit_type_id: string;
1471
2616
 
1472
- quantity: number;
1473
-
1474
2617
  unit_price: number;
2618
+
2619
+ /**
2620
+ * This field is currently required. Upcoming recurring commit/credit configuration
2621
+ * options will allow it to be optional.
2622
+ */
2623
+ quantity?: number;
1475
2624
  }
1476
2625
 
1477
2626
  /**
1478
- * The amount of time the created commits will be valid for.
2627
+ * Defines the length of the access schedule for each created commit/credit. The
2628
+ * value represents the number of units. Unit defaults to "PERIODS", where the
2629
+ * length of a period is determined by the recurrence_frequency.
1479
2630
  */
1480
2631
  export interface CommitDuration {
1481
- unit: 'PERIODS';
1482
-
1483
2632
  value: number;
2633
+
2634
+ unit?: 'PERIODS';
2635
+ }
2636
+
2637
+ /**
2638
+ * Optional configuration for recurring commit/credit hierarchy access control
2639
+ */
2640
+ export interface HierarchyConfiguration {
2641
+ child_access:
2642
+ | HierarchyConfiguration.CommitHierarchyChildAccessAll
2643
+ | HierarchyConfiguration.CommitHierarchyChildAccessNone
2644
+ | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
2645
+ }
2646
+
2647
+ export namespace HierarchyConfiguration {
2648
+ export interface CommitHierarchyChildAccessAll {
2649
+ type: 'ALL';
2650
+ }
2651
+
2652
+ export interface CommitHierarchyChildAccessNone {
2653
+ type: 'NONE';
2654
+ }
2655
+
2656
+ export interface CommitHierarchyChildAccessContractIDs {
2657
+ contract_ids: Array<string>;
2658
+
2659
+ type: 'CONTRACT_IDS';
2660
+ }
1484
2661
  }
1485
2662
 
1486
2663
  /**
@@ -1489,9 +2666,26 @@ export namespace ContractCreateParams {
1489
2666
  export interface InvoiceAmount {
1490
2667
  credit_type_id: string;
1491
2668
 
1492
- quantity: number;
2669
+ quantity: number;
2670
+
2671
+ unit_price: number;
2672
+ }
2673
+
2674
+ export interface Specifier {
2675
+ presentation_group_values?: { [key: string]: string };
1493
2676
 
1494
- unit_price: number;
2677
+ pricing_group_values?: { [key: string]: string };
2678
+
2679
+ /**
2680
+ * If provided, the specifier will only apply to the product with the specified ID.
2681
+ */
2682
+ product_id?: string;
2683
+
2684
+ /**
2685
+ * If provided, the specifier will only apply to products with all the specified
2686
+ * tags.
2687
+ */
2688
+ product_tags?: Array<string>;
1495
2689
  }
1496
2690
  }
1497
2691
 
@@ -1502,7 +2696,9 @@ export namespace ContractCreateParams {
1502
2696
  access_amount: RecurringCredit.AccessAmount;
1503
2697
 
1504
2698
  /**
1505
- * The amount of time the created commits will be valid for.
2699
+ * Defines the length of the access schedule for each created commit/credit. The
2700
+ * value represents the number of units. Unit defaults to "PERIODS", where the
2701
+ * length of a period is determined by the recurrence_frequency.
1506
2702
  */
1507
2703
  commit_duration: RecurringCredit.CommitDuration;
1508
2704
 
@@ -1538,6 +2734,11 @@ export namespace ContractCreateParams {
1538
2734
  */
1539
2735
  ending_before?: string;
1540
2736
 
2737
+ /**
2738
+ * Optional configuration for recurring commit/credit hierarchy access control
2739
+ */
2740
+ hierarchy_configuration?: RecurringCredit.HierarchyConfiguration;
2741
+
1541
2742
  /**
1542
2743
  * displayed on invoices. will be passed through to the individual commits
1543
2744
  */
@@ -1563,10 +2764,10 @@ export namespace ContractCreateParams {
1563
2764
  * The frequency at which the recurring commits will be created. If not provided: -
1564
2765
  * The commits will be created on the usage invoice frequency. If provided: - The
1565
2766
  * 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
2767
+ * be created aligned with the recurring commit's starting_at rather than the usage
1567
2768
  * invoice dates.
1568
2769
  */
1569
- recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
2770
+ recurrence_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1570
2771
 
1571
2772
  /**
1572
2773
  * Will be passed down to the individual commits. This controls how much of an
@@ -1575,6 +2776,14 @@ export namespace ContractCreateParams {
1575
2776
  */
1576
2777
  rollover_fraction?: number;
1577
2778
 
2779
+ /**
2780
+ * List of filters that determine what kind of customer usage draws down a commit
2781
+ * or credit. A customer's usage needs to meet the condition of at least one of the
2782
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
2783
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
2784
+ */
2785
+ specifiers?: Array<RecurringCredit.Specifier>;
2786
+
1578
2787
  /**
1579
2788
  * A temporary ID that can be used to reference the recurring commit for commit
1580
2789
  * specific overrides.
@@ -1589,18 +2798,67 @@ export namespace ContractCreateParams {
1589
2798
  export interface AccessAmount {
1590
2799
  credit_type_id: string;
1591
2800
 
1592
- quantity: number;
1593
-
1594
2801
  unit_price: number;
2802
+
2803
+ /**
2804
+ * This field is currently required. Upcoming recurring commit/credit configuration
2805
+ * options will allow it to be optional.
2806
+ */
2807
+ quantity?: number;
1595
2808
  }
1596
2809
 
1597
2810
  /**
1598
- * The amount of time the created commits will be valid for.
2811
+ * Defines the length of the access schedule for each created commit/credit. The
2812
+ * value represents the number of units. Unit defaults to "PERIODS", where the
2813
+ * length of a period is determined by the recurrence_frequency.
1599
2814
  */
1600
2815
  export interface CommitDuration {
1601
- unit: 'PERIODS';
1602
-
1603
2816
  value: number;
2817
+
2818
+ unit?: 'PERIODS';
2819
+ }
2820
+
2821
+ /**
2822
+ * Optional configuration for recurring commit/credit hierarchy access control
2823
+ */
2824
+ export interface HierarchyConfiguration {
2825
+ child_access:
2826
+ | HierarchyConfiguration.CommitHierarchyChildAccessAll
2827
+ | HierarchyConfiguration.CommitHierarchyChildAccessNone
2828
+ | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
2829
+ }
2830
+
2831
+ export namespace HierarchyConfiguration {
2832
+ export interface CommitHierarchyChildAccessAll {
2833
+ type: 'ALL';
2834
+ }
2835
+
2836
+ export interface CommitHierarchyChildAccessNone {
2837
+ type: 'NONE';
2838
+ }
2839
+
2840
+ export interface CommitHierarchyChildAccessContractIDs {
2841
+ contract_ids: Array<string>;
2842
+
2843
+ type: 'CONTRACT_IDS';
2844
+ }
2845
+ }
2846
+
2847
+ export interface Specifier {
2848
+ presentation_group_values?: { [key: string]: string };
2849
+
2850
+ pricing_group_values?: { [key: string]: string };
2851
+
2852
+ /**
2853
+ * If provided, the specifier will only apply to the product with the specified ID.
2854
+ */
2855
+ product_id?: string;
2856
+
2857
+ /**
2858
+ * If provided, the specifier will only apply to products with all the specified
2859
+ * tags.
2860
+ */
2861
+ product_tags?: Array<string>;
1604
2862
  }
1605
2863
  }
1606
2864
 
@@ -1763,15 +3021,119 @@ export namespace ContractCreateParams {
1763
3021
  }
1764
3022
  }
1765
3023
 
3024
+ export interface SpendThresholdConfiguration {
3025
+ commit: SpendThresholdConfiguration.Commit;
3026
+
3027
+ /**
3028
+ * When set to false, the contract will not be evaluated against the
3029
+ * threshold_amount. Toggling to true will result an immediate evaluation,
3030
+ * regardless of prior state.
3031
+ */
3032
+ is_enabled: boolean;
3033
+
3034
+ payment_gate_config: SpendThresholdConfiguration.PaymentGateConfig;
3035
+
3036
+ /**
3037
+ * Specify the threshold amount for the contract. Each time the contract's usage
3038
+ * hits this amount, a threshold charge will be initiated.
3039
+ */
3040
+ threshold_amount: number;
3041
+ }
3042
+
3043
+ export namespace SpendThresholdConfiguration {
3044
+ export interface Commit {
3045
+ /**
3046
+ * The commit product that will be used to generate the line item for commit
3047
+ * payment.
3048
+ */
3049
+ product_id: string;
3050
+
3051
+ description?: string;
3052
+
3053
+ /**
3054
+ * Specify the name of the line item for the threshold charge. If left blank, it
3055
+ * will default to the commit product name.
3056
+ */
3057
+ name?: string;
3058
+ }
3059
+
3060
+ export interface PaymentGateConfig {
3061
+ /**
3062
+ * Gate access to the commit balance based on successful collection of payment.
3063
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
3064
+ * facilitate payment using your own payment integration. Select NONE if you do not
3065
+ * wish to payment gate the commit balance.
3066
+ */
3067
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
3068
+
3069
+ /**
3070
+ * Only applicable if using PRECALCULATED as your tax type.
3071
+ */
3072
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
3073
+
3074
+ /**
3075
+ * Only applicable if using STRIPE as your payment gate type.
3076
+ */
3077
+ stripe_config?: PaymentGateConfig.StripeConfig;
3078
+
3079
+ /**
3080
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
3081
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
3082
+ * will default to NONE.
3083
+ */
3084
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
3085
+ }
3086
+
3087
+ export namespace PaymentGateConfig {
3088
+ /**
3089
+ * Only applicable if using PRECALCULATED as your tax type.
3090
+ */
3091
+ export interface PrecalculatedTaxConfig {
3092
+ /**
3093
+ * Amount of tax to be applied. This should be in the same currency and
3094
+ * denomination as the commit's invoice schedule
3095
+ */
3096
+ tax_amount: number;
3097
+
3098
+ /**
3099
+ * Name of the tax to be applied. This may be used in an invoice line item
3100
+ * description.
3101
+ */
3102
+ tax_name?: string;
3103
+ }
3104
+
3105
+ /**
3106
+ * Only applicable if using STRIPE as your payment gate type.
3107
+ */
3108
+ export interface StripeConfig {
3109
+ /**
3110
+ * If left blank, will default to INVOICE
3111
+ */
3112
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
3113
+
3114
+ /**
3115
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
3116
+ * your payment type.
3117
+ */
3118
+ invoice_metadata?: { [key: string]: string };
3119
+ }
3120
+ }
3121
+ }
3122
+
1766
3123
  export interface Subscription {
1767
3124
  collection_schedule: 'ADVANCE' | 'ARREARS';
1768
3125
 
3126
+ /**
3127
+ * The initial quantity for the subscription. It must be non-negative value.
3128
+ */
1769
3129
  initial_quantity: number;
1770
3130
 
1771
3131
  proration: Subscription.Proration;
1772
3132
 
1773
3133
  subscription_rate: Subscription.SubscriptionRate;
1774
3134
 
3135
+ custom_fields?: { [key: string]: string };
3136
+
1775
3137
  description?: string;
1776
3138
 
1777
3139
  /**
@@ -1810,7 +3172,7 @@ export namespace ContractCreateParams {
1810
3172
  * Frequency to bill subscription with. Together with product_id, must match
1811
3173
  * existing rate on the rate card.
1812
3174
  */
1813
- billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
3175
+ billing_frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1814
3176
 
1815
3177
  /**
1816
3178
  * Must be subscription type product
@@ -1819,50 +3181,6 @@ export namespace ContractCreateParams {
1819
3181
  }
1820
3182
  }
1821
3183
 
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
3184
  export interface Transition {
1867
3185
  from_contract_id: string;
1868
3186
 
@@ -1885,7 +3203,7 @@ export namespace ContractCreateParams {
1885
3203
  }
1886
3204
 
1887
3205
  export interface UsageStatementSchedule {
1888
- frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
3206
+ frequency: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
1889
3207
 
1890
3208
  /**
1891
3209
  * Required when using CUSTOM_DATE. This option lets you set a historical billing
@@ -2022,7 +3340,7 @@ export interface ContractAmendParams {
2022
3340
 
2023
3341
  credits?: Array<ContractAmendParams.Credit>;
2024
3342
 
2025
- custom_fields?: Record<string, string>;
3343
+ custom_fields?: { [key: string]: string };
2026
3344
 
2027
3345
  /**
2028
3346
  * This field's availability is dependent on your client's configuration.
@@ -2078,24 +3396,31 @@ export namespace ContractAmendParams {
2078
3396
  amount?: number;
2079
3397
 
2080
3398
  /**
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.
3399
+ * Which products the commit applies to. If applicable_product_ids,
3400
+ * applicable_product_tags or specifiers are not provided, the commit applies to
3401
+ * all products.
2083
3402
  */
2084
3403
  applicable_product_ids?: Array<string>;
2085
3404
 
2086
3405
  /**
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.
3406
+ * Which tags the commit applies to. If applicable_product_ids,
3407
+ * applicable_product_tags or specifiers are not provided, the commit applies to
3408
+ * all products.
2089
3409
  */
2090
3410
  applicable_product_tags?: Array<string>;
2091
3411
 
2092
- custom_fields?: Record<string, string>;
3412
+ custom_fields?: { [key: string]: string };
2093
3413
 
2094
3414
  /**
2095
3415
  * Used only in UI/API. It is not exposed to end customers.
2096
3416
  */
2097
3417
  description?: string;
2098
3418
 
3419
+ /**
3420
+ * Optional configuration for commit hierarchy access control
3421
+ */
3422
+ hierarchy_configuration?: Commit.HierarchyConfiguration;
3423
+
2099
3424
  /**
2100
3425
  * Required for "POSTPAID" commits: the true up invoice will be generated at this
2101
3426
  * time and only one schedule item is allowed; the total must match access_schedule
@@ -2114,6 +3439,11 @@ export namespace ContractAmendParams {
2114
3439
  */
2115
3440
  netsuite_sales_order_id?: string;
2116
3441
 
3442
+ /**
3443
+ * optionally payment gate this commit
3444
+ */
3445
+ payment_gate_config?: Commit.PaymentGateConfig;
3446
+
2117
3447
  /**
2118
3448
  * If multiple commits are applicable, the one with the lower priority will apply
2119
3449
  * first.
@@ -2127,6 +3457,14 @@ export namespace ContractAmendParams {
2127
3457
  */
2128
3458
  rollover_fraction?: number;
2129
3459
 
3460
+ /**
3461
+ * List of filters that determine what kind of customer usage draws down a commit
3462
+ * or credit. A customer's usage needs to meet the condition of at least one of the
3463
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
3464
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
3465
+ */
3466
+ specifiers?: Array<Commit.Specifier>;
3467
+
2130
3468
  /**
2131
3469
  * A temporary ID for the commit that can be used to reference the commit for
2132
3470
  * commit specific overrides.
@@ -2165,6 +3503,32 @@ export namespace ContractAmendParams {
2165
3503
  }
2166
3504
  }
2167
3505
 
3506
+ /**
3507
+ * Optional configuration for commit hierarchy access control
3508
+ */
3509
+ export interface HierarchyConfiguration {
3510
+ child_access:
3511
+ | HierarchyConfiguration.CommitHierarchyChildAccessAll
3512
+ | HierarchyConfiguration.CommitHierarchyChildAccessNone
3513
+ | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
3514
+ }
3515
+
3516
+ export namespace HierarchyConfiguration {
3517
+ export interface CommitHierarchyChildAccessAll {
3518
+ type: 'ALL';
3519
+ }
3520
+
3521
+ export interface CommitHierarchyChildAccessNone {
3522
+ type: 'NONE';
3523
+ }
3524
+
3525
+ export interface CommitHierarchyChildAccessContractIDs {
3526
+ contract_ids: Array<string>;
3527
+
3528
+ type: 'CONTRACT_IDS';
3529
+ }
3530
+ }
3531
+
2168
3532
  /**
2169
3533
  * Required for "POSTPAID" commits: the true up invoice will be generated at this
2170
3534
  * time and only one schedule item is allowed; the total must match access_schedule
@@ -2261,6 +3625,88 @@ export namespace ContractAmendParams {
2261
3625
  unit_price?: number;
2262
3626
  }
2263
3627
  }
3628
+
3629
+ /**
3630
+ * optionally payment gate this commit
3631
+ */
3632
+ export interface PaymentGateConfig {
3633
+ /**
3634
+ * Gate access to the commit balance based on successful collection of payment.
3635
+ * Select STRIPE for Metronome to facilitate payment via Stripe. Select EXTERNAL to
3636
+ * facilitate payment using your own payment integration. Select NONE if you do not
3637
+ * wish to payment gate the commit balance.
3638
+ */
3639
+ payment_gate_type: 'NONE' | 'STRIPE' | 'EXTERNAL';
3640
+
3641
+ /**
3642
+ * Only applicable if using PRECALCULATED as your tax type.
3643
+ */
3644
+ precalculated_tax_config?: PaymentGateConfig.PrecalculatedTaxConfig;
3645
+
3646
+ /**
3647
+ * Only applicable if using STRIPE as your payment gate type.
3648
+ */
3649
+ stripe_config?: PaymentGateConfig.StripeConfig;
3650
+
3651
+ /**
3652
+ * Stripe tax is only supported for Stripe payment gateway. Select NONE if you do
3653
+ * not wish Metronome to calculate tax on your behalf. Leaving this field blank
3654
+ * will default to NONE.
3655
+ */
3656
+ tax_type?: 'NONE' | 'STRIPE' | 'ANROK' | 'PRECALCULATED';
3657
+ }
3658
+
3659
+ export namespace PaymentGateConfig {
3660
+ /**
3661
+ * Only applicable if using PRECALCULATED as your tax type.
3662
+ */
3663
+ export interface PrecalculatedTaxConfig {
3664
+ /**
3665
+ * Amount of tax to be applied. This should be in the same currency and
3666
+ * denomination as the commit's invoice schedule
3667
+ */
3668
+ tax_amount: number;
3669
+
3670
+ /**
3671
+ * Name of the tax to be applied. This may be used in an invoice line item
3672
+ * description.
3673
+ */
3674
+ tax_name?: string;
3675
+ }
3676
+
3677
+ /**
3678
+ * Only applicable if using STRIPE as your payment gate type.
3679
+ */
3680
+ export interface StripeConfig {
3681
+ /**
3682
+ * If left blank, will default to INVOICE
3683
+ */
3684
+ payment_type: 'INVOICE' | 'PAYMENT_INTENT';
3685
+
3686
+ /**
3687
+ * Metadata to be added to the Stripe invoice. Only applicable if using INVOICE as
3688
+ * your payment type.
3689
+ */
3690
+ invoice_metadata?: { [key: string]: string };
3691
+ }
3692
+ }
3693
+
3694
+ export interface Specifier {
3695
+ presentation_group_values?: { [key: string]: string };
3696
+
3697
+ pricing_group_values?: { [key: string]: string };
3698
+
3699
+ /**
3700
+ * If provided, the specifier will only apply to the product with the specified ID.
3701
+ */
3702
+ product_id?: string;
3703
+
3704
+ /**
3705
+ * If provided, the specifier will only apply to products with all the specified
3706
+ * tags.
3707
+ */
3708
+ product_tags?: Array<string>;
3709
+ }
2264
3710
  }
2265
3711
 
2266
3712
  export interface Credit {
@@ -2283,13 +3729,18 @@ export namespace ContractAmendParams {
2283
3729
  */
2284
3730
  applicable_product_tags?: Array<string>;
2285
3731
 
2286
- custom_fields?: Record<string, string>;
3732
+ custom_fields?: { [key: string]: string };
2287
3733
 
2288
3734
  /**
2289
3735
  * Used only in UI/API. It is not exposed to end customers.
2290
3736
  */
2291
3737
  description?: string;
2292
3738
 
3739
+ /**
3740
+ * Optional configuration for credit hierarchy access control
3741
+ */
3742
+ hierarchy_configuration?: Credit.HierarchyConfiguration;
3743
+
2293
3744
  /**
2294
3745
  * displayed on invoices
2295
3746
  */
@@ -2307,6 +3758,14 @@ export namespace ContractAmendParams {
2307
3758
  priority?: number;
2308
3759
 
2309
3760
  rate_type?: 'COMMIT_RATE' | 'LIST_RATE';
3761
+
3762
+ /**
3763
+ * List of filters that determine what kind of customer usage draws down a commit
3764
+ * or credit. A customer's usage needs to meet the condition of at least one of the
3765
+ * specifiers to contribute to a commit's or credit's drawdown. This field cannot
3766
+ * be used together with `applicable_product_ids` or `applicable_product_tags`.
3767
+ */
3768
+ specifiers?: Array<Credit.Specifier>;
2310
3769
  }
2311
3770
 
2312
3771
  export namespace Credit {
@@ -2337,6 +3796,49 @@ export namespace ContractAmendParams {
2337
3796
  starting_at: string;
2338
3797
  }
2339
3798
  }
3799
+
3800
+ /**
3801
+ * Optional configuration for credit hierarchy access control
3802
+ */
3803
+ export interface HierarchyConfiguration {
3804
+ child_access:
3805
+ | HierarchyConfiguration.CommitHierarchyChildAccessAll
3806
+ | HierarchyConfiguration.CommitHierarchyChildAccessNone
3807
+ | HierarchyConfiguration.CommitHierarchyChildAccessContractIDs;
3808
+ }
3809
+
3810
+ export namespace HierarchyConfiguration {
3811
+ export interface CommitHierarchyChildAccessAll {
3812
+ type: 'ALL';
3813
+ }
3814
+
3815
+ export interface CommitHierarchyChildAccessNone {
3816
+ type: 'NONE';
3817
+ }
3818
+
3819
+ export interface CommitHierarchyChildAccessContractIDs {
3820
+ contract_ids: Array<string>;
3821
+
3822
+ type: 'CONTRACT_IDS';
3823
+ }
3824
+ }
3825
+
3826
+ export interface Specifier {
3827
+ presentation_group_values?: { [key: string]: string };
3828
+
3829
+ pricing_group_values?: { [key: string]: string };
3830
+
3831
+ /**
3832
+ * If provided, the specifier will only apply to the product with the specified ID.
3833
+ */
3834
+ product_id?: string;
3835
+
3836
+ /**
3837
+ * If provided, the specifier will only apply to products with all the specified
3838
+ * tags.
3839
+ */
3840
+ product_tags?: Array<string>;
3841
+ }
2340
3842
  }
2341
3843
 
2342
3844
  export interface Discount {
@@ -2347,7 +3849,7 @@ export namespace ContractAmendParams {
2347
3849
  */
2348
3850
  schedule: Discount.Schedule;
2349
3851
 
2350
- custom_fields?: Record<string, string>;
3852
+ custom_fields?: { [key: string]: string };
2351
3853
 
2352
3854
  /**
2353
3855
  * displayed on invoices
@@ -2533,7 +4035,7 @@ export namespace ContractAmendParams {
2533
4035
 
2534
4036
  export namespace Override {
2535
4037
  export interface OverrideSpecifier {
2536
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
4038
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
2537
4039
 
2538
4040
  /**
2539
4041
  * Can only be used for commit specific overrides. Must be used in conjunction with
@@ -2547,13 +4049,13 @@ export namespace ContractAmendParams {
2547
4049
  * A map of group names to values. The override will only apply to line items with
2548
4050
  * the specified presentation group values.
2549
4051
  */
2550
- presentation_group_values?: Record<string, string>;
4052
+ presentation_group_values?: { [key: string]: string };
2551
4053
 
2552
4054
  /**
2553
4055
  * A map of pricing group names to values. The override will only apply to products
2554
4056
  * with the specified pricing group values.
2555
4057
  */
2556
- pricing_group_values?: Record<string, string>;
4058
+ pricing_group_values?: { [key: string]: string };
2557
4059
 
2558
4060
  /**
2559
4061
  * If provided, the override will only apply to the product with the specified ID.
@@ -2595,7 +4097,7 @@ export namespace ContractAmendParams {
2595
4097
  * Only set for CUSTOM rate_type. This field is interpreted by custom rate
2596
4098
  * processors.
2597
4099
  */
2598
- custom_rate?: Record<string, unknown>;
4100
+ custom_rate?: { [key: string]: unknown };
2599
4101
 
2600
4102
  /**
2601
4103
  * Default proration configuration. Only valid for SUBSCRIPTION rate_type. Must be
@@ -2647,7 +4149,7 @@ export namespace ContractAmendParams {
2647
4149
  */
2648
4150
  unit_price: number;
2649
4151
 
2650
- custom_fields?: Record<string, string>;
4152
+ custom_fields?: { [key: string]: string };
2651
4153
 
2652
4154
  description?: string;
2653
4155
 
@@ -2867,7 +4369,7 @@ export namespace ContractCreateHistoricalInvoicesParams {
2867
4369
 
2868
4370
  breakdown_granularity?: 'HOUR' | 'DAY';
2869
4371
 
2870
- custom_fields?: Record<string, string>;
4372
+ custom_fields?: { [key: string]: string };
2871
4373
  }
2872
4374
 
2873
4375
  export namespace Invoice {
@@ -2878,9 +4380,9 @@ export namespace ContractCreateHistoricalInvoicesParams {
2878
4380
 
2879
4381
  product_id: string;
2880
4382
 
2881
- presentation_group_values?: Record<string, string>;
4383
+ presentation_group_values?: { [key: string]: string };
2882
4384
 
2883
- pricing_group_values?: Record<string, string>;
4385
+ pricing_group_values?: { [key: string]: string };
2884
4386
 
2885
4387
  quantity?: number;
2886
4388
 
@@ -2915,7 +4417,7 @@ export interface ContractListBalancesParams {
2915
4417
  effective_before?: string;
2916
4418
 
2917
4419
  /**
2918
- * Include credits from archived contracts.
4420
+ * Include archived credits and credits from archived contracts.
2919
4421
  */
2920
4422
  include_archived?: boolean;
2921
4423
 
@@ -2936,6 +4438,11 @@ export interface ContractListBalancesParams {
2936
4438
  */
2937
4439
  include_ledgers?: boolean;
2938
4440
 
4441
+ /**
4442
+ * The maximum number of commits to return. Defaults to 25.
4443
+ */
4444
+ limit?: number;
4445
+
2939
4446
  /**
2940
4447
  * The next page token from a previous response.
2941
4448
  */
@@ -2988,19 +4495,19 @@ export namespace ContractRetrieveRateScheduleParams {
2988
4495
  * Subscription rates matching the billing frequency will be included in the
2989
4496
  * response.
2990
4497
  */
2991
- billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL';
4498
+ billing_frequency?: 'MONTHLY' | 'QUARTERLY' | 'ANNUAL' | 'WEEKLY';
2992
4499
 
2993
4500
  /**
2994
4501
  * List of pricing group key value pairs, rates containing the matching key / value
2995
4502
  * pairs will be included in the response.
2996
4503
  */
2997
- partial_pricing_group_values?: Record<string, string>;
4504
+ partial_pricing_group_values?: { [key: string]: string };
2998
4505
 
2999
4506
  /**
3000
4507
  * List of pricing group key value pairs, rates matching all of the key / value
3001
4508
  * pairs will be included in the response.
3002
4509
  */
3003
- pricing_group_values?: Record<string, string>;
4510
+ pricing_group_values?: { [key: string]: string };
3004
4511
 
3005
4512
  /**
3006
4513
  * Rates matching the product id will be included in the response.
@@ -3015,6 +4522,14 @@ export namespace ContractRetrieveRateScheduleParams {
3015
4522
  }
3016
4523
  }
3017
4524
 
4525
+ export interface ContractRetrieveSubscriptionQuantityHistoryParams {
4526
+ contract_id: string;
4527
+
4528
+ customer_id: string;
4529
+
4530
+ subscription_id: string;
4531
+ }
4532
+
3018
4533
  export interface ContractScheduleProServicesInvoiceParams {
3019
4534
  contract_id: string;
3020
4535
 
@@ -3141,6 +4656,7 @@ export declare namespace Contracts {
3141
4656
  type ContractCreateHistoricalInvoicesResponse as ContractCreateHistoricalInvoicesResponse,
3142
4657
  type ContractListBalancesResponse as ContractListBalancesResponse,
3143
4658
  type ContractRetrieveRateScheduleResponse as ContractRetrieveRateScheduleResponse,
4659
+ type ContractRetrieveSubscriptionQuantityHistoryResponse as ContractRetrieveSubscriptionQuantityHistoryResponse,
3144
4660
  type ContractScheduleProServicesInvoiceResponse as ContractScheduleProServicesInvoiceResponse,
3145
4661
  type ContractUpdateEndDateResponse as ContractUpdateEndDateResponse,
3146
4662
  type ContractCreateParams as ContractCreateParams,
@@ -3152,6 +4668,7 @@ export declare namespace Contracts {
3152
4668
  type ContractCreateHistoricalInvoicesParams as ContractCreateHistoricalInvoicesParams,
3153
4669
  type ContractListBalancesParams as ContractListBalancesParams,
3154
4670
  type ContractRetrieveRateScheduleParams as ContractRetrieveRateScheduleParams,
4671
+ type ContractRetrieveSubscriptionQuantityHistoryParams as ContractRetrieveSubscriptionQuantityHistoryParams,
3155
4672
  type ContractScheduleProServicesInvoiceParams as ContractScheduleProServicesInvoiceParams,
3156
4673
  type ContractSetUsageFilterParams as ContractSetUsageFilterParams,
3157
4674
  type ContractUpdateEndDateParams as ContractUpdateEndDateParams,
@@ -3181,12 +4698,14 @@ export declare namespace Contracts {
3181
4698
  type RateCardRetrieveResponse as RateCardRetrieveResponse,
3182
4699
  type RateCardUpdateResponse as RateCardUpdateResponse,
3183
4700
  type RateCardListResponse as RateCardListResponse,
4701
+ type RateCardArchiveResponse as RateCardArchiveResponse,
3184
4702
  type RateCardRetrieveRateScheduleResponse as RateCardRetrieveRateScheduleResponse,
3185
4703
  RateCardListResponsesCursorPage as RateCardListResponsesCursorPage,
3186
4704
  type RateCardCreateParams as RateCardCreateParams,
3187
4705
  type RateCardRetrieveParams as RateCardRetrieveParams,
3188
4706
  type RateCardUpdateParams as RateCardUpdateParams,
3189
4707
  type RateCardListParams as RateCardListParams,
4708
+ type RateCardArchiveParams as RateCardArchiveParams,
3190
4709
  type RateCardRetrieveRateScheduleParams as RateCardRetrieveRateScheduleParams,
3191
4710
  };
3192
4711